Click here to Skip to main content
15,667,735 members

Comments by wpte (Top 18 by date)

wpte 12-Dec-14 8:00am View    
Reason for my vote of 3 \n The idea is there, but it could be much simpler.
Right now you have an interface, 2 implementations and which wraps it all.

Why not 1 static class, static constructor which sets the corresponding filename in the static field to use by the pinvoke methods?

It'll be just 1 file, no wrappers, less code and faster! :D

Moreover, the exported methods you use dll-import on are static anyway, so any OO argument is invalid.
wpte 19-Sep-13 17:04pm View    
I already use AppDomains extensively throughout my software.. Currently I only index the sub-directories once with reflection only load, so I can store the AssemblyName classes. When I'm done I throw away the AppDomain so no unnecessary memory is claimed. Since the construction of the cache only has to happen once, the resolving part is quite quick.
wpte 19-Sep-13 16:32pm View    
I load plugins in my programs using Assembly.LoadFrom. Some of these plugins require other Assemblies (references) which are not located in the GAC. With the event I attempt to load these references by trying to find them in some sub directories.
wpte 19-Sep-13 15:50pm View    
Allright. There's no way to check the correct version however. The only way to match the correct assembly is by matching strings. Bit unfortunate to be honest.

Still I'm convinced the event is called before .NET uses it's own resolver. I also get requests for System.something Assemblies which clearly need to be found in the GAC.

Also sorry for all the double posts, some code project maintenance was messing it up :(
wpte 19-Sep-13 15:15pm View    
Actually since .NET 4.0 the event is raised for every assembly.

"Beginning with the .NET Framework 4, the ResolveEventHandler event is raised for all assemblies, including resource assemblies. In earlier versions, the event was not raised for resource assemblies. If the operating system is localized, the handler might be called multiple times: once for each culture in the fallback chain."

If null is returned the .NET system will attempt to load the Assembly by itself, using the GAC for example.

I'm talking about embedded resources. I do get requests of these embedded resources. The request name is formatted something like: "Namespace.ResourceName.resources" instead of the usual AssemblyName.FullName format.