Issue with Deserializing a class on Vista

Aug 5 2007 5:57 PM

Hi,

I have an issue that I'm hoping someone can shed some light on. I have a pretty basic class that gets serialized to a binary file at the end of the session. The class itself is basically some numeric, bool and text data (nothing complex).

IFormatter formatter = new BinaryFormatter();
Stream stream = new FileStream(String.Concat(AppDir, "foo.wbcfg"), FileMode.Create, FileAccess.Write, FileShare.None);
formatter.Serialize(stream, UserSettings);
stream.Close();

When I read it back next time a session starts it works correctly on XP, but fails on VISTA with an error something like , type initializer failed.

IFormatter formatter = new BinaryFormatter();
Stream stream = new FileStream(String.Concat(AppDir, "foo.wbcfg"), FileMode.Open, FileAccess.Read, FileShare.Read);
UserSettings = (MyUserSettings)formatter.Deserialize(stream);
stream.Close();

I have tried serializing to both binary and xml with no difference. Any help would be appreciated.

thanks

justin