- Notifications
You must be signed in to change notification settings - Fork750
Closed
Description
Environment
- Pythonnet version: All
- Python version: All
- Operating System: All
Details
- Describe what you were trying to get done.
Loading an assembly called MyAssembly. Assembly did not exist, should have resulted in an error, but instead it loaded MyAssemblyTest.
This can be done using Assembly.Load("AssemblyName").
Effectively this changes the way .NET normally loads assemblies and it ignores things such as strong naming. This could cause all kinds of unexpected effects in larger systems.
staticAssemblyResolveHandler(Objectob,ResolveEventArgsargs){stringname=args.Name.ToLower();for(inti=0;i<assemblies.Count;i++){Assemblya=(Assembly)assemblies[i];stringfull=a.FullName.ToLower();if(full.StartsWith(name)){// this is a problem!returna;}}returnLoadAssemblyPath(args.Name);}
The FindAssembly method has obvious issues as well, but it only searches inside the python path, so the effect there is limited. The ResolveHandler searches through all currently loaded assemblies, which is a bigger problem.