Resolved Wierd behavior of Visual Studio debugger

mauede

Well-known member
Joined
Sep 1, 2021
Messages
103
Location
Northwood - UK
Programming Experience
Beginner
Today I witnessed a weird behavior of Visual Studio debugger. For some reason, to me unknown, it refuses to set a break-point for some regular assignment
statements. They are inside an event handler. I do not know whether that matters at all.
In the following I am posting the code where that occurs:








Debugger-Weird-Behavior.PNG


C#:
private void AutoMatchedStruct_Click(object sender, RoutedEventArgs e)
        {
            if(structures.Count <= 0)                 // CHECKS PROTOCOL STRUCTUREs HAVE BEEN LOADED
            {
                MessageBox.Show("Protocol structures must be loaded Before renaming can start.", "Warning ", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            PTAccess pt = new PTAccess();
            List<string> EditedList = new List<string>();
            EditedList = pt.StructuresAutomaticRename(structures);
            int j = 1;
            foreach (string str in EditedList)
            {
                AutoNames.Add(new EditableStructures { StrName = str,  IsAccepted = false, NamInd = j});
                j++;
            }
           // string  DbgList = ""                                                       ;                                                         // DEBUG PURPOSE
           // DbgList = String.Join(" , ", AutoNames.Select(x => x.StrName));                                            // DEBUG PURPOSE
           // MessageBox.Show($"AUTOMATICALLY RENAMED STRUCTURES: \n  {DbgList}");             // DEBUG PURPOSE
//............................ Compare Number of Guessed Structure Names With Number Of Structure Names From Velocity DataBase
// ............................ Alert User If Less Than 50% Structures Could Not Be Guessed
            int NumGuessed = 0;
            int NumOriginal = 0;
            var Guessed = AutoNames.Where(m => !string.IsNullOrWhiteSpace(m.StrName)).ToList();
            NumGuessed = Guessed.Count;
            NumOriginal = strucNames.Count;
            if ((double) (NumGuessed / NumOriginal ) < 0.5)
            {
                MessageBox.Show("Less than 50% of structure automatically renamed! \n", "Is this patient belonging to this trial? ", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            UpdateAutoStrucNames();
        }

Is this to be expected?
Thank you very much
 
Solution
That tends to happen if one or more of the following is true:
1) You are trying to debug a Release build.
2) The PDB file does not match the .EXE or .DLL file.
3) The source code does not match the .PDB, .EXE, or .DLL.
4) You set the breakpoint using the breakpoint dialog and manually entered the method name (and inadvertently put in a typo).
Thank you
I realized the *optimize" option was set. I deselected and the debugger restarted to behave as a debugger.
That tends to happen if one or more of the following is true:
1) You are trying to debug a Release build.
2) The PDB file does not match the .EXE or .DLL file.
3) The source code does not match the .PDB, .EXE, or .DLL.
4) You set the breakpoint using the breakpoint dialog and manually entered the method name (and inadvertently put in a typo).
 
That tends to happen if one or more of the following is true:
1) You are trying to debug a Release build.
2) The PDB file does not match the .EXE or .DLL file.
3) The source code does not match the .PDB, .EXE, or .DLL.
4) You set the breakpoint using the breakpoint dialog and manually entered the method name (and inadvertently put in a typo).
Thank you
I realized the *optimize" option was set. I deselected and the debugger restarted to behave as a debugger.
 
Solution
Back
Top Bottom