Patrick95
Patrick95

Reputation: 136

How do you get new configurations to stop on breakpoints in Visual Studio?

I am using VS 2019.

Debug and Release builds work as expected.

I've added 4 other configurations in order for developers on our team to quickly switch between all of our lower environments.

I am using config transforms to transform the web.config on build and in the release. This is all working as expected. The compilation debug=true for all our lower environments.

<compilation debug="true" targetFramework="4.5.2" />

However, whenever I try to run on a new configuration for the lower environments added, it tells me that The breakpoint will not currently be hit. No symbol has been loaded for this document.

enter image description here

How do I enable debugging on all the new configurations that I have added via the configuration manager?

Upvotes: 1

Views: 226

Answers (4)

tgriffin
tgriffin

Reputation: 535

The build configuration needs to be set to generate pdb files. This can be set in the project properties window.

For .NET For .NET

For .NET Framework For .NET Framework

https://learn.microsoft.com/en-us/visualstudio/debugger/how-to-set-debug-and-release-configurations?view=vs-2022

Upvotes: 1

Patrick95
Patrick95

Reputation: 136

I had separate web.config files for each of the new configurations. None of the solutions posted worked for me. I ended up having to stay selected on Debug.

I would preview transform for the given configuration and copy the output of that preview into the file used by the web.debug.config.

This allowed me to run the application in debug against a new environment.

Upvotes: 0

user20376806
user20376806

Reputation: 304

When using VS to debug a program, it will load all the pdb files generated by your program and the dll library that the program depends on by default, but the result is often that VS cannot find the pdb file that depends on the library, so it prompts you "Cannot find or open pdb file".

Debug --> Options --> Debug --> General --> Check "Enable source server support" (the 3 sub-options included do not need to be checked), and a security alert box will pop up, select "Yes"

Then, still in the "Options" dialog box, select "Debug --> Symbols", check "Microsoft Symbol Server" in the option bar on the right, and a prompt dialog box will pop up, click "OK". At the same time, for the directory of the cache symbol, select the directory in the illustration.

enter image description here

Finally please rerun your program.

Upvotes: 0

beeker
beeker

Reputation: 810

While debugging is running, from the menu bar choose "Debug" > "Windows" > "Modules"

In the modules window, find the module that contains the code you want to debug, right click and choose "Load Symbols", you can also "Always Load Automatically" to have them automatically loaded.

enter image description here

Upvotes: 1

Related Questions