[Mono-bugs] [Bug 632316] Unexpected NullReferenceException when calling a generic method in a remoting scenario

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Aug 21 12:09:53 EDT 2010


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

https://bugzilla.novell.com/show_bug.cgi?id=632316#c1


Robert Jordan <robertj at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |robertj at gmx.net

--- Comment #1 from Robert Jordan <robertj at gmx.net> 2010-08-21 16:09:52 UTC ---
Here a smaller test case that shows that the appdomain is not switched when a
generic method is invoked outside its appdomain.

Expected output:
foo
foo

Actual output:
test.exe
foo


<<<<<
using System;

public class Engine : MarshalByRefObject
{
    public Engine ()
    {
    }

    public string GetDomainName<T> ()
    {
        return AppDomain.CurrentDomain.FriendlyName;
    }

    public string GetDomainName ()
    {
        return AppDomain.CurrentDomain.FriendlyName;
    }

    public static Engine CreateRemote (AppDomain domain)
    {
        return (Engine) domain.CreateInstanceAndUnwrap (
            typeof (Engine).Assembly.FullName,
            typeof (Engine).FullName);
    }
}

public class Program
{
    static void Main ()
    {
        var domain = AppDomain.CreateDomain ("foo");
        var engine = Engine.CreateRemote (domain);

        Console.WriteLine (engine.GetDomainName<object> ());
        Console.WriteLine (engine.GetDomainName ());
    }
}
<<<<<

-- 
Configure bugmail: https://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