S
sippyuconn
Hi
Trying to copy a complex data structure with this code
public object Clone()
{
MemoryStream ms = new MemoryStream();
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(ms, this);
ms.Position = 0;
object obj = bf.Deserialize(ms);
ms.Close();
return obj;
}
I have a text exe that works where the EXE and dll assemblies are all in
same directory. When I move the code to production I get the above exception.
The only thing I can see is difference is that the product install of files
is different
C:/Company/EXEDir
C:/Company/AssembleyDir
The EXE is executing in one directory and all the assemblies that are called
are in another dir. I scanned the web but didn't find much but there was a
reference to the fact that all the Deserializd Classes need to be in the same
dir which they are. I also added code to set dir to where the assemblies are
Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
Environment.CurrentDirectory =
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
Not sure what else to look at ???
Thanks
Trying to copy a complex data structure with this code
public object Clone()
{
MemoryStream ms = new MemoryStream();
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(ms, this);
ms.Position = 0;
object obj = bf.Deserialize(ms);
ms.Close();
return obj;
}
I have a text exe that works where the EXE and dll assemblies are all in
same directory. When I move the code to production I get the above exception.
The only thing I can see is difference is that the product install of files
is different
C:/Company/EXEDir
C:/Company/AssembleyDir
The EXE is executing in one directory and all the assemblies that are called
are in another dir. I scanned the web but didn't find much but there was a
reference to the fact that all the Deserializd Classes need to be in the same
dir which they are. I also added code to set dir to where the assemblies are
Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
Environment.CurrentDirectory =
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
Not sure what else to look at ???
Thanks