Deserialize error when called from C++ .net

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Travis

    Deserialize error when called from C++ .net

    I have a component with interface in C# that does some serializing and
    deserializing of a class. When I call this interface from a c# application
    everything works. When I call the interface from unmanaged C++ .net code it
    gives me an error that the Assembly cannot be found. I can call Serialize
    from either application and it works. This only happens on Deserialize.
    Anybody had an error like this?
  • Mattias Sjögren

    #2
    Re: Deserialize error when called from C++ .net

    >When I call the interface from unmanaged C++ .net code it[color=blue]
    >gives me an error that the Assembly cannot be found.[/color]

    Fuslogvw.exe is a good tool for dealing with load errors.



    Mattias

    --
    Mattias Sjögren [MVP] mattias @ mvps.org
    http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
    Please reply only to the newsgroup.

    Comment

    • Travis

      #3
      Re: Deserialize error when called from C++ .net

      We found the problem. The component that was serialized had to be based on
      SerializationBi nder and override the BindToType. Before Deserialize you ust
      do this:

      BinaryFormatter b = new BinaryFormatter ();
      b.Binder = (System.Runtime .Serialization. SerializationBi nder) new
      DataToDeseriali ze();

      SerializedClass = (DataToDeserial ize)b.Deseriali ze(s);

      For some reason Serialize does not save the path to the component correctly
      so in deserialize you have to give it the path through binder.
      "Mattias Sjögren" wrote:
      [color=blue][color=green]
      > >When I call the interface from unmanaged C++ .net code it
      > >gives me an error that the Assembly cannot be found.[/color]
      >
      > Fuslogvw.exe is a good tool for dealing with load errors.
      >
      >
      >
      > Mattias
      >
      > --
      > Mattias Sjögren [MVP] mattias @ mvps.org
      > http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
      > Please reply only to the newsgroup.
      >[/color]

      Comment

      Working...