According to Strange XmlSerializer error:

This exception is a part of the XmlSerializer's normal operation. It is expected and will be caught and handled inside of the Framework code. Just ignore it and continue. If it bothers you during debugging, set the Visual Studio debugger to only stop on unhandled exceptions instead of all exceptions.

Its probably being caused based on your exceptions that you are choosing to monitor.

Can you tell me how your exceptions are setup: Debug -> Exceptions

If you uncheck the "Thrown" checkbox for the BindingFailure under the Managed Debugging Assistants the exception should go away. Or if you dont want to do this, you can just continue since this exception is by design


Use the following method to construct your xmlSerializer instance will fix the problem:

XmlSerializer s = XmlSerializer.FromTypes(new[] { typeof(CustomXMLSerializeObject) })[0];

then, you don't need to turn off the exception handlings.


According to MS VS 2010 Feedback this is how it was designed. In order to prevent this exception and prevent a slow-down during run-time execution you need to generate a XML Serializer assembly.

There are three tools I could find: Microsoft SGen, XGenPlus and Mvp.Xml.XGen. As of this post, unfortunately, none of these has been updated since 2007.