https://bugzilla.novell.com/show_bug.cgi?id=655669

https://bugzilla.novell.com/show_bug.cgi?id=655669#c0


           Summary: Weak GCHandle does not work and crashes in
                    multi-AppDomain scenario
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.8.x
          Platform: x86
        OS/Version: RHEL 5
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: GC
        AssignedTo: [email protected]
        ReportedBy: [email protected]
         QAContact: [email protected]
          Found By: ---
           Blocker: ---


Created an attachment (id=401926)
 --> (http://bugzilla.novell.com/attachment.cgi?id=401926)
Sample project to repro the bug

User-Agent:       Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1;
Trident/4.0; InfoPath.2; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR
3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)

If I create an object in a *secondary* appdomain, allocate a *weak* GCHandle
pointing to it and store its IntPtr value somewhere, then later on when I try
to to use GCHandle.FromIntPtr to get a GCHandle instance from the stored IntPtr
value, CLR runtime will give me an exception.

This does not happen to Microsoft CLR and does not happen to *normal* and
*pinned* GCHandle on MONO.

Reproducible: Always

Steps to Reproduce:
1. Unzip attached project and use xbuild to build the solution.
2. In the generated bin folder, run "mono DefaultAppDomainApp.exe"
Actual Results:  
An exception is thrown out saying:
Unhandled Exception: System.ArgumentException: GCHandle value belongs to a
different domain

Server stack trace:
at System.Runtime.InteropServices.GCHandle.op_Explicit (IntPtr value) [0x00000]
in <filename unknown>:0 
at System.Runtime.InteropServices.GCHandle.FromIntPtr (IntPtr value) [0x00000]
in <filename unknown>:0
at SecondaryAppDomainApp.Program.Main (System.String[] args) [0x00000] in
<filename unknown>:0

Expected Results:  
No exception.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to