Inconsistent Errors

njsokalski

Well-known member
Joined
Mar 16, 2011
Messages
102
Programming Experience
5-10
I have an app that involves using IsolatedStorage, as follows:

Dim scoredata As IsolatedStorageFile
Dim stream As IsolatedStorageFileStream
scoredata = IsolatedStorageFile.GetUserStoreForApplication()
If (scoredata.FileExists("ScoreSettings.xml")) Then
stream = scoredata.OpenFile("ScoreSettings.xml", IO.FileMode.Open)
Dim settings() As Boolean = CType(New XmlSerializer(GetType(Boolean())).Deserialize(stream), Boolean())
stream.Close()
stream.Dispose()
Me.UseManualEntry = settings(0) : Me.AllowNegative = settings(1) : Me.IsTakeTurns = settings(2)
End If
If (scoredata.FileExists("ScoreNames.xml")) Then
stream = scoredata.OpenFile("ScoreNames.xml", IO.FileMode.Open)
CType(Application.Current, App).Players = CType(New XmlSerializer(GetType(String())).Deserialize(stream), String())
stream.Close()
stream.Dispose()
End If

When debugging this using the emulator, I get an error on the stream=scoredata.OpenFile(…) lines (the first line inside the if statements). However, sometimes it is the one for "ScoreSettings.xml" and sometimes the one for "ScoreNames.xml", even though I use the exact same values when running the debugger, and completely close the emulator every time. Even if I close Visual Studio each time, the error location is inconsistent. I have been unable to notice any pattern in which one it gives the error on. Why is the debugger giving a different error each time? Thanks.
 
Back
Top