[Mono-bugs] [Bug 65883][Wis] New - runtime exception in System.AppDomain:LoadAssemblyRaw -- does not happen in microsoft's runtime
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Mon, 13 Sep 2004 14:51:04 -0400 (EDT)
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 ddulai@bloomberg.net.
http://bugzilla.ximian.com/show_bug.cgi?id=65883
--- shadow/65883 2004-09-13 14:51:04.000000000 -0400
+++ shadow/65883.tmp.5607 2004-09-13 14:51:04.000000000 -0400
@@ -0,0 +1,135 @@
+Bug#: 65883
+Product: Mono: Runtime
+Version: unspecified
+OS: Debian Potato
+OS Details: custom build of mono 1.0
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: ddulai@bloomberg.net
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: runtime exception in System.AppDomain:LoadAssemblyRaw -- does not happen in microsoft's runtime
+
+Please fill in this template when reporting a bug, unless you know what
+you are doing.
+Description of Problem:
+Trying to load same assembly (potentially with different implementations
+of the same classes) into 2 different AppDomains.
+
+Steps to reproduce the problem:
+compile the following into a lib:
+using System;
+
+namespace BB
+{
+ public class Test { public Test() { Console.WriteLine("Test
+constructor"); } }
+ public class Test2 { public Test2() { Console.WriteLine("Test2
+constructor"); } }
+}
+
+compile the following into a exe:
+using System;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Runtime.Remoting;
+
+namespace BB {
+ internal class AppContainerDispatcher {
+ private byte[] loadFile(string filename) {
+ FileStream fs = File.OpenRead(filename);
+ byte[] buffer = new byte[fs.Length];
+ fs.Read(buffer, 0, buffer.Length);
+ fs.Close();
+ return buffer;
+ }
+
+ AppDomain _appdomain;
+ ObjectHandle _t1, _t2;
+
+ public AppContainerDispatcher(string lib) {
+ _appdomain = AppDomain.CreateDomain("mydomain" + lib);
+ _appdomain.Load(loadFile(lib));
+ _t1 = _appdomain.CreateInstance("libd", "BB.Test");
+ _t2 = _appdomain.CreateInstance("libd", "BB.Test2");
+ }
+ }
+};
+
+class App {
+ static void Main(string[] args) {
+ BB.AppContainerDispatcher disp =
+ new BB.AppContainerDispatcher("Debug/libd.dll");
+ BB.AppContainerDispatcher disp2 =
+ new BB.AppContainerDispatcher("Debug/lib2d.dll");
+ }
+}
+
+
+copy libd.dll (the output of the above lib being compiled) to lib2d.dll
+
+then put all 3 in the Debug directory and run ./Debug/program.exe
+
+it will try to create 2 appdomains, each loading diff dlls, but creating
+same classes from each.
+
+if you want, you can recompile the lib into lib2d.dll as well after
+changing the console.writeline()s to say something like 'constructor in
+lib2' so you verify that it is using different dlls
+
+Actual Results:
+Test constructor
+Test2 constructor
+
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+
+Server stack trace:
+in (unmanaged) (wrapper managed-to-native)
+System.AppDomain:LoadAssemblyRaw (byte[],byte
+[],System.Security.Policy.Evidence)
+in <0x00004> (wrapper managed-to-native) System.AppDomain:LoadAssemblyRaw
+(byte[],byte[],System.Security.Policy.Evidence)
+in <0x0007d> (wrapper remoting-invoke-with-check)
+System.AppDomain:LoadAssemblyRaw (byte[],byte
+[],System.Security.Policy.Evidence)
+in <0x00047> System.AppDomain:Load (byte[],byte
+[],System.Security.Policy.Evidence)
+in <0x0007d> (wrapper remoting-invoke-with-check) System.AppDomain:Load
+(byte[],byte[],System.Security.Policy.Evidence)
+in <0x00042> System.AppDomain:Load (byte[])
+in (unmanaged) (wrapper managed-to-native)
+System.Runtime.Remoting.RemotingServices:InternalExecute
+(System.Reflection.MonoMethod,object,object[],object[]&)
+in <0x00004> (wrapper managed-to-native)
+System.Runtime.Remoting.RemotingServices:InternalExecute
+(System.Reflection.MonoMethod,object,object[],object[]&)
+in <0x00171>
+System.Runtime.Remoting.RemotingServices:InternalExecuteMessage
+(System.MarshalByRefObject,System.Runtime.Remoting.Messaging.IMethodCallMes
+sage)
+
+
+Exception rethrown at [0]:
+
+in <0x00601> System.Runtime.Remoting.Proxies.RealProxy:PrivateInvoke
+(System.Runtime.Remoting.Proxies.RealProxy,System.Runtime.Remoting.Messagin
+g.IMessage,System.Exception&,object[]&)
+
+
+Expected Results:
+Test constructor
+Test2 constructor
+Test constructor
+Test2 constructor
+
+
+How often does this happen?
+every time. but never in msft's runtime