So we all love the XmlSerializer right! Probably a lot more than the DataContractSerializer, but then we have had more time to get used to it's ways. Most of the time we don't need to care what's going on, but sometimes (and usually when we are forced into doing some custom serialization) it doesn't do exactly what we expected and after the allowable "couple of minutes" of trial and error (or is that just me) we need to step through the serialization code to see what's up.
First thing needed is to add diagnostics switches on XmlSerializer in the applications config file:
1: <system.diagnostics>
2: <switches>
3: <add name="XmlSerialization.Compilation" value="1" />
4: </switches>
5: </system.diagnostics>
Then compile and run the application in debug to the point immediately after the XmlSerializer in constructed for the type:
1: XmlSerializer ser = new XmlSerializer(typeof(MyType));
The dynamic assembly and c# source is created in c:\documents and settings\[user]\local settings\temp under XP or c:\users\[user]\appdata\local under Vista - open the latest created *.cs file in your debug visual studio instance and off you go!