mrt*_*ndi 4 debugging visual-studio-2008
在我的一个项目中,Visual Studio 2008有一个奇怪的问题.当我在一行代码上设置一个断点时,它会被点击,但是当我试图"跳过",或者其他任何应该通过该断点并停在下一行的其他内容时,代码会被执行并继续,好像我击中了F5.即使我在此之后的线上有另一个断点,也会发生这种情况,奇怪的是,第二个断点被忽略(有时).
任何人,任何想法?
更新
这是一个示例代码.但似乎在我尝试的任何地方......抛出异常的catch块,我有这个问题.
在下面的代码示例中,"return(T)bFormatter.Deserialize(mStream)"抛出异常.
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();
}
}
Run Code Online (Sandbox Code Playgroud)