Hi,
I have a client server app which uses .NET Remoting to communicate. This is separated by an interface and the client doesn't reference the server's implementation. Now, a custom exception in a shared dll, when thrown from the server isn't caught by the client and throws a TargetInvocationException saying "Could not load the file or assembly [Server Assembly]". The problem is solved if I copy the server assembly to the client. It is slightly odd that this happens given that the server assembly doesn't even hold the exception type and I don't want to copy over the server implementation assembly to the client.
In a nutshell:
ClientAssembly -> CommonAssembly, InterfaceAssembly
ServerAssembly -> CommonAssembly, InterfaceAssembly
(in Common Assembly)
class MyException : Exception, ISerializable (this is implemented properly)
{ }
(in Server Assembly)
class MyServer
{
public void MyFunc()
{
throw new MyException("custom message");
}
}
(in Client Assembly)
class MyClient
{
public void MyFunc()
{
try { serverObject.MyFunc() } catch(MyException e) { // doesn't get caught. }
}
}
It would be really helpful if there is a workaround for this. Also, if someone could shed light on why the assembly is required even when the type has been shared. Oddly, this issue doesn't occur if I use the System.Exception