all groups > dotnet remoting > september 2006 >
You're in the

dotnet remoting

group:

Custom Exception via Remoting


Custom Exception via Remoting GP
9/22/2006 2:20:02 PM
dotnet remoting: I've created a custom exception class that is marked Serializable and
implements the ISerializable interface. I am throwing this custom exception
across my remoting boundary. It works just fine when the remoting client is
a Windows forms or console application, but if I use a .NET COM-exposed DLL
as my remoting client, I get a serialization exception:

System.Runtime.Serialization.SerializationException: Cannot find the
assembly ExceptionTest, Version=1.0.2456.29148, Culture=neutral,
PublicKeyToken=0ed9985891f0d0ea.\r\n\nServer stack trace: \n at
System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()\r\n
at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo
assemblyInfo, String name)\r\n at
System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(String
objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[]
typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32
objectId, BinaryAssemblyInfo assemblyInfo, SizedArray
assemIdToAssemblyTable)\r\n at
System.Runtime.Serialization.Formatters.Binary.ObjectMap.Create(String name,
String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[]
typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32
objectId, BinaryAssemblyInfo assemblyInfo, SizedArray
assemIdToAssemblyTable)\r\n at
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped
record)\r\n at
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum
binaryHeaderEnum)\r\n at
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()\r\n at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler
handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMessage
methodCallMessage)\r\n at
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream
serializationStream, HeaderHandler handler, Boolean fCheck,
IMethodCallMessage methodCallMessage)\r\n at
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.UnsafeDeserializeMethodResponse(Stream
serializationStream, HeaderHandler handler, IMethodCallMessage
methodCallMessage)\r\n at
System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryResponseMessage(Stream
inputStream, IMethodCallMessage reqMsg, Boolean bStrictBinding)\r\n at
System.Runtime.Remoting.Channels.BinaryClientFormatterSink.DeserializeMessage(IMethodCallMessage
mcm, ITransportHeaders headers, Stream stream)\r\n at
System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage
msg)\n\nException rethrown at [0]: \n at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)\r\n at
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData,
Int32 type)\r\n at MyTest.Remoting.SampleObject.HelloWorld() in
c:\\documents and settings\\gpetros\\my documents\\visual studio
projects\\sampleobject\\sampleobject.cs:line 27\r\n at
MyTest.Remoting.SampleClient2.Test() in c:\\documents and
settings\\gpetros\\my documents\\visual studio
projects\\sampleclient2\\sampleclient2.cs:line 59

I've tried quite a few different solutions (after reading dozens of posts
and articles) with no success. I've tried different providers and
formatters, I've made sure my TypeFilterLevel is set to Full. The only thing
I can think of is that somehow COM Interop is messing things up. Any help is
greatly appreciated. If necessary, I can post my sample code that produces
this problem, just let me know. Thanks.

Greg Petros
Software Developer
RE: Custom Exception via Remoting GP
9/25/2006 12:45:01 PM
Solved my problem on this one...

I was using a VBScript (.vbs file) to test the COM interface, which meant
that the wscript.exe process was running in the Windows\System32 folder. The
assembly containing my custom exception was not installed in the GAC, nor was
it accessible in the path (or Windows\System32), thus the error. This also
explains why it worked fine when I used a console or Windows app, since the
assembly containing the custom exception was right there in the working path.
My advice: Be aware of the working path that the actual executable that is
running.

[quoted text, click to view]
AddThis Social Bookmark Button