Just spend way too much time figuring out what was wrong with a BizTalk Server 2004 installation on Windows XP Professional SP1 (Dutch). Trying to add receive/send ports resulted in "Specified cast is not valid" error messages. The solution was to install Q828758 (Dutch version)... See BizTalk Server 2004 Requirements.
And herein lies the problem. The call to CreateRemotingWrapper() fires when the implicit static constuctor is called. In release mode the compiler makes certain optimizations that it does not make in debug mode. Apparently causing implicit static constructors to execute very, very early. Read More