I have a peice of code that loads some user settings on startup. This peice
of code randomly blocks when calling BinaryFormatter.Deserialize(stream). I
could run my app again and it wont happen, and then again and it will. It is
completely random as to whether it will freeze on that line or not. Code is
below. (Verbose console logging to determine exactly what was going wrong)
if(File.Exists(Constants.GuestDetailsLocation))
{
try
{
Console.WriteLine("Details
exist. Opening file.");
FileInfo file = new
FileInfo(Constants.GuestDetailsLocation);
Stream fileStream =
file.Open(FileMode.Open);
Console.WriteLine("File Open.");
BinaryFormatter binFormatter =
new BinaryFormatter();
if(fileStream.Length > 0)
{
Console.WriteLine("File
size greater than zero. Attempting
deserialization");
result =
(Guest)binFormatter.Deserialize(fileStream);
Console.WriteLine("File
Deserialized.");
fileStream.Close();
Console.WriteLine("File
closed.");
}
}
catch
{
......
The line: result = (Guest)binFormatter.Deserialize(fileStream); never
returns, sometimes. Could this be a monotouch bug, or am I doing something
wrong?
--
View this message in context:
http://monotouch.2284126.n4.nabble.com/Binary-deserialization-blocks-indefinitely-sometimes-tp4033546p4033546.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch