Hi all.
I have a weird problem with Visual Studio 2008 in just one of my projects. When I set a break point on a line of code, it gets hit alright, but when I try to 'step over,' or whatever else that is supposed to pass over that break point and stop on the next line, the code gets executed and continues as if I hit F5. This occurs even if I have another break point on the line just after this one, and strangely, the second break point is ignored (sometimes).
Anybody, any ideas?
UPDATED
Here is a sample code. But it seems that anywhere that I have a try...catch block in which an exception is thrown, I have this problem.
In the following code sample "return (T)bFormatter.Deserialize(mStream)" throws an exception.
public static T LoadEncryptedObject<T>(string location) where T : class
{
if( string.IsNullOrEmpty(location) || !System.IO.File.Exists(location) )
return default(T);
System.IO.FileStream fs = null;
try
{
fs = new System.IO.FileStream(location, System.IO.FileMode.Open,
System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite);
BinaryFormatter bFormatter = new BinaryFormatter();
byte[] encryptedBytes = new byte[fs.Length];
fs.Read(encryptedBytes, 0, encryptedBytes.Length);
MemoryStream mStream = new MemoryStream(Cryptography.Decrypt(encryptedBytes));
return (T)bFormatter.Deserialize(mStream);
}
catch( SerializationException sx )
{
System.Diagnostics.Debug.WriteLine(sx.Message);
return default(T);
}
finally
{
if( fs != null )
fs.Close();
}
}