Search code examples
c#.net.net-assembly

Assembly "Microsoft.GeneratedCode" loaded


My application reports that it has loaded an assembly called "Microsoft.GeneratedCode". I would like to verify, which part of my applications or assemblies behind, are generating this specific assembly. The assembly is loaded only once.

Details about the loaded assembly:

  • IsDynamic = true
  • Name = Microsoft.GeneratedCode
  • Version = 1.0.0.0 Culture = neutral
  • PublicKeyToken = null
  • ImageRuntimeVersion = "v4.0.30319"

In general, my application connects to an Apache ActiveMQ by using the Apache.NMS 1.7.0.3635, Apache.NMS.ActiveMQ 1.7.0.3660 and on the other side my app deals with HTTPS request/responses containing serialized models (XML).

During my research I found the answer, which indicates that the assembly "Microsoft.GeneratedCode" is related to XML serialization.


Solution

  • You could register for the event AppDomain.AssemblyLoad and then get a stack trace from within the event handler (putting a breakpoint in the handler and using the debugger would probably be the easiest way to get the stack trace).

    Although based on your research you will probably find that XML Serialization has created a dynamic assembly. There were a lot of hits when I googled for:

    xml serialization dynamically loaded assembly