theRainbird / CoreRemoting

RPC library with classic .NET Remoting flavour
MIT License
63 stars 23 forks source link

Improve ability for troubleshooting server's issues #25

Open svg2003 opened 2 years ago

svg2003 commented 2 years ago

Is your feature request related to a problem? Please describe. If something happens inside CoreRemoting core code, it's very hard to understand why. For example, when I accidentally started net6 app with castle dlls, based on net472 (typical case on big project during transition from net4 to net core and way how nuget resolves dependencies), client was not able to connect and I had to compile CoreRemoting code to add debug information there.

Would be nice to get exception in callback for similar cases (in my case in was inside RpcWebsocketSharpBehavior.OnMessage()) like below. I also recall I had similar issues when MethodCallMessage deserializer throwed an exception.

[Info] 'test' OnMessage: 0 [Info] 'test' GetService: System.TypeLoadException: Could not load type 'System.Runtime.Remoting.RemotingServices' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. at Castle.DynamicProxy.ProxyUtil.GetUnproxiedInstance(Object instance) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.SetUpProperties(Object instance, CreationContext context) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden) at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally) at Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy) at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden) at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired) at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context) at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, Arguments additionalArguments, IReleasePolicy policy, Boolean ignoreParentContext) at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, Arguments additionalArguments, IReleasePolicy policy) at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(String key, Type service, Arguments arguments, IReleasePolicy policy) at Castle.MicroKernel.DefaultKernel.Resolve(String key, Type service, Arguments arguments) at Castle.Windsor.WindsorContainer.Resolve[T](String key) at CoreRemoting.DependencyInjection.CastleWindsorDependencyInjectionContainer.GetService[TServiceInterface](String serviceName) in D:\temp\CoreRemoting-master\CoreRemoting\DependencyInjection\CastleWindsorDependencyInjectionContainer.cs:line 65. Type: CoreRemoting.RemoteDelegates.IDelegateProxyFactory. ServiceName: CoreRemoting.RemoteDelegates.IDelegateProxyFactory

theRainbird commented 1 year ago

RemotingServer has an Error event, which is fired if message processing failed. But currently it is not fired when an exception is thrown during session creation.

I'll check that.