2

I am trying to view the source code of an installed application so I may debug it. My debugger is Visual Studio, using .Net 4.5. To open the file, I selected "Open from source code" in Visual Studio, and then I selected the applicationName.exe file. VS appears to have opened the file, and I am now able to run the file from Visual Studio.

However, I am unable to view the source code, add breaks, or step through the application. When I use IntelliTrace's "Break all" option, the application seems to be suspended, but then I am simply informed "Code not running: The current thread is not currently running code or the call stack could not be obtained." Then when I hit "Continue", the application resumes right where it left off.

How do I get around this so I can actually view the source code and insert break points?

2 Answers 2

3

How do I get around this so I can actually view the source code and insert break points?

You need to have corresponding .pdb file for the exe that you are debugging. The .pdb files used to “map the identifiers that you create in source files for classes, methods, and other code to the identifiers that are used in the compiled executables of your project. The .pdb file also maps the statements in the source code to the execution instructions in the executables.” The debugger need this type of files to locate the code lines in source file.

Detailed explanation, please refer to: https://msdn.microsoft.com/en-us/library/ms241613.aspx

And above link also introduce how to load .pdb file and source file when debugging.

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

2 Comments

This answer has been informative, but I am having trouble finding the .pdb file. I've looked through the program's files for the .pdb, but haven't seen it. The link given says that the system will look at "the location that is specified inside the DLL or the executable file," but I don't know how to view the .exe's code or which .dll to look in. Since I don't know where the system is looking, and since it doesn't appear to be in the same folder as the .exe, are there any other likely locations for the .pdb?
@MrSpudtastic, The .pdb file should be provided by the installed program that you want to debug. So please check the program installation path to confirm it has provide the .pdb file. And you also could contact the program author to provide the .pdb file to let you debug it.
0

In general what Leo-MSFT wrote is true, with .NET application it's a bit easier in terms of the source code and PDBs as they can be generated from the .NET assembly. It will not the exact source code but something close to that can be understandable.

You can use tools like dnSpy to open such assembly and debug there with the source code being displayed.

If you need to stick to Visual Studio I recommend to use JetBrains dotPeek. It can act as a symbol server (so providing the PDBs when needed).

You add it to VS (Symbol Server options) and then when VS asks for the PDB it can generate one for you on the fly and you can debug.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.