diff --git a/CoreRemoting.Tests/RpcTests.cs b/CoreRemoting.Tests/RpcTests.cs index 84078b0..d20c412 100644 --- a/CoreRemoting.Tests/RpcTests.cs +++ b/CoreRemoting.Tests/RpcTests.cs @@ -539,6 +539,7 @@ public void Failing_component_constructor_throws_RemoteInvocationException() ConnectionTimeout = 3, InvocationTimeout = 3, SendTimeout = 3, + Channel = ClientChannel, MessageEncryption = false, ServerPort = _serverFixture.Server.Config.NetworkPort, }); @@ -549,7 +550,7 @@ public void Failing_component_constructor_throws_RemoteInvocationException() var ex = Assert.Throws(() => proxy.Hello()); Assert.NotNull(ex); - Assert.Contains(ex.Message, "IFailingService"); + Assert.Contains("FailingService", ex.Message); } [Fact] diff --git a/CoreRemoting/RemotingSession.cs b/CoreRemoting/RemotingSession.cs index b3284e3..bd0d0ea 100644 --- a/CoreRemoting/RemotingSession.cs +++ b/CoreRemoting/RemotingSession.cs @@ -455,7 +455,7 @@ private void ProcessRpcMessage(WireMessage request) serverRpcContext.Exception = new RemoteInvocationException( message: ex.Message, - innerEx: ex.GetType().IsSerializable ? ex : null); + innerEx: ex.ToSerializable()); if (oneWay) return; diff --git a/CoreRemoting/Serialization/ExceptionExtensions.cs b/CoreRemoting/Serialization/ExceptionExtensions.cs index 8650318..c29cfbf 100644 --- a/CoreRemoting/Serialization/ExceptionExtensions.cs +++ b/CoreRemoting/Serialization/ExceptionExtensions.cs @@ -1,4 +1,5 @@ -using System; +using Castle.MicroKernel.ComponentActivator; +using System; using System.Linq; namespace CoreRemoting.Serialization; @@ -20,6 +21,9 @@ public static class ExceptionExtensions agg.InnerException.IsSerializable() && agg.GetType().IsSerializable, + // pesky exception that looks like serializable but really isn't + ComponentActivatorException cax => false, + _ => ex.GetType().IsSerializable && ex.InnerException.IsSerializable() };