Visual Studio 2008 debugger issue

I have a strange problem with Visual Studio 2008 in only one of my projects. When I set a breakpoint on a line of code, it gets in shock, but when I try to "step over" or something else that needs to go through this breakpoint and stop on the next line, the code will execute and continue as if I hit F5. This happens even if I have another breakpoint on the line immediately after it, and, oddly enough, the second breakpoint is ignored (sometimes).

Anyone any ideas?

UPDATED

Here is a sample code. But it seems that anywhere I have a try ... catch block in which an exception is thrown, I have this problem.

In the following code example, "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();
    }
}
+3
source share
5 answers

Known issue with VS2008. The patch is available here .

+5
source

Often this may be due to an uncaught exception. Try to catch all exceptions in your IDE.

In the menu bar, click Debug-> Exceptions ... and check the "Abandoned" box for the Exception for the regular Runtime language .

+2
source

Cryptography.Decrypt COM? , -, COM, , , .

, , , , , -, .

0

, , , . , .

- , .

0

I had the same problem. This is because my application used another application, that is, Dbmonitor to track database events, but during debugging I did not start Dbmonitor. Therefore, check if you are adding any code to use a third-party application. This may help u :)

0
source

Source: https://habr.com/ru/post/1702570/


All Articles