[Mono-dev] TypeLoadException when remoting from Windows

Jacob Ilsø Christensen jacobilsoe at gmail.com
Thu Feb 8 10:59:30 EST 2007


Ok, I finally managed to reproduce the issue. Attached are some test
files. The file named compile shows how to compile the stuff.

So, first launch TestImpl.exe and then Test.exe. What I experienced is
the following:

MS .NET -> MS.NET works
MS .NET -> Mono does not work (throws the exception I wrote about earlier)
Mono -> MS.NET works
Mono -> Mono works

If I comment out the event handler line in Test.cs all four cases
work. Can someone confirm this issue?


On 2/8/07, Robert Jordan <robertj at gmx.net> wrote:
> Jacob Ilsø Christensen wrote:
> > On 2/8/07, Robert Jordan <robertj at gmx.net> wrote:
> >> Jacob Ilsø Christensen wrote:
> >>> On 2/7/07, "Andrés G. Aragoneses [ knocte ]" <knocte at gmail.com> wrote:
> >>>> Jacob Ilsø Christensen escribió:
> >>>>> Hi.
> >>>>>
> >>>>> I am trying to do a remote call from Windows to an application running
> >>>>> on Linux under Mono When I try it, I get the exception below.
> >>>>> There is not much info as to what might be wrong. Is it a missing
> >>>>> assembly?
> >>>> Does it work with MS.NET vs MS.NET? If yes, then it's a bug in Mono. If
> >>>> not, it probably gives you a better error message and that could be a
> >>>> bug in Mono too because of the lack of info and you should report it.
> >>> Yep, it works perfectly from MS.NET to MS.NET. I filed a bug report
> >>> that mono should report a more meaningful error message
> >>> (http://bugzilla.ximian.com/show_bug.cgi?id=80761).
> >> Please attach a test case to this bug entry.
> >
> > I would like to, but it would be much less time consuming for me if
> > the TypeLoadException provided a better error message. That way I
> > could easier pinpoint the issue and write a test case.
> Hint: it's a MS corlib type that doesn't exist in Mono, maybe
> one of these: System.RuntimeType (the underlying type of
> System.Type => this basically means that you can't remote
> System.Type between the runtimes) or another System.Runtime* type,
> mostly used for Method/Property/Event/FieldInfo.
> Robert
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
-------------- next part --------------
gmcs ITest.cs /t:library
gmcs Test.cs /r:ITest.dll
gmcs TestImpl.cs /r:ITest.dll /r:System.Runtime.Remoting
-------------- next part --------------
public delegate void TestDelegate(object sender, System.EventArgs eventArgs);

public interface ITest
	void Test();
	event TestDelegate TestEvent;	
-------------- next part --------------
using System;
using System.IO;

public class Test
	public static void Main()
		string service = "tcp://";
		ITest test = (ITest)Activator.GetObject(typeof(ITest), service + "Test");		
		test.TestEvent += new TestDelegate(TestHandler); // This causes problems

	public static void TestHandler(object sender, EventArgs eventArgs)
-------------- next part --------------
using System;
using System.Collections;
using System.IO;
using System.Threading;
using System.Runtime.Remoting;
using System.Runtime.Serialization.Formatters;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;

public class MyTest : MarshalByRefObject, ITest
	public void Test()

	public event TestDelegate TestEvent;

public class TestImpl
	public static void Main()
		BinaryServerFormatterSinkProvider provider = new BinaryServerFormatterSinkProvider();
		provider.TypeFilterLevel = TypeFilterLevel.Full;

		IDictionary props = new Hashtable();
		props["port"] = 5000;
		props["name"] = "originalTcpChannel";

		TcpChannel channel = new TcpChannel(props, null, provider);
		ChannelServices.RegisterChannel(channel, false);

		RemotingServices.Marshal(new MyTest(), "Test");


More information about the Mono-devel-list mailing list