By Instance Hunter

2010-01-28 16:09:10 8 Comments

C# desktop application on express edition. Worked then didn't work 5 seconds later.

I tried the following.

  • Ensure debug configuration, debug flag, and full debug info are set on all assemblies.
  • Delete all bin and obj folders and all DLLs related to the project from my entire machine.
  • Recreate projects causing the problem from scratch.
  • Reboot.

I have two WinForms projects in the solution. One of them loads the debug info, one doesn't. They both refer to the assembly I'm trying to get debug info on in exactly the same way in the project file. Any ideas?

I want to add in here, mostly for myself when I come back to review this question, that symbols are not loaded until the assembly is loaded, and the assembly is not loaded until it is needed. If the breakpoint is in a library that is only used in one function in your main assembly, the symbols will not be loaded (and it will show the breakpoint as not being hit) until that function is called.


@peter bence 2019-05-20 13:11:43

If you are using a C++ project or dll from a C# or any .Net project, and you want to debug into the native code. Then go to the .Net Project Properties -> Debug -> Enable native code debugging (set it to true).

@juFo 2012-09-04 11:47:45

First try rebuilding your project by right mouse click the project > Rebuild If that doesn't work, try a clean of the project (right mouse click on the project > clean)

If that didn't work check this:

  1. Right mouse click your project
  2. Select [Properties]
  3. Select the [Build] tab
  4. Make sure [Define DEBUG constant] and [Define TRACE constant] are checked
  5. Make sure [Optimize Code] is unchecked
  6. Click the [Advanced] button at the bottom of the Build tabpage
  7. Make sure that [Debug Info:] is set to [full]
  8. Click [OK] and rebuild the project ;-)

(step 6 generates the .pdb files, these are the debugging symbols)

@Chiefy 2014-02-13 09:35:51

Make sure that [Debug Info:] is set to [full] - fixed it for me! I have multiple configurations set up on my project, the new ones I added didn't have this set.

@Aaron Shaver 2015-07-29 20:30:44

This worked for me! But instead of [full] I was able to do pdb-only

@Gene 2015-08-29 12:49:47

Turns out I was in the release build. tsk.

@DJMcMayhem 2015-12-15 22:14:21

If you don't have a build tab, you can also go compile > Advanced compile options > steps 4 - 7. That did it for me.

@CSS 2016-01-09 00:12:32

That's great if you're only working with a single project, but I've got 20 and the active process iterates through all of them, depending on the specific process it's running.

@Bill Hoag 2016-03-09 15:40:58

If you have a mixed C++/C# project with a native startup, make sure it's project's Debugging > Debugger Type is Mixed.

@jeffaudio 2016-12-09 16:32:08

I also had to make sure that Properties > Build > Optimize code was unchecked.

@Zakk Diaz 2017-02-13 20:42:35

Another developer created additional build configurations and we didn't know the above was required for loading the debugging symbols. After following the above steps it works as expected

@curiousBoy 2017-09-04 18:23:39

This works thanks a lot. But what is the trade off for this? If nothing, why it is not default?

@Andy Sinclair 2017-11-11 12:56:11

Setting Debug to full worked for my core project, thanks!

@Jon 2018-03-23 17:36:32

[Debug Info:] is set to [full]... Thank you. Not sure why this project was set to "none".

@Michael Earls 2018-05-02 15:13:34

Using the "full" setting causes issues with netstandard projects that use .NET 4.x libraries. Our WebApi project would fail to build after an exception when the debug info was set to "full". We had to restart Visual Studio to unlock some .dlls. However, setting it to "pdb only" still enables debugging for us, but doesn't cause the odd side-effects.

@karthik kasubha 2018-12-01 15:04:49

Hi , I had a web project and wcf project , break point was fine in web but for WCF faced the error “The breakpoint will not currently be hit. No symbols have been loaded for this document." on WCF project went to tools-->"Attach to process " able to hit the break point and issue got resolved .

@John 2019-05-13 10:57:12

DEBUG constant has nothing to do with this.

@abdallah mahmoud 2019-05-07 10:35:19

Debug ->Options -> General -> Uncheck mark for "Enable Just My Code"

This worked for me.

@Agamemnon 2019-05-17 08:47:26

This seems like it might be a default setting that is worth checking if upgrading VS to newer version (as had happened to me).

@melicent 2019-04-09 19:45:24

After trying a bunch of these, the thing that ultimately worked for me was this:

In Debug > Options > General, uncheck Enable Edit and Continue.

@melicent 2019-04-12 17:28:32

I ran into the same problem a few days later and the above solution didn't knock it out for me this time. I'm running my solution using docker-compose and it turns out the problem was with the dockerfile of my project. Whatever VS originally dumped into that file wasn't building the image correctly or putting it in the right place.

@Karthik 2019-04-04 07:04:25

The Following steps forked for me:

  1. Go to the "bin" folder of your project.
  2. Delete the "Debug" folder.
  3. Build your project again.
  4. The Debug folder will get re-created.

Now you can start debugging again.

@I Want Answers 2019-03-03 03:14:32

I think the source if this error is, the debug symbols have a hard time surfacing to the solution after building for release.

I tried all the other answers -- generally, regenerating .pdb symbols or checking their location, cleaning and rebuilding project, ensuring active configuration is not Release etc.

What eventually worked for me is right-clicking on the project in solution explorer > Debug > Start new instance.

@Yojana Ambavkar 2019-02-21 10:31:46

Try to do this. It worked for me.

Debug=>Options=>General => Remove the check mark for "Enable Just My Code"

@nPcomp 2018-12-27 21:04:22

In my case, none of these solutions worked. I had to go to

Tools -> Import and Export Settings -> Reset all settings.

and then debugging started working without any issues.

@user781700 2012-10-02 15:10:25

I also had the same issue what I rebuild the whole solution (including refereced projects) in x86( or x64)

Even though I set all of my projects to x86 from Configuration Manager (Build->ConfigManager) some of my projects were not set to x86.

So Just to make sure right click on the project and follow

project -> properties -> Debug Tab, verify Configuration and Platform.

@tfa 2017-06-15 23:59:59

This took me a while tried other options above and for some strange reason debugging stopped working.

Tool -> Options -> Debugging -> General -> (untick) "Require source files to exactly match the original version" option

@DaveInCaz 2018-11-15 13:12:20

When debugging an assembly by starting an external application there are some extra considerations:

  • The external app may load its own copies of assemblies (DLLs) from a manifest file. (e.g., file appname.exe.manifest) If so, you need to disable this possibly by manually altering the manifest.

  • The external app may just try to load from DLLs in its own folder, even without a manifest. You will have to remove / rename these.

With these steps taken care of, the version of the assembly running in the debugger should be correctly loaded and can be debugged normally.

@Kamran Hyder 2014-02-22 09:21:10

When trying to debug an Excel AddIn in VS 2013, after I had tried all Debug settings by disabling DotNet Framework Source Stepping and disabling Symbol Loading, what finally worked for me was changing the Configuration Setting to Release rather than Debug, since the compiler seemed to step over the code and the breakpoints were eventually hit.

@M.Paunov 2018-11-12 08:58:40

If you have both C# and native code(C/C++), make sure that native debugging is enabled for the project:
1. Right-click your Startup Project in Solution Explorer
2. Select Properties
3. Select "Debug" tab
4. Make sure Native Code debugging is enabled "Enable native code debugging" must be checked in order to be able to debug your native code

@Josh Siegl 2018-03-12 19:50:29

In my case this started happening after a Windows Update, turns out the windows update turned off Internet Information Services which was making it appear that my API was unable to hit the break-point that I had set, but what was actually happening was that IIS was failing to start and therefore my application code wasn't actually running.

Double check that Internet Information Services is enabled in the Windows Features menu.

Instructions for IIS:

  • control panel
  • Programs
  • open or close windows features
  • tick internet information services
  • restart visual studio

If using IIS Express:

Open 'Add/Remove Programs' from the old control panel and run a repair on IIS Express Or you might go Control Panel ->> Programs ->> Programs and Features ->> Turn Windows features on or off ->> Internet Information Services and check the parent Internet Information Services folder.

I got this answer here: Specified argument was out of the range of valid values. Parameter name: site

@Nathan 2018-08-30 18:42:34

There are many answers with many different solutions to fix this issue.

Another solution is to make sure that your code is reachable. For example:

Any code that is added after a Return in a function. Adding a GOTO that effectively skips your code that has the break point.

I'm not saying these are normal but they are also causes.

@Muhamed Krasniqi 2018-08-22 11:53:02

I had similar issue and I did the following: Debug=>Options=>General => Remove the check mark for "Enable Just My Code" This worked for me..

@Adithya Sai 2018-05-21 05:18:15

In my case i am trying to debug in relase mode. Once i change it to debug mode. Its working

@Melqui Franco 2018-05-03 21:03:05

No meu caso dei um F11 na chamada do método, forçando entrar no método onde o BP com problema estava, sendo assim, o break point foi recuperado.

In my case I gave an F11 in the method call, forcing to enter the method where the problem BP was, so the break point was recovered.

@Paul Schroeder 2018-04-29 01:59:23

In my case, I was debugging a WPF extension using Visual Studio's Experimental Instance. After starting debugging and then pausing the dubugger, I opened the Debug > Windows > Modules window. Form there, I could see the directory where Visual Studio was trying to load symbols C:\Users\<username>\AppData\Local\Microsoft\VisualStudio\15.0_76a9e536Exp\Extensions\<companyName>. After stopping debugging, I deleted the target folder using Windows Explorer and restarted the debugger. Visual Studio was then able to hit the breakpoint.

@Dimiano 2018-05-07 21:07:07

The only option worked out for my VS 2017 (v15.6)!

@jp2code 2012-07-11 18:26:10

Cross posting this fix from Hans K that I found on the similar thread >> HERE <<:

Right click on solution --> Properties

Look under Common Properties --> Startup Project

Select multiple startup projects

select Start action on the projects you need to debug.

@D-Sect 2013-04-22 18:51:14

This also handles situations where you are trying to debug a WEB project that is a .NET remoting endpoint running on the VS development server and showing "no symbols loaded".

@Dowlers 2013-06-20 23:22:47

This fixed it for me. I think previously sombody had tried to attach the debugging to the local IIS server instead of the debug version of IIS that visual studio uses.

@Redeemed1 2017-02-15 11:01:25

If you have removed the .suo file you can lose the solution settings selected here and will have to set them again

@Anthony De Souza 2018-05-03 19:15:55

I checked these settings again today after previously debugging successfully and found that my startup projects had somehow reverted to a single start up project. It is worth double checking.

@Patrick 2010-01-28 16:35:04

Just something simple to try - you may have tried it already. Right click the Solution in solution explorer, click "clean solution", this deletes all the compiled and temporary files associated with a solution.

Do a rebuild of the solution and try to debug again.

I've also had troubles with breakpoints multiple projects in a solution - some compiled as x86, some as x64.

@Richard Li 2015-02-09 22:24:07

How did you fix the breakpoints with multiple projects in a solution - some compiled as x86, some as x64?

@Michael Lang 2016-02-27 22:44:34

If you are running IISExpress (or the Azure emulator), the files in C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root may not get updated if your AssemblyVersion is Make sure there it is something like 1.0.* so that a new version is generated each time you build your web project. Clean Solution does not clear out the temporary internet files folder.

@Doug Null 2016-07-28 16:53:38

My vs 2015 has no "clean solution" command.

@Jonathan Wood 2016-11-25 17:22:48

This does the same thing as doing a Rebuild All.

@Patrick 2016-12-04 04:57:52

@jonathan Wood - I'd mostly agree with that. But in rare circumstances, Rebuild All can produce slightly different results - I know I've seen strange differences at times. Have a look here for some interesting discussion:…

@niico 2017-02-21 14:05:24

I have a multi project solution - I fixed this problem by making the project I wanted to debug the startup project for the solution.

@AgapwIesu 2017-10-10 13:26:39

I had this problem and solved it by rebuilding the solution, remembering to switch to a debug rebuild. I had switched to the Release configuration to deploy my software. When I went to continue working on it, I forgot to switch back, and kept having problems with this in a web service that is part of my solution. I finally figured out to change back to the debug configuration and do a rebuild on the entire solution.

@fabriciorissetto 2014-12-04 12:44:32

The selected answer led me to fix my problem. But I need to do a few things more:

Even with "Debug" selected in the dropdown:

enter image description here

And in the project Properties > Build:

enter image description here

The Visual Studio was not loading symbols to a specific project. So in that dropdown I select "Configuration Manager" and saw that the settings to my web project was incorrect:

enter image description here

enter image description here

Then I set that to "Debug" and it started to generate the .pdb file. BUT I need to manually copy the PDB and DLL and put in the folder that VS was looking (here is where the selected answer helped me):

enter image description here

@Dipak Telangre 2018-01-30 13:42:32

I was running in release mode. Thanks !!

@Ben 2018-05-14 00:55:02

Key for me was that the 'Deploy' box wasn't checked, thus the pdb wasn't being re-deployed after building

@Jamal Kaksouri 2017-07-11 11:38:57

Right click on Project -> Properties -> Go to Build Tab -> Uncheck Optimize Code. Do It for any project in your solution

@phuclv 2018-11-22 07:26:29

it's not a good idea. It's better to compile in debug mode and then change to release mode after all has been done

@Arne H. Bitubekk 2013-09-11 10:39:18

Check if your .pbd file is missing in your bin/Debug folder. If it is then go to "Properties" of your project, selected "Build" and then "Advanced" at the bottom. Choose "full" under "Debug info" in the new window that appeared. This was my issue and solved it for me.

Showing where to find the setting

@EatATaco 2014-08-14 17:05:55

I would suggest anyone coming to this page to make sure the pdb is being generated as this was the problem for me.

@Greg Little 2015-08-31 15:57:34

Thanks! "pdb-only" (rather than full) was enough. Also, "Advanced" is a Button at the bottom of Build.

@ylka 2017-06-28 14:10:45

where should the pdbs being generated?

@Emixam23 2018-01-03 21:08:05

Why you answer hasn't been set as the correct answer?

@Rich 2018-02-09 19:33:15

Awesome answer and the screenshot was helpful.

@Jota.Toledo 2018-06-19 07:59:15

solved my issue in a .net core project

@Ken Palmer 2018-07-13 18:12:19

Thanks, this fixed it for me after I made new Web.config transforms and deleted the default configs (like Web.Debug.config) that VS 2017 provides.

@SoftSan 2018-10-03 12:42:00

Tried lots of other options (wasted almost 2 hours) This "full" option fix my issue. Thanks!

@Serj Sagan 2013-05-15 02:21:48

Sometimes, even though it gives you this error, the breakpoint still gets hit, so just ignore the error. This happens fairly often in the Views of an MVC web app.

@Bartosz 2016-01-15 16:19:09

This should actually be upvoted somewhere to the top. I spent lots of time doing all the answers above, but the breakpoint would actually be hit. Just check:) Also, that was a WPF desktop app.

@aeroson 2016-07-21 12:17:15

aspx seems to be compiled on demand, thus debuging info is available only after the aspx page is needed

@David Refaeli 2017-11-30 13:23:53

Also for UnitTesting - you need to wait a few seconds and then it gets hit.

@goodeye 2019-01-10 03:15:11

I think @aeroson comment is what I ran into. One page loaded breakpoints, another didn't. Tried all kinds of things from answers here, and then refreshed that page, and the breakpoints loaded.

@Kyle Huang 2019-02-18 19:42:10

thanks... digging around for half an hour and just realized that the breakpoint still gets hit...

@Neil Walker 2017-11-15 10:58:06

I know I'm years late, but I thought I'd done something wrong and followed the above steps then I realised I'd set the solution configuration to 'Release' by mistake :)

@tfrascaroli 2017-12-01 14:26:16

Can I upvote 10K times? The worst of it all is that I think I've searched for this on google like 10 times now, and everytime is the same stupid mistake. Perhaps Microsoft could hint it to the user?

@DaveInCaz 2018-11-13 20:58:57

@JohnT 2017-10-18 18:25:25

A new way to get this problem has appeared as of Visual Studio 2017 15.3.1 through 15.3.5. If you are using EditorConfig, the charset=utf8 option causes these symptoms. The VS team has reproduced this and says they are working on it.

So one fix is to comment out your charset=utf8 line in the .editorconfig file.

Status is now "Fixed - pending release" as of October 9, 2017.

(Thanks to John Hatton, "The breakpoint will not currently be hit. The source code is different from the original version." What does this mean?

@george.himself 2017-10-12 13:33:17

In my case, it was because my publishing profile (Publish to local IIS site) was somehow set to Release Configuration, despite the fact that the global build configuration was set to Debug. Modified the publishing profile to Debug configuration solved the issue for me.

@My Stack Overfloweth 2017-09-18 20:04:45

For my Xamarin application, it finally started debugging after I completely wiped the Source Control folder, did "Get Latest", and rebuilt the solution.

@Andy 2012-05-01 12:49:46

Try running visual studio as an administrator within windows.

@Bill Hoag 2017-06-09 13:26:11

I ended up needed to run msvsmon as Admin on the remote machine.

@Jazimov 2017-06-25 14:43:15

This is not a solution people should follow. If this fixes the problem then you should be focusing on why you would need admin rights in order for VS to be able to read your project's .pdb file contents.

@Andy 2017-09-11 09:09:44

@Jazimov I disagree. Whereas I'd love to spend time investigating this, in my case this solved my problem and allowed me to continue working as I'm sure it did for others too. If you'd like to look into it and improve this answer feel free, that's what it's there for.

@Jazimov 2017-09-13 00:07:18

To be clear: I understand it fixed your issue with Visual Studio, that's not what I was disputing. I am disputing the recommendation that others accept running the IDE as the solution rather than simple a solution. If running the IDE as administrator fixes the issue then that information should be used to troubleshoot the actual root cause so that the IDE doesn't require admin privileges in order to work properly.

Related Questions

Sponsored Content

49 Answered Questions

13 Answered Questions

1 Answered Questions

[SOLVED] Breakpoints not hit, no symbols loaded

Sponsored Content