Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does Visual Studio consider "User Code"?

Suppose I have a function that throws an exception. Suppose this function is called by a third-party DLL, and the third-party DLL will handle the exception I’ve thrown.

If Visual Studio decides that the third-party DLL is not "user code" (as seen in the image below) then it will stop on my exception by default, even though it gets handled later. It isn’t exactly wrong to do so; it clearly explains that the exception was unhandled by user code. But what is it that makes Visual Studio call some DLLs "user code" and others not?

enter image description here

I had a theory that this happens because the symbols aren’t loaded, but there are modules in the list that have loaded symbols but are still not considered "user code".

like image 540
Roman Starkov Avatar asked Mar 08 '12 11:03

Roman Starkov


People also ask

What is the user interface of Visual Studio Code?

User Interface. At its heart, Visual Studio Code is a code editor. Like many other code editors, VS Code adopts a common user interface and layout of an explorer on the left, showing all of the files and folders you have access to, and an editor on the right, showing the content of the files you have opened.

What is just my code in Visual Studio?

Just My Code is a Visual Studio debugging feature that automatically steps over calls to system, framework, and other non-user code. In the Call Stack window, Just My Code collapses these calls into [External Code] frames. Just My Code works differently in .NET, C++, and JavaScript projects.

What is Visual Studio Code used for?

Visual Studio Code is a source-code editor that can be used with a variety of programming languages, including Java, JavaScript, Go, Node.js, Python and C++. It is based on the Electron framework, which is used to develop Node.js Web applications that run on the Blink layout engine.

How do I configure Visual Studio Code?

You can configure Visual Studio Code to your liking through its various settings. Nearly every part of VS Code's editor, user interface, and functional behavior has options you can modify. VS Code provides two different scopes for settings: User Settings - Settings that apply globally to any instance of VS Code you open.


1 Answers

Yes, without a .pdb file the debugger can't tell whether it is user code or not. It is explained reasonably well in the MSDN article:

To distinguish user code from non-user code, Just My Code looks at three things: DBG Files, PDB files, and optimization.

In a standard Debug build, optimization is turned off and debug symbols are created for all modules. When you run a debug build, those modules are considered to be user code. If I call a library function that is optimized and does not have debug symbols, however, it is not user code. Just My Code prevents execution from stopping at breakpoints in the library code, which is usually not code you are interested in debugging. In the Breakpoints window, those breakpoints will appear with the Disabled Breakpoint icon.

like image 81
Hans Passant Avatar answered Oct 20 '22 14:10

Hans Passant