(no subject)

Jun 26, 2009 10:03

A while ago I said you could " blindly return your own assembly" in the AssemblyResolve event of your AppDomain to resolve issues with deserializers not finding your dynamically-loaded assembly. Do not do this. If you did do this, go back and fix your code right now.

You really do need to check the Name property of the ResolveEventArgs and make sure they're asking for your assembly. Otherwise, you'll get in to a state like this:
? RuntimeAssembly.Load("SomeAssembly").FullName
"SomeCompletelyDifferentAssembly"
If you were lucky enough that you were actually calling Load on RuntimeAssembly (unlikely, since it's internal), this would be a fairly straightforward bug. But in my case the manifestation was "Unable to load type SomeType required for deserialization" when deserializing an object of that type. The real bitch of it all is that the "just always return my assembly" thing works perfectly as long as you're the only one who needs to do it.
Previous post Next post
Up