Kittyfisto / SharpRemote

A .NET remoting library
MIT License
12 stars 5 forks source link

Preserve remote stacktrace #38

Closed Kittyfisto closed 6 years ago

Kittyfisto commented 6 years ago

When exceptions are serialized across processes/machines, then the remote stacktrace shall be preserved so that printing the Exception shows both the stacktrace of the remote exception as well as the stacktrace of where the exception was rethrown.

Look into BinaryFormatter(ISurrogateSelector selector, StreamingContext context) constructor https://msdn.microsoft.com/en-us/library/48tx0xse(v=vs.110).aspx as well as Exception ctor: https://referencesource.microsoft.com/#mscorlib/system/exception.cs,286e854ab94b2002.

It seems like StreamingContextStates.CrossAppDomain needs to be forwarded as StreamingContext.State to BinaryFormatter.

Kittyfisto commented 6 years ago

Available with https://www.nuget.org/packages/SharpRemote/0.5.40