RE: AssemblyResolve callback never called in .NET 2.0

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi Matt,
I have exactly the same problem, but it has nothing to do with versioning.
When you serialize an object, the runtime writes the assemby information to
the stream. If these assemblies were loaded from other directories than the
main directory you have a problem with deserialization. I solved the problem
in 1.1 with appending all folders of my plugin assemblies
(AppDomain.CurrentDomain.AppendPrivateBinPath).
This will help you for now. The very bad thing about this solution is, that
it will not work with the .Net 2.0 final, because the Method is marked as
deprecated.
Instead of using this method you are supposed to use
AppDomain.CurrentDomain.SetupInformation.PriateBinPath.
The only drawback about that is you can't use this way for the
DefaultAppDomain.


"Matt Zinkevicius" wrote:

> Hi,
> We have a product written in C# that we are migrating to Visual Studio 2005
> (beta 2) and .NET 2.0. Everything builds fine, but during runtime we are
> hitting a new exception. When it is deserializing a some classes from disk
> that were serialized with the .NET 1.1 version, we are now getting a
> SerializationException() saying that it can't find our assembly. Our
> assemblies are strongly-named, and we bump the assembly version in each
> build, so we already dealt with this problem earlier by writing a
> AppDomain.AssemblyResolve event handler which returns the correct assemblies.
> The problem is that with .NET 2.0 our handler is no longer being invoked! Is
> this a known issue with a known workaround? Is there another way to avoiding
> this versioning problem with serialization in .NET 2.0?
>
> --Matt Zinkevicius
.



Relevant Pages

  • Re: Strong Name vs Serializable vs Remoting
    ... anyway it seems the serializer will attempt to serialize different versions. ... I'll post the text of the exception - I need to reconfigure in order to get ... When adding remoting to the ... >> strongly named a few assemblies. ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: Problem with serializing business object instead of core objec
    ... > do this since the server does not need to know the type of object I am ... than you have to serialize the objects ... on the client and send them as binary data to the server. ... >>client and server assemblies. ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: XmlSerializer and a Collection Property
    ... object nor the XmlSerializer. ... I am loading a number Assemblies at startup by the followiing method: ... This works fine all the way up to the point where I serialize one of the ... Inner Inner Exception: "Object reference not set to an instance of an ...
    (microsoft.public.dotnet.framework)
  • Re: binding to an unsigned assembly outside the appbase
    ... them to do the redirection, because they are located outside my app's ... enough for automatic deserialization. ... Let's say those assemblies contains definitions of serializable classes ... I can also serialize the objects. ...
    (microsoft.public.dotnet.framework)
  • RE: AssemblyResolve callback never called in .NET 2.0
    ... http://www.dotnetconsult.co.uk Hi Matt, ... I have exactly the same problem, but it has nothing to do with versioning. ... When you serialize an object, the runtime writes the assemby information to ... If these assemblies were loaded from other directories than the ...
    (microsoft.public.dotnet.framework.clr)