64

I call a method in Visual Studio and attempt to debug it by going over the call stack.

Some of the rows in it are marked "External code".

What exactly does this mean? Methods from a .dll have been executed?

5
  • @AlvinWong: That's not quite right, I've had code not in the solution avaialble for debugging before. I think it's the lack of symbol information as Tigran says. Commented Jul 24, 2012 at 10:57
  • Nice post on the matter: blogs.msdn.com/b/zainnab/archive/2010/10/24/… Commented Nov 26, 2014 at 13:57
  • "If Just My Code is not enabled, [Show External Code] is not available on the shortcut menu and system code is shown by default." Commented Aug 2, 2018 at 14:57
  • "The Show External Code setting is saved to the current user's profiler. It is applied to all projects in all languages that are opened by the user." Commented Aug 2, 2018 at 15:00
  • Leniel's link is dead, but all the blogpost said (in too many words and with VS2008 screenshots) was to right click on the stack and enable "Show External Code" . I found that using web.archice.org . Commented Mar 31 at 20:55

6 Answers 6

89

[External code] means that there is no debugging information available for that dll.

What you can do is in Call Stack window click right mouse button. Then select Show External Code this will expand [External Code] and will show you modules that are being called.

enter image description here

once you get it expanded you will see dll's that are being called you can get locations on disk by clicking on Symbol Load Information...

enter image description here

This will open dialog that shows locations on disk

enter image description here

If you want to debug these external files you need to get .pdb files for dll's and place in same folder as .dll

this should allow you to Load symbols (menu in screenshot 2 above Symbol Load Information) and start debugging.

More on getting .pdb files here.

And here's an actual example of EF .pdb being generated

Hope this saves you some time.

Sign up to request clarification or add additional context in comments.

1 Comment

I had to load symbols from the Modules debug window in VS2017 (with ReSharper installed); the Symbol Load Information and associated commands weren't present on the Call Stack shortcut menu.
16

These are the lines where symbol information is not currently available for Visual Studio Debugger. In other words Debugger is not able to retrieve code from the line executed.

I wrote currently because the symbol information can be downloaded or setup.

For more information you can read this : How to: Specify Symbol Locations and Loading Behavior

2 Comments

MSDN has more precise information on what is considered "My Code". There are differences between C# and C++ and there is code with symbol information available which is still considered external code.
I symbols are already loaded, you just need allow the external code to be shown. The answer below shows how stackoverflow.com/a/31044557/6655465
7

The notation 'External Code' refers to everything that does not belong to 'My Code'.

That's the way it is described in the MSDN documentation here How to: Use the Call Stack Window

In managed code, by default. the Call Stack window hides information for non-user code. > The following notation appears instead of the hidden information.

<[External Code]>

Non-user code is any code that is not "My Code."`

Your Code is as you might have thought everything you did write on your own. So with this definition everything that belongs to external dll's is omitted in the trace of the call stack.

Furthermore according to How to: Step Into Just My Code you have the possibility to deny the debugger to try to trace non-user code.

Here you will find the explanation for what user code actually is:

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

Comments

1

Those lines are not referenced by the debug symbols that you currently have loaded.

This code may be part of an external DLL, or native code inside the CLR. If you know which module it is, and have debug symbols for them, you can load them into Visual Studio manually.

Comments

0

Methods you do not have code / symbols for. Like .NET framework or 3rd party assemblies.

Comments

0

you can use the Attach to Process action on the Debug menu to debug running instance of your host app. (running process has the debug symbols .pdb files ).

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.