1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
interface IGenTest
{
void echo_test<T>(T value);
void echo_test(object value);
}
class gen_test : MarshalByRefObject, IGenTest
{
public virtual void echo_test<T>(T value)
{
Console.WriteLine(value);
}
public virtual void echo_test(object value)
{
echo_test<object>(value);
}
}
class test : MarshalByRefObject
{
public void Test(IGenTest g)
{
g.echo_test<string>("Sample"); //CRASH
}
}
static void Main(string[] args)
{
{
IGenTest g = new gen_test();
g.echo_test<string>("Sample"); //FONCTIONNE
AppDomainSetup s = new AppDomainSetup();
s.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory;
AppDomain c = AppDomain.CreateDomain("test", null, s);
test a = (test)c.CreateInstanceFromAndUnwrap(typeof(test).Assembly.Location, typeof(test).FullName);
a.Test(g); //CRASH
return;
}
} |
Partager