R
Rob P
Hi All,
I'm currently writing an ancient wargame simulator in C# (see
http://ancientarmies.spaces.live.com/blog/) but seem to be having issues
with deserialization.
I have a bit of code that looks like:
public MapEditor.ObjectsToSerialize DeSerializeMap(string filename)
{
MapEditor.ObjectsToSerialize objectsToSerialize;
Stream stream = File.Open(filename, FileMode.Open);
BinaryFormatter bFormatter = new BinaryFormatter();
objectsToSerialize =
(MapEditor.ObjectsToSerialize)bFormatter.Deserialize(stream);
stream.Close();
return objectsToSerialize;
}
This code works fine in debug build, but if I compile to release build it
fails with
'An unhandled exception of type
'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
Additional information: Exception has been thrown by the target of an
invocation.
'
What I'm finding confusing is why it should work in debug, but not release?
Has anyone else seen similar issues?
The project is coded in VS2005 using the 2.0 net framework.
Thanks
RobP
I'm currently writing an ancient wargame simulator in C# (see
http://ancientarmies.spaces.live.com/blog/) but seem to be having issues
with deserialization.
I have a bit of code that looks like:
public MapEditor.ObjectsToSerialize DeSerializeMap(string filename)
{
MapEditor.ObjectsToSerialize objectsToSerialize;
Stream stream = File.Open(filename, FileMode.Open);
BinaryFormatter bFormatter = new BinaryFormatter();
objectsToSerialize =
(MapEditor.ObjectsToSerialize)bFormatter.Deserialize(stream);
stream.Close();
return objectsToSerialize;
}
This code works fine in debug build, but if I compile to release build it
fails with
'An unhandled exception of type
'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
Additional information: Exception has been thrown by the target of an
invocation.
'
What I'm finding confusing is why it should work in debug, but not release?
Has anyone else seen similar issues?
The project is coded in VS2005 using the 2.0 net framework.
Thanks
RobP