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.

30 comments

@Izaias Dantas 2019-12-04 19:57:32

I resolved this way: Run the project. Go to, Debug -> Windows -> Modules Choose the library you want debug and right click in it. Choose -> "Load Symbols" and then will change "Skipped loading suymbols" for "Symbols loaded".

@Zoltan 2019-11-28 10:06:06

Make sure your files are open from the relevant project, not from another (old) one.

Example:

  • You working on a project, close the VS, but you left files (tabs) open in VS.

  • Copy your project to a new folder and open solution. The files (tabs) will load from the old directory and if you want to debug then you cannot debug until you close them and reload them from the current folder.

I was very close to reinstall my VS because nothing helped for me from another answers, but fortunately I realised this in my project and I can debug now.

@Farshid 2019-11-24 11:13:07

I test all answers for this question not work for me, I use this below method:

I exclude that file(s) has breakpoints from project where that visual studio can't hits them and then I includes them into my project and worked breakpoints.

@Bimal 2019-11-20 05:28:26

1.Clean solution and Rebuild 2.Check the configuration is set to Debug 3.Make sure that the PDB file is in the Debug folder it self 4.From Debug menu click Enable All Break points

@aseman arabsorkhi 2019-10-20 08:40:41

it was so easyyyy. it also happend for me because .pdb file of the project have not copy in debug\Bin folder then it could not load symboles (.pdb file) in debug mode . in this way : you must rebuild your target project and manually copy the symboles (.pdb file) in debug\Bin folder of execute project

@LuisEduardoSP 2019-08-20 18:23:25

I had this problem.

My issue was that the aspx, aspx.vb and aspx.designer.vb files were imported wrong (Perhaps they were imported one by one to the project).

The breakpoint were in the aspx.vb, but was unreachable and had the warning of this question.

The solution was to delete the three files and import them again. Now I can reach the breakpoint.

@Mike 2019-07-30 11:21:16

Check are the following two setting the same in Visual Studio:

Right click test project, go to Properties, Build tab, and look at Platform target

Mine are all set to "Any CPU" so x64

On the Main Menu bar, go to Test, Test Settings, Default Processor Architecture

Mine was set to X86

enter image description here

Changing this to X64 to match above setting made the built in Visual Studio menu “Debug Test(s)” work and hit breakpoints that were previously ignored with the message “The breakpoint will not currently be hit. No symbols have been loaded for this document”.

@brykneval 2019-06-18 10:29:29

I had same problem, checked all the previous solutions but didn't work for me. Simple but added answer just to make sure people don't get stuck on this not to exist problem as I did.

What worked for me was, I was running VS 2013 on admin mode and running on normal mode did the trick. Tried multiple times switching to normal and admin mode and its consistently working fine.

IDE: VS 2013 Professional
Version: 12.0.40629.00 Update 5

@zs2020 2019-05-29 20:57:35

Check your Solution Configuration drop down list. Make sure you select Debug, not Release.

@Shakeel Hussain Mir 2019-07-01 12:52:11

Thank you @zs2020

@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

@PNDA 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 ASP.net 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.

@Vaishali 2019-07-11 13:04:13

Of all the suggestions, this one worked for me!

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

@FrenkyB 2019-09-13 11:33:40

I can not change this setting, it's grayed out. I am running VS as administrator.

@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 1.0.0.0. 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.

@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: stackoverflow.com/questions/1247457/…

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

@user4843530 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.

@Dominic Isaia 2019-08-29 21:47:07

For me it was simply "Build"..."Clean Solution"

Related Questions

Sponsored Content

2 Answered Questions

[SOLVED] Breakpoints not hit, no symbols loaded

49 Answered Questions

13 Answered Questions

Sponsored Content