Home All Groups Group Topic Archive Search About

Remoting serialization fails with custom object

Author
27 Sep 2006 11:44 AM
Greger
Hi,

I have a client application that is using remote objects from a IIS.

Everything works fine when using this from my code.

However. When a word add-in loads my code the request fails with a message
that it can not find the a assembly.

The assembly in question is one that is referenced in the servercode and on
the client, they both have the same version.


Summary; it works when I run it in my fixture, not when my code is called
from a application. And the assembly in question exists in THAT codes /bin
directory.

Can Anyone say anything I would be really gratefull.

Regards Greger

The method call fails with:

System.Runtime.Serialization.SerializationException occurred
  Message="Unable to find assembly 'Handelsbanken.ADIC.BusinessData,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'."
  Source="mscorlib"
  StackTrace:
    Server stack trace:
       at
System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()
       at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo, String name)
       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)
       at
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)
       at
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)
       at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
       at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler
handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain,
IMethodCallMessage methodCallMessage)
       at
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream
serializationStream, HeaderHandler handler, Boolean fCheck, Boolean
isCrossAppDomain, IMethodCallMessage methodCallMessage)
       at
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.UnsafeDeserializeMethodResponse(Stream
serializationStream, HeaderHandler handler, IMethodCallMessage
methodCallMessage)
       at
System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryResponseMessage(Stream inputStream, IMethodCallMessage reqMsg, Boolean bStrictBinding)
       at
System.Runtime.Remoting.Channels.BinaryClientFormatterSink.DeserializeMessage(IMethodCallMessage mcm, ITransportHeaders headers, Stream stream)
       at
System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)
    Exception rethrown at [0]:
       at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
       at
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData,
Int32 type)
       at
Handelsbanken.Research.ServiceInterfaces.IPublicationHandler.GetPublicationType(Int32 publicationTypeId)
       at
Handelsbanken.Research.Logic.Client.PublicationHandler.GetPublicationType(Int32
publicationTypeId) in
C:\Projects\Research\Logic.Client\PublicationHandler.cs:line 25





--
----

Author
27 Sep 2006 12:19 PM
Greger
Hi


I think I know what going on but not how to solve it.

The process is started from a different app domain and that
appdomain has no clue about the type im trying the get via remoting.

Is it possible to find a way to hook in a SerializationBinder or similar?

Any other solution to this problem?

Regards // Greger
--
----



Show quote
"Greger" wrote:

> Hi,
>
> I have a client application that is using remote objects from a IIS.
>
> Everything works fine when using this from my code.
>
> However. When a word add-in loads my code the request fails with a message
> that it can not find the a assembly.
>
> The assembly in question is one that is referenced in the servercode and on
> the client, they both have the same version.
>
>
> Summary; it works when I run it in my fixture, not when my code is called
> from a application. And the assembly in question exists in THAT codes /bin
> directory.
>
> Can Anyone say anything I would be really gratefull.
>
> Regards Greger
>
> The method call fails with:
>
> System.Runtime.Serialization.SerializationException occurred
>   Message="Unable to find assembly 'Handelsbanken.ADIC.BusinessData,
> Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'."
>   Source="mscorlib"
>   StackTrace:
>     Server stack trace:
>        at
> System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()
>        at
> System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo, String name)
>        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)
>        at
> System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)
>        at
> System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)
>        at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
>        at
> System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler
> handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain,
> IMethodCallMessage methodCallMessage)
>        at
> System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream
> serializationStream, HeaderHandler handler, Boolean fCheck, Boolean
> isCrossAppDomain, IMethodCallMessage methodCallMessage)
>        at
> System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.UnsafeDeserializeMethodResponse(Stream
> serializationStream, HeaderHandler handler, IMethodCallMessage
> methodCallMessage)
>        at
> System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryResponseMessage(Stream inputStream, IMethodCallMessage reqMsg, Boolean bStrictBinding)
>        at
> System.Runtime.Remoting.Channels.BinaryClientFormatterSink.DeserializeMessage(IMethodCallMessage mcm, ITransportHeaders headers, Stream stream)
>        at
> System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)
>     Exception rethrown at [0]:
>        at
> System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
> reqMsg, IMessage retMsg)
>        at
> System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData,
> Int32 type)
>        at
> Handelsbanken.Research.ServiceInterfaces.IPublicationHandler.GetPublicationType(Int32 publicationTypeId)
>        at
> Handelsbanken.Research.Logic.Client.PublicationHandler.GetPublicationType(Int32
> publicationTypeId) in
> C:\Projects\Research\Logic.Client\PublicationHandler.cs:line 25
>
>
>
>
>
> --
> ----
>
Author
17 Oct 2006 5:44 AM
Anthony Glenwright
Have you had any luck with this?  I have exactly the same problem with a
shell extension that is using remoting to call a server process.

*** Sent via Developersdex http://www.developersdex.com ***
Author
18 Oct 2006 7:55 AM
Greger
Hi,


Yes the solution is to add a config file to the executing process, in my
case winword.exe.config.
This config makes the executing process aware of the dll's it must be aware
of.
Like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="Handelsbanken.AUTO.BusinessData"/>
                <codeBase version="1.0.0.0" href="C:\Program Files\Clarity
Workflow\AUTO\bin\Handelsbanken.AUTO.BusinessData.dll"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="Handelsbanken.ADIC.BusinessData"/>
                <codeBase version="1.0.0.0" href="C:\Program Files\Clarity
Workflow\AUTO\bin\Handelsbanken.ADIC.BusinessData.dll"/>
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
</configuration>



Hope this helps!


--
----



Show quote
"Anthony Glenwright" wrote:

> Have you had any luck with this?  I have exactly the same problem with a
> shell extension that is using remoting to call a server process.
>
> *** Sent via Developersdex http://www.developersdex.com ***
>

AddThis Social Bookmark Button