[Mono-bugs] [Bug 75377][Min] Changed - Cross-AppDomain delegate marshaling bug

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Jun 25 18:53:22 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 kornelpal at hotmail.com.

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

--- shadow/75377	2005-06-25 18:22:20.000000000 -0400
+++ shadow/75377.tmp.17980	2005-06-25 18:53:22.000000000 -0400
@@ -54,6 +54,54 @@
 It this is not "fixed" in .net 2.0, we can probably just close it. It
 is not a security risk (having unmanged privilages trumps all), and
 programs doing this wouldn't be portable.
 
 The real place to file a "petition for change of framework" is msft's
 bug reporting area.
+
+------- Additional Comments From kornelpal at hotmail.com  2005-06-25 18:53 -------
+I don't agree with the lot of stuff thing. You are *only* 
+responsible to keep the delegate object alive. There are no other 
+odd responsibilities. I sucked a lot because of this when writing 
+ComIStreamMarshaler.:) The delegate objects are really marshaled 
+(not the methods they point to) so they has to be kept alive. As the 
+trampolines are dynamic code as well that has to be freed by 
+DestroyStructure for example it could be good to maintain a 
+reference to the delegate object by the marshaling runtime but this 
+is not done by MS runtime so it's better to provide compatibility.
+
+BUT:
+What I reported is a bug altough MS runtime is buggy as well. Please 
+try the test code. You will see that the instance methods are 
+executed in a different AppDomain than the object belongs to. It's 
+very strange and should never happen.
+
+This means that the object has all the instance and *static* fileds 
+from the AppDomain it was created in but the code is executed in 
+another AppDomain. For example (what I have used in the code to 
+detect buggy behaviour) GCHandles cannot be created from IntPtrs.
+
+MarshalByRef objects has to be executed in the AppDomain they belong 
+to using proxies without serialization or any other thing. But as 
+the test code shows this behaviour is the same regardless of 
+MarshalByRef and [Serializable]. This is even more strange.
+
+The expected behaviour should be to do MarshalByRef marshaling 
+anyway to provide identical behaviour for delegate->function pointer-
+>delegate marshaling and unmanaged function pointer->delegete 
+marshaling. This is not managed remoting this is marshaling.
+
+This is not changing the framework this is just making it work as 
+expected.
+
+As delegates are object they have an AppDomain associated to so it 
+is easy to obtain the right AppDomain.
+
+And I think it's nowhere written that any (non-runtime) object can 
+be used (without proxying) in a different AppDomain it was created 
+in.
+
+And please try the test code before you say we don't want to fix 
+this bug because MS did not fix it and we are copycats.
+
+I have reported this bug to MS as well but regardless of them this 
+is a bug.


More information about the mono-bugs mailing list