Groups | Blog | Home
all groups > dotnet clr > may 2005 >

dotnet clr : AssemblyResolve callback never called in .NET 2.0


Matt Zinkevicius
5/26/2005 4:12:05 PM
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?

Francisco Padron
5/28/2005 2:29:34 PM
I'm using AppDomain.AssemblyResolve in my app and it works fine for me, it
gets called whenever an assembly is not found.

So if there is a bug, there must be something more specific to what you are
trying to do.

--
Francisco Padron
www.chartfx.com


"Matt Zinkevicius" <MattZinkevicius@discussions.microsoft.com> wrote in
message news:B59EAC47-075D-4258-893E-E15FDDD7DDB8@microsoft.com...
[quoted text, click to view]

Daniel PS
6/29/2005 5:45:04 AM
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.


[quoted text, click to view]
Richard Blewett [DevelopMentor]
6/29/2005 1:40:54 PM
Just because its been deprecated doesn't mean its not going to be there - it just means *at some point in the future is going to be pulled* In v2 you can do the same thing with an AppDomainManager which can also be used with the default domain Regards Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
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
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.

AddThis Social Bookmark Button