Question

I have a project and I want to strong name the executable file. Using command-line compiling works well:

csc ... /keyfile:...

But I would like the IDE to do this, so I find this: in project property's `Signing' tab, there is a 'Sign the assembly' option. I tick it and direct to my key-pair file. After I lauch the debug, a FileNotFound exception shows up at an indifferent place: (my application uses serialization)

        protected override Type d(Stream st)
        {
            BinaryFormatter bf = new BinaryFormatter();
            return (Type)bf.Deserialize(st);
        }

The application was doing right before I do this configureation.

Was it helpful?

Solution

I assume you are reading back data that was written with the unsigned application. That data has now become incompatible, the Deserializer can't match the types.

I'm not sure how to fix this (quickly), but maybe you can confirm this first by writing and reading with the signed application, that should work.

It is a good idea to keep all your serialized types in a separate assembly.

OTHER TIPS

You will need to appropriately configure the Binder property of the BinaryFormatter. Here is an example of how to do this: http://spazzarama.wordpress.com/2009/06/25/binary-deserialize-unable-to-find-assembly/

Both of the responses were excellent.
Adding my 1 pence to it: This is called TYPE FIDELITY which is possible only through Binary serialization and not in XML or any other type of serialization.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top