Bugzilla – Bug 323179
Assembly.LoadFile caching Same assembly from different paths
Last modified: 2008-02-27 11:20:53 UTC
---- Reported by spigaz@gmail.com 2007-01-10 08:49:06 MST ---- Description of Problem: The Assembly.LoadFile method is behaving as Assembly.LoadFrom, and it can't. As stated on the msdn2 and tested on .net 2.0, the Assembly.LoadFile method doesn't cache the loading of assemblies with the same AssemblyName from diferent paths. Steps to reproduce the problem: 1. Create a File Fake.cs in a Directory A, and compile it to Fake.dll: class FakeA{} 2. Create a File Fake.cs in a Directory B, and compile it to Fake.dll: class FakeB{} 3. In the outer directory create a file AssemblyLoad.cs and compile it to AssemblyLoad.exe: using System.IO; using System.Reflection; public class AssemblyLoad { public static void Main(string[] args) { System.Console.WriteLine(Assembly.LoadFile(Path.Combine(Directory.GetCurrentDirectory(), Path.Combine("A", "Fake.dll"))).Location); System.Console.WriteLine(Assembly.LoadFile(Path.Combine(Directory.GetCurrentDirectory(), Path.Combine("B", "Fake.dll"))).Location); } } 4. Execute AssemblyLoad.exe Actual Results: /AssemblyLoad/A/Fake.dll /AssemblyLoad/A/Fake.dll Expected Results: /AssemblyLoad/A/Fake.dll /AssemblyLoad/B/Fake.dll How often does this happen? Always. Additional Information: Tested on .net 2.0: C:\AssemblyLoad\A\Fake.dll C:\AssemblyLoad\B\Fake.dll ---- Additional Comments From spigaz@gmail.com 2007-01-10 09:33:48 MST ---- I think this bug is related: https://bugzilla.novell.com/show_bug.cgi?id=MONO78464
*** This bug has been marked as a duplicate of bug 321202 ***