61

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?

vvvvv
  • 25,404
  • 19
  • 49
  • 81
Simon Kiely
  • 5,880
  • 28
  • 94
  • 180
  • @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. – George Duckett Jul 24 '12 at 10:57
  • Nice post on the matter: http://blogs.msdn.com/b/zainnab/archive/2010/10/24/show-external-code-vstipdebug0031.aspx – Leniel Maccaferri Nov 26 '14 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."* – samus Aug 02 '18 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."* – samus Aug 02 '18 at 15:00

6 Answers6

84

[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.

Matas Vaitkevicius
  • 58,075
  • 31
  • 238
  • 265
  • 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. – samus Aug 02 '18 at 15:23
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

Tigran
  • 61,654
  • 8
  • 86
  • 123
  • 2
    MSDN has more precise information on what is considered ["My Code"](https://msdn.microsoft.com/en-us/library/dn457346.aspx). There are differences between C# and C++ and there is code with symbol information available which is still considered external code. – m3tikn0b Nov 26 '15 at 10:53
  • 1
    I symbols are already loaded, you just need allow the external code to be shown. The answer below shows how https://stackoverflow.com/a/31044557/6655465 – Eduardo Pignatelli May 21 '19 at 11:57
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.

Community
  • 1
  • 1
marc wellman
  • 5,808
  • 5
  • 32
  • 59
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.

Polynomial
  • 27,674
  • 12
  • 80
  • 107
0

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

Wolfgang Ziegler
  • 1,675
  • 11
  • 23
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 ).

Aghilas Yakoub
  • 28,516
  • 5
  • 46
  • 51