Non-serializeable Exceptions

Non-serializeable Exceptions

Old forum URL: forums.lhotka.net/forums/t/5286.aspx


nelis posted on Friday, August 22, 2008

When using remoting I got the following error:

System.Data.Linq.ChangeConflictException' in Assembly 'System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable

when I tried to update an object of which the PK was changed (thus not found, thus exception)

When using WcfHost the exception was not clear about the real cause (non serializeable Exception) but I believe there is already another thread covering that issue.

What I didn't find is how to properly handle non-serializeable Exception?

ajj3085 replied on Monday, August 25, 2008

Well, I would say your best bet right now is to use your BusinessBase subclass (and the six other subclasses of core Csla objects) and override OnDataPortalException.  You can then throw an Exception and try to keep the message and other details, but you'll lose the stack trace unfortunately. 

Copyright (c) Marimer LLC