[Mono-bugs] [Bug 63758][Cri] New - Assembly.Load fails in remoting scenario

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 24 Aug 2004 03:04:52 -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 vivek.varma@honeywell.com.


--- shadow/63758	2004-08-24 03:04:52.000000000 -0400
+++ shadow/63758.tmp.8804	2004-08-24 03:04:52.000000000 -0400
@@ -0,0 +1,118 @@
+Bug#: 63758
+Product: Mono: Class Libraries
+Version: unspecified
+OS Details: Windows XP
+Status: NEW   
+Priority: Critical
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: vivek.varma@honeywell.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: Assembly.Load fails in remoting scenario
+Description of Problem:
+Lets assume there are two assemblies(dlls)
+ClassLib1.dll & ClassLib2.dll
+ClassLib2.dll has a reference to ClassLib1.dll
+Lets assume
+Remoting Client - Running on MS.Net
+Remoting Server - Running on mono
+Lets say the remoting server exposes a method called "RemoteLoad(byte[])" 
+The RemoteLoad method in turn does an Assembly.Load(byte[])
+Remoting client calls RemotingServer::RemoteLoad(bytestream of an Assembly
+ClassLibrary2.dll) via remoting
+RemotingServer::RemoteLoad calls Assembly.Load(bytestream of assembly 
+ClassLibrary2.dll) Mono's Assembly.Load method sees that 
+ClassLibrary2.dll references ClassLibrary1.dll and tries to load 
+ClassLibrary1.dll Alas! ClassLibrary1.dll cannot be found as it has not 
+been loaded into the appdomain yet!
+Steps to reproduce the problem:
+See description of problem above.
+Actual Results:
+In Client process
+Unhandled Exception: System.BadImageFormatException:
+Server stack trace:
+in (unmanaged) (wrapper managed-to-native) 
+System.AppDomain:LoadAssemblyRaw (byt
+in <0x00004> (wrapper managed-to-native) System.AppDomain:LoadAssemblyRaw 
+in <0x00042> System.AppDomain:Load (byte[],byte
+in <0x00036> System.AppDomain:Load (byte[])
+in <0x00055> (wrapper remoting-invoke-with-check) System.AppDomain:Load 
+in <0x00019> System.Reflection.Assembly:Load (byte[])
+in <0x00012> RemoteServer.RemoteObject:RemoteLoad (byte[])
+in (unmanaged) (wrapper managed-to-native) 
+ces:InternalExecute (System.Reflection.MonoMethod,object,object[],object[]
+in <0x00004> (wrapper managed-to-native) 
+s:InternalExecute (System.Reflection.MonoMethod,object,object[],object[]&)
+in <0x000fd> 
+System.Runtime.Remoting.RemotingServices:InternalExecuteMessage (Sy
+Exception rethrown at [0]:
+   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage
+(IMessage req
+Msg, IMessage retMsg)
+   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke
+(MessageData& msgDa
+ta, Int32 type)
+   at RemoteServer.IRemotingServer.RemoteLoad(Byte[] assembly)
+   at RemoteClient.Class1.Main(String[] args) in 
+.cs:line 19
+In Remote Server process
+** (C:\WorkArea\RemoteServer\bin\Debug\RemoteServer.exe:5788): WARNING 
+**: Could
+ not find assembly ClassLibrary1, references from data-09D96820 
+     Major/Minor: 1,0
+     Build:       1697,21845
+     Token:
+Expected Results:
+In Remoteserver process
+Remote Server
+Press <Ctrl+C> to finish
+Loaded : ClassLibrary2, Version=1.0.1697.21849, Culture=neutral, 
+How often does this happen? 
+Additional Information:
+With a Remoting Server running on MS.Net this problem does not exist, as 
+I presume that the MS.Net assembly loader lazy loads referenced 
+Mono Version Used: Mono 1.0