[Mono-bugs] [Bug 74958][Nor] New - Assembly.Location should return empty string if assembly was loaded from byte array

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun May 15 09:46:05 EDT 2005


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by gert.driesen at pandora.be.

http://bugzilla.ximian.com/show_bug.cgi?id=74958

--- shadow/74958	2005-05-15 09:46:05.000000000 -0400
+++ shadow/74958.tmp.1325	2005-05-15 09:46:05.000000000 -0400
@@ -0,0 +1,63 @@
+Bug#: 74958
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: gert.driesen at pandora.be               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Assembly.Location should return empty string if assembly was loaded from byte array
+
+(I've categorized this issue as a runtime bug, as the Load overloads 
+taking a byte array are implemented in the runtime. I hope this is ok.)
+
+In Mono, Assembly.Location is not empty when an assembly is loaded from a 
+byte array.
+
+This is documented in the .NET Framework SDK docs for the Location 
+property:
+
+"If the assembly is loaded from a byte array, such as when using the Load
+(Byte[]) method, Location is an empty string ("")."
+
+To reproduce this issue, compile and run the following code snippet:
+
+using System;
+using System.IO;
+using System.Reflection;
+
+public class EntryPoint {
+  public static void Main() {
+    Assembly corlib = Assembly.LoadWithPartialName("mscorlib");
+
+    using (FileStream fs = File.OpenRead(corlib.Location)) {
+      byte[] buffer = new byte[fs.Length];
+      fs.Read(buffer, 0, buffer.Length);
+      Assembly compiledAssembly = Assembly.Load(buffer);
+      if (compiledAssembly.Location != string.Empty) {
+        Console.WriteLine("Location: " + compiledAssembly.Location);
+      }
+      fs.Close();
+    }
+  }
+}
+
+Actual result:
+
+Location: <prefix>/mscorlib.dll
+
+Expected result:
+
+No output
+
+I've committed a unit test (in AssemblyTest.cs) to verify the correct 
+behaviour, but marked it with the Ignore attribute until this bug is 
+fixed.


More information about the mono-bugs mailing list