‘By Design’? BindingFailure - An assembly failed to load while using XMLSerialization

Here’s an issue that cost me several hours and I suspect that there’s something in Visual Studio 2010 – and the size of my solution – that’s to blame.

I was quite happily working in the MsmqToWcf example of the WF_WCF_Samples to learn about MSMQ. So far so good.

However, when I moved to my real project I got an exception in debug mode:

The assembly with display name 'Report.XmlSerializers' failed to load in the 'LoadFrom' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly 'Report.XmlSerializers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

Unable to track down the error in my own project, I went back to the working example and gradually replaced the example code with my own code. Everything worked just fine!

Back I went to my own project and boom! That stupid stopped by debugger again.

A search on the InterWebs shows many people have had this one and it was reproduced in 2005 and filed as a bug in Microsoft Connect. The strangest thing was to see it “Closed as By Design”.

Okay, so Microsoft’s code is probing for a pre-generated assembly and throwing an exception as a binding failure.The debugger sees this and stops.

And this behaviour is ‘By Design’? That’s because if you aren’t debugging it won’t actually fail. How reassuring!

My sense is that since the identical code fails in one big project while working fine in another small one, there’s a timing issue in the code generation. Something behind the scenes isn’t ready on schedule and hundreds of developers have lost valuable time because of it.

Maybe people at Microsoft have such high end equipment (e.g.,  solid state drives) that they can’t reproduce these types of anomalies?

Anyway, as the guy says on TV, “JUST FIX IT”.

Ken

1 Comment

Comments have been disabled for this content.