Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

Assembly.Load(byte[]) and XmlSerializer InvalidOperationException

$
0
0

Hello,

I can't figure out what makes XmlSerializer of a type loaded by Assembly.Load(byte[]) in AssemblyResolve event handler go InvalidOperationException in Serialize or Deserialize?!

Why, if:

1. Assembly.Load(byte[]) loads the assembly without a load context(LoadNeither)?

2. XmlSerializer loads the generated assembly using the same Assembly.Load(byte[]) overload?

Why is there an InvalidOperationException then when casting from one type to another from the same assembly(serialized types)?! All assemblies should be loaded without the load context.

Then, if I use Assembly.LoadFile instead of Load(byte[]) at the same point it works fine without the IOE!? It should be loaded without the context too or am I wrong?(obviously I am)

If I make the assembly available to fusion in the probing path it loads(load context) and it also works. Default behaviour. 


Viewing all articles
Browse latest Browse all 1710

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>