[Mono-bugs] [Bug 574842] New: DomainUnload debug events have wrong id during Domain Unload.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Jan 28 13:42:37 EST 2010


http://bugzilla.novell.com/show_bug.cgi?id=574842

http://bugzilla.novell.com/show_bug.cgi?id=574842#c0


           Summary: DomainUnload debug events have wrong id during Domain
                    Unload.
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.6.x
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: debug
        AssignedTo: martin at novell.com
        ReportedBy: lucas.meijer at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.38 Safari/532.0

When the runtime unloads a domain, it sends out assembly unload events to the
softdebugger. The assembly->debuggerprotocol_id  hashtable that is used is
stored in the domain, and is already disposed of at this point.

When the runtime then tries to find the id for the assemblyunloadmessage, it
thinks "hey, there is no id for this guy yet. I'll just make a new one".

Here's a repro.

Add this to debugger-agent.c:

if (event == EVENT_KIND_ASSEMBLY_LOAD || event == EVENT_KIND_ASSEMBLY_UNLOAD)
{
    DEBUG (1, fprintf (log_file, "The debuggerprotocol's id for this assembly
was: %d\n", get_id (domain, ID_ASSEMBLY, arg)));
}

right after this line:
DEBUG (1, fprintf (log_file, "[%p] Sent event %s, suspend=%d.\n",
(gpointer)GetCurrentThreadId (), event_to_string (event), suspend_policy));



Then, try to softdebug this program in MonoDevelop:

using System;
using System.Reflection;

namespace SeperateAppDomainTest
{
    class Program
    {
        static void Main(string[] args)
        {
            LoadAssembly();
        }

        public static void LoadAssembly()
        {
            string pathToDll = Assembly.GetExecutingAssembly().CodeBase;
            AppDomainSetup domainSetup = new AppDomainSetup { PrivateBinPath =
pathToDll };
            var newDomain = AppDomain.CreateDomain("FooBar", null,
domainSetup);
            ProxyClass c =
(ProxyClass)(newDomain.CreateInstanceFromAndUnwrap(pathToDll,
typeof(ProxyClass).FullName));
            AppDomain.Unload(newDomain);
        }
    }

    public class ProxyClass : MarshalByRefObject { }
}


After the debug session, inspect the soft debugger logfile,   and look for the
id numbers from the load & unload events.
(showing only relevant lines below)

[00001134] Sent event ASSEMBLY_LOAD, suspend=2.
The debuggerprotocol's id for this assembly was: 1

[00001134] Sent event ASSEMBLY_LOAD, suspend=2.
The debuggerprotocol's id for this assembly was: 4

[00001134] Sent event ASSEMBLY_LOAD, suspend=2.
The debuggerprotocol's id for this assembly was: 5

[00002228] Sent event ASSEMBLY_UNLOAD, suspend=2.
The debuggerprotocol's id for this assembly was: 7
[00002228] Suspended.

Notice how the ID for the unload event does not match any of the id's of the
assemblies that were loaded before.




Reproducible: Always

Steps to Reproduce:
see the details
Actual Results:  


Expected Results:

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list