How can I trace AccessViolationError in .net application

56 Views Asked by At

I am getting an error when I switch tabs in my application

The stack trace is not showing which function or statement caused the error and the error is on Application.Run

And I am running in Debug mode This is a C# Window Forms Application in Visual Studio 2019

This is really confusing to debug, especially since it happens randomly, but only when I switch tabs

Is there any way I can see what was the last line of code that was executed or the function it was called from or something?

enter image description here

1

There are 1 best solutions below

1
mohsin Iqbal On

If 'slotsjson' is supposed to be a variable from an outer scope (e.g., a field in a class), make sure it is accessible from the current context. If it's a local variable declared in a different method, you won't be able to access it in the current method. To fix this issue, review your code, verify the spelling and capitalization of 'slotsjson,' and ensure that it is declared or accessible in the current context. If you're still having trouble, please provide more context or code, and I can offer more specific assistance