ehsan_ro

Unable to find assembly 'ssdsdsd, Version=1.0.0.0, Culture=neutral, PublicKeyTok

Discussion created by ehsan_ro on Dec 3, 2011
Latest reply on Dec 5, 2011 by ehsan_ro
Hello,

I am trying to develop a code using ArcMap Add In template in VS2010
I have a serializeable struct in c# which I would like to serialize and then deserialize
I have written the following code to serialize this struct.

        [Serializable()]
        public struct Test
        {
            public double a;
            public double b;
        }

        public void Serialize(Test obj)
        {
            Stream file = File.Open(@"c:\tt.dat", FileMode.Create);
            BinaryFormatter b = new BinaryFormatter();
            b.Serialize(file, obj);
            file.Close();
        }

This code works well but when I try to deserialize the same struct in the same project it gives me this error

"Unable to find assembly 'SerializeGIS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'."} System.Exception {System.Runtime.Serialization.SerializationException}


This is the deserializing function

        public Test DeSerialize(string Name)
        {
            Test Obj = new Test();

            try
            {
                Stream  file = File.Open(Name, FileMode.Open);
                BinaryFormatter  b = new BinaryFormatter();
                Obj = (Test)b.Deserialize(file);  //This is the line which propagate the exception
                file.Close();
            }
            catch (Exception)
            {
            }
           
            return Obj;
        }

I have put both functions in a windows form application template in c# and they work perfectly but when I use them in ArcMap Add In project it raises the mentioned error

This error gives me at least 20 gray hairs today.

I would be appreciated if someone could shed some light on it.

Regards

Ehsan

Outcomes