Reputation: 642
i have a C# project that i'm working on and i'm trying to debug an issue that cause an unhandled exception. The problem is that whenever i place a breakpoint and it gets hit if i press "Step Into" it simply resumes execution instead of stepping to the next instruction. Does anyone know how to step C# instructions 1 by 1 instead of resuming execution?
I'm using Visual Studio 2019 on Windows 10 to do the debugging. The project is a solution with multiple projects where the main project is written in C# with others written in C++ and C. I am able to load the symbols successfully for the C# project.
Here is the github repository.
Edit:
The project i'm working on is an NES emulator called Mesen and the issue i'm trying to debug is an unhandled exception during online play. The exception triggers apparently randomly and i've tried multiple actions to try and trigger it but it still only happened on its own.
private void StartEmuThread()
{
if(_emuThread == null) {
_emuThread = new Thread(() => {
try {
InteropEmu.Run();
_emuThread = null;
} catch(Exception ex) {
MesenMsgBox.Show("UnexpectedError", MessageBoxButtons.OK, MessageBoxIcon.Error, ex.ToString());
_emuThread = null;
}
});
_emuThread.Start();
}
UpdateMenus();
}
I'm trying to put a breakpoint on InteropEmu.Run() and single step from there but every time i hit step into it just resumes the program.
Here is a screenshot from visual studio during when i hit the breakpoint on InteropEmu.Run()
And here it resumes after i press step into at the top in the debugging toolbar.
Here is the exception that i'm trying to troubleshoot
Thanks
Upvotes: 0
Views: 775
Reputation: 642
I've tried out some different build options and it turns out single stepping is disabled for Release builds but not for Debug builds. I tried a debug build and this time it worked.
Upvotes: 1