[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.

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

--- 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: 
+OS Details: Windows XP
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Critical
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: vivek.varma@honeywell.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+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
+e[],byte[],System.Security.Policy.Evidence)
+in <0x00004> (wrapper managed-to-native) System.AppDomain:LoadAssemblyRaw 
+(byte[
+],byte[],System.Security.Policy.Evidence)
+in <0x00042> System.AppDomain:Load (byte[],byte
+[],System.Security.Policy.Evidenc
+e)
+in <0x00036> System.AppDomain:Load (byte[])
+in <0x00055> (wrapper remoting-invoke-with-check) System.AppDomain:Load 
+(byte[])
+
+in <0x00019> System.Reflection.Assembly:Load (byte[])
+in <0x00012> RemoteServer.RemoteObject:RemoteLoad (byte[])
+in (unmanaged) (wrapper managed-to-native) 
+System.Runtime.Remoting.RemotingServi
+ces:InternalExecute (System.Reflection.MonoMethod,object,object[],object[]
+&)
+in <0x00004> (wrapper managed-to-native) 
+System.Runtime.Remoting.RemotingService
+s:InternalExecute (System.Reflection.MonoMethod,object,object[],object[]&)
+in <0x000fd> 
+System.Runtime.Remoting.RemotingServices:InternalExecuteMessage (Sy
+stem.MarshalByRefObject,System.Runtime.Remoting.Messaging.IMethodCallMessa
+ge)
+
+
+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 
+c:\workarea\remoteclient\class1
+.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 
+(assemblyref_ind
+ex=1)
+     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, 
+PublicKeyToken=
+null
+
+How often does this happen? 
+Always
+
+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 
+assemblies.
+***************************
+Mono Version Used: Mono 1.0
+****************************