Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2005

Tip: Looking for answers? Try searching our database.

SerializationException with wrong dll version / PublicKeyToken

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joan - 14 Jul 2005 12:17 GMT
Hi,

I've made some .NET software in C#, existing of 2 appls and 2 dlls
(let's call them: My.Crls.dll & My.Wrap.dll).
I signed all (strong name) with keys and all seemed to work fine.
All 2 apps and 2 dlls are always installed in the same directory.

After doing some bug fixing and building a new set of apps and dlls,
everything seemed to work fine, until I call the print functionality,
which uses printing & serialisation functionality in one of the dlls.
Then, I get a "SerializationException" in "mscorlib": "Cannot find the
assembly My.Ctrls, Version=1.0.2007.27546, Culture=neutral,
PublicKeyToken=4bb0de2aa339ad49".
Calling any other functionality in My.Ctrls.dll works fine.

However, both apps and both dlls are of Version 1.0.2021.????? by now,
not the version mentioned above.
I have removed all of them from the GAC (gacutil /uf). GAC says OK. On
printing I get the same error.
I have forcibly added all of them to the GAC (gacutil /if). Same
results.
I have tried to remove all signatures and strong names from both apps
and both dlls, but I still got the same error.
Where does "mscorlib" get this 1.0.2007 from, why doesn't it attach to
the new version number?

Has anyone any ideas? Thanks!

Joan
Joan - 14 Jul 2005 12:46 GMT
Another thing I've tried was giving the My.Ctlrs.dll the name
My.Controls.dll and build a new app referencing that new dll.
Upon printing in the new app, again I get the error referring to
My.Ctrls.dll 1.0.2007, instead of My.Controls.dll that it should be
using.
Why is mscorlib so convinced that it should be using that old, obsolete
dll?

????
Joan
Phil Wilson - 14 Jul 2005 20:26 GMT
I can't tell your exact scenario here, but this is what it looks like to me:

1. If you've serialized some object (defined by a class your DLL) to (say) a
file disk, and you are trying to deserialize it back into an object, the
file contains the exact version of the assembly that defines the layout of
the object (metadata stuff), and it will want that exact assembly in case
you have re-arranged the structure of the object.

2. It looks like you've got an assemblyversion spec of 1.0.* (or 1.0.2007.*
!!) so every time you do a build, your assembly gets a new version and the
resulting assembly is incompatible with files containing serialized objects
from previous versions of the assembly.
Signature

Phil Wilson [MVP Windows Installer]
----

> Hi,
>
[quoted text clipped - 25 lines]
>
> Joan

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.