none
Object of type 'Avanade.ACA.Security.Cryptography.MasterKey.MasterKeyInstance' cannot be converted to type 'System.Type'. RRS feed

  • Question

  • Hi,

    We have an application developed <g class="gr_ gr_41 gr-alert gr_gramm undefined Punctuation multiReplace" data-gr-id="41" id="41">in .</g>NET 1.1, deserialization of object is working in 1.1 but when we migrated the 1.1 code into 4.5 it starts giving me the following error:

    <g class="gr_ gr_236 gr-alert gr_gramm undefined Grammar multiReplace" data-gr-id="236" id="236">Object</g> of type 'Avanade.ACA.Security.Cryptography.MasterKey.MasterKeyInstance' cannot be converted to type 'System.Type'.

    Code line:

    BinaryFormatter formatter = new BinaryFormatter();
    formatter.Binder = new MasterKeyInstanceBinder();

    MasterKeyInstance masterKeyInstance = (MasterKeyInstance) formatter.Deserialize(decryptedStream);

    Below class gets invoked at the above line

    internal class MasterKeyInstanceBinder: SerializationBinder
    {
    public override Type BindToType(string assemblyName, string typeName)
    {
    return typeof(MasterKeyInstance);
    }
    }

    Please tell me what is the reason behind this?

    Thanks for your help.


    Tuesday, February 9, 2016 10:51 AM

All replies