I am facing a problem that I can't seem to explain what is going on.
It is likely that if I use AppDomain.AssemblyResolve
event in my DLL(C#) and I use Entity Framework, somehow, I see it tries to load the following resource file:
EntityFramework.resources, Version=6.0.0.0, Culture=fr-FR, PublicKeyToken=b77a5c561934e089
and after
EntityFramework.resources, Version=6.0.0.0, Culture=fr, PublicKeyToken=b77a5c561934e089
I can't figure out where they could reside and neither if they exist somewhere. I can't find any discussion or Microsoft site talking about that.
For sure, everything works well if I return null in my event for that resources as state in Microsoft's documentation on AssemblyResolve
event but the problem is that I would like to be able to not return null because there is another DLL (built before .NET 4) that is done by an external company and use in the same application than my DLL that will try to load the assembly resource file and throw an exception which makes the application crash.
For that reason, I,m trying to understand how to handle that particular case and avoid returning null.
Does someone have any explanation why Entity Framework would try to load those resources files and if there is a way to handle this without returning null from aassemblyresolve
?
I figured it out myself.
The solution is simple.
When asked for
EntityFramework.resources
, simply return the "already" loadedEntityFramework
instance from the currentAppDomain
instead of usingLoadFrom/Load/LoadFile
methods.Hope this helps someone in the future.