random .NET and web development musings

When implementing custom exceptions in .NET, especially if you’re writing a library that others are going to use, always implement the deserialization constructor:

MyException (SerializationInfo info, StreamingContext context) : base(info, context)

Not doing so will cause others to hate you when your exceptions cause further SerializationExceptions.

just do it.

Andrew Barber
April 15, 2012

Oh yes, isn’t this the truth! Do devs forget their Exceptions are going to need to cross AppDomain boundaries?

April 15, 2012

I think its probably ignorance, many don’t understand what its for so don’t implement it.

Post a comment