S h o r t S t o r i e s

// Tales from software development

.NET Remoting: exceptions are not marshalled because of the value of CustomErrors.

leave a comment »

Over the past couple of years I’ve had to write one or two .NET Remoting applications each year. It seems that gives me just long enough between each project to forget some of the basics and have to track down and fix the unexpected behaviour I identify in testing. Having just completed another .NET Remoting project I can’t believe that yet again I forgot to set CustomErrors off but I did.

Part of the problem is that this issue never shows up when your running the remoting server locally or when tests run successfully and exceptions are not throw. It’s only apparent when an exception is thrown on a remote server and the default value for CustomErrors, RemoteOnly, causes the error to be filtered resulting in the exception not being marshalled to the client.

The code that creates the remoting server by calling the RegisterWellKnownServiceType() method needs to set the CustomErrorsMode property:

RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;

 Hopefully, I’ll remember this in the next .NET Remoting project.


Written by Sea Monkey

February 3, 2011 at 8:00 pm

Posted in Debugging, Development

Tagged with ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: