SerializationException with wrong dll version / PublicKeyToken

J

Joan

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
 
J

Joan

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
 
P

Phil Wilson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top