trquth / autofac

Automatically exported from code.google.com/p/autofac
Other
0 stars 0 forks source link

Make Autofac exceptions serializable #456

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Make all Autofac exceptions (e.x. DependencyResolutionException) serializable 
so that it is possible to serialize them across app domains.

Original issue reported on code.google.com by david.r...@fusonic.net on 10 Sep 2013 at 11:10

GoogleCodeExporter commented 8 years ago
Autofac is now a portable class library to support multiple platforms 
simultaneously. Unfortunately, PCL doesn't support [Serializaable] or 
exception/binary serialization like that.

This is a pretty common question about PCL and custom exceptions. Here's an 
example question from StackOverflow.
http://stackoverflow.com/questions/13604713/implementing-custom-exceptions-in-a-
portable-class-library

What it boils down to is that there's not really anything we can do about it. 
There's no current plan to revert back and create platform-specific targeted 
versions of Autofac (we went PCL to avoid that), which is the only solution to 
the issue.

What you can do on your end if you need to receive exceptions across AppDomains 
is to add exception handling in the AppDomain that will catch the Autofac 
exception(s) and marshal them across the boundary as a different exception type 
of your choosing.

Original comment by travis.illig on 10 Sep 2013 at 11:37

GoogleCodeExporter commented 8 years ago
Here's the "official" response on this from the PCL team:
http://pclcontrib.codeplex.com/discussions/387791

Original comment by travis.illig on 10 Sep 2013 at 11:39

GoogleCodeExporter commented 8 years ago
Well to be specific, what I really want is to serialize the exception to 
filesystem via the BinaryFormatter class.

But since there is no PCL support we will have to handle these exceptions 
separately.

Original comment by david.r...@fusonic.net on 11 Sep 2013 at 5:34