[Mono-bugs] [Bug 74958][Nor] Changed - 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
Fri May 20 14:03:09 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-18 09:10:58.000000000 -0400
+++ shadow/74958.tmp.17347 2005-05-20 14:03:08.000000000 -0400
@@ -71,6 +71,60 @@
------- Additional Comments From gert.driesen at pandora.be 2005-05-18 09:10 -------
Sorry about that.
I'll attach a testcase and unit test that uses SRE or CodeDom to
create the assembly that is loaded (from a byte array) and test it
on .NET 2.0 beta 2 too.
+
+------- Additional Comments From gert.driesen at pandora.be 2005-05-20 14:03 -------
+I've now updated the test app to use SRE to create the assembly:
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Reflection.Emit;
+
+public class EntryPoint {
+ public static void Main() {
+ string assemblyFileName = Path.Combine(Path.GetTempPath(),
+ "AssemblyLocation.dll");
+
+ try {
+ AssemblyName assemblyName = new AssemblyName();
+ assemblyName.Name = "AssemblyLocation";
+
+ AssemblyBuilder ab =
+AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName,
+AssemblyBuilderAccess.Save, Path.GetTempPath(),
+AppDomain.CurrentDomain.Evidence);
+ ab.Save(Path.GetFileName(assemblyFileName));
+
+ using (FileStream fs = File.OpenRead(assemblyFileName)) {
+ byte[] buffer = new byte[fs.Length];
+ fs.Read(buffer, 0, buffer.Length);
+ Assembly loadedAssembly = Assembly.Load(buffer);
+
+ if (loadedAssembly.Location != string.Empty) {
+ Console.WriteLine("LOCATION NOT EMPTY: " +
+loadedAssembly.Location);
+ }
+ fs.Close();
+ }
+ } catch (Exception ex) {
+ Console.WriteLine(ex.ToString());
+ } finally {
+ File.Delete(assemblyFileName);
+ }
+ }
+}
+
+Actual result:
+
+LOCATION NOT EMPTY: data-xxxxxxx
+
+Expected result:
+
+No output.
+
+This test works fine on .NET 1.x and 2.x, and fails on Mono.
+
+I'll update the corresponding unit test accordingly.
More information about the mono-bugs
mailing list