The compiler failed with the following message:
“Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.”
I know this has something to do with serialization (as soon as I uncomment a method tagged with [OnSerialized] the build fails.
How can I inspect LoaderExceptions? Or more generally speaking how can I trap and inspect any exceptions thrown by c# compiler?
You could try running csc.exe under windbg.exe and inspect the managed exceptions getting thrown. If there’s a particular first chance exception that you need to break on, you can issue the
sxe <exception>command. Then, load the sos.dll (.loadby sos.dll mscorwks) extension and inspect the exception getting thrown with!pe.