Friday, October 26, 2007

System.String Is Not Serializable - BizTalk WebReferences

The title of this blog may appear to be a joke, unfortunately it is not. That is the compile error that I received recently when adding a WebReference to my Orchestrations assembly. The problem occurs under a specific set of circumstances:


  • The Orchestrations assembly is delay signed
  • Assembly verification has been turned off for the assembly rather than the key
  • A WebReference is added to the Orchestrations assembly and a WebPort is added to an orchestration

Under these circumstances you will receive a series of compile time errors to the effect of _SomeType_ is not Serializable. Generally the types I have seen are System.Int32 and System.String. Of course, anyone that knows about serialization would immediately question the validity of System.String not being serializable. But if you try to compile again, you will get an error that the assembly ~OrchestrationAssemblyName.dll is in use. Hmmm.

After beating my head against the keyboard, monitor(s), telephone, cubicle wall, etc... I called Microsoft Premier Support - it's nice to have. While waiting for my callback (the helpdesk has an expert call you) I realized that the ~OrchestrationAssemblyName.dll being created by Visual Studio in the background is being delay signed. Unfortunately this is preventing it from being loaded by Visual Studio. So I went ahead and turned off verification for the ~OrchestrationAssemblyName.dll (it only shows up for a quick second unless you have this problem) and poof, problem solved.

Microsoft was able to reproduce the problem and agreed that it is a bug in Visual Studio. Unfortunately there is no guarantee when it will be fixed since I was able to find a workaround (turn off assembly verification for the ~Assembly or at the key level). Unfortunately I still get this message every once in a while. Usually if I close and reopen Visual Studio everything is fine.

But what is the real solution? I don't really want to bind to a logical port in an Orchestration anyway. Check out my post on Direct Binding and Web Services.

No comments: