Hi,
I have a problem with my Remoting app. I (naturally) want to use exceptions for Error handling, however they don't get remoted properly. If I throw an exception in the constructor of a MBR Object, everything works fine. If I throw an exception in a method of the same object, it isn't sent to the server.
I've hacked the following testing code that shows my problem:
Remoting Object:
public class Remoter : MarshalByRefObject
{
public Remoter()
{
//throw new Exception("This would arrive at the client");
}
public void DangerousMethod()
{
throw new Exception("And this does not");
}
}
Server:
class Program
{
static void Main(string[] args)
{
HttpChannel channel = new HttpChannel(32000);
ChannelServices.RegisterChannel(channel, false);
RemotingConfiguration.RegisterActivatedServiceType(typeof(RemotingTestLib.Remoter));
Console.ReadLine();
}
}
Client:
class Program
{
static void Main(string[] args)
{
HttpChannel channel = new HttpChannel();
ChannelServices.RegisterChannel(channel, false);
RemotingConfiguration.RegisterActivatedClientType(typeof(RemotingTestLib.Remoter), "http://localhost:32000");
RemotingTestLib.Remoter test = new RemotingTestLib.Remoter();
test.DangerousMethod();
System.Console.ReadLine();
}
}
Surely this is a simple issue, but I have only found articles dealing with custom exceptions on the net. So, what am I doing wrong?