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

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

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

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

@DiSaSteR 2017-07-24 10:58:15

It is also worth to mention that in some situations the problem occurs, because the project you want to debug is an external service. In that case you have to attach debugger to the running process.

@clamum 2017-07-11 14:10:38

I was getting this and was stumped (using Visual Studio 2013 Premium).

Normally our apps at work reference .dlls in a particular common/app directory, like this: C:\OurCompanyApps\xxxxxx.dll. This was happening in a solution that has a bunch of WinForm and .dll projects in it. The .dll projects compile to C:\OurCompanyApps\ and the WinForm projects reference the compiled .dll files in that location.

The problem: I found that the app in question was referencing the .dll project in the Source Control bin\Debug location instead of the compiled .dll file in C:\OurCompanyApps.

Solution: I deleted the reference and re-added it from the C:\OurCompanyApps\ location. Then I could step-through the breakpoints I had added in the .dll code.

Hope this helps someone.

@Christian Gollhardt 2017-06-06 04:04:20

Webapplications (IIS Express) only:

  • Rightclick IIS Express Tray and close the IIS.
  • Clean Solution

IIS Tray

@Hans Passant 2010-01-28 16:18:08

Start debugging, as soon as you've arrived at a breakpoint or used Debug > Break All, use Debug > Windows > Modules. You'll see a list of all the assemblies that are loaded into the process. Locate the one you want to get debug info for. Right-click it and select Symbol Load Information. You'll get a dialog that lists all the directories where it looked for the .pdb file for the assembly. Verify that list against the actual .pdb location. Make sure it doesn't find an old one.

In normal projects, the assembly and its .pdb file should always have been copied by the IDE into the same folder as your .exe. The bin\Debug folder of your project. Make sure you remove one from the GAC if you've been playing with it.

@Instance Hunter 2010-01-28 16:37:22

This did enable me to ensure it was loading correctly in VS 2010 beta. What made it start working is entirely beyond me, but I will give you the answer since I think this would've worked if it hadn't started working arbitrarily.

@eglasius 2011-05-12 18:36:51

+1 @Daniel definitely right giving the answer to this. Having a similar issue, and this is the right place to look for it / it tells me very clearly the dll I was trying to load has no symbol loaded & it didn't even try to look for symbols. In short, it gives you the right info to continue figuring out the problem.

@eglasius 2011-05-12 18:44:36

This is interesting, when your own assembly is not "User Code", it coming from a regular project reference ... surely 'Just My Code' is making it to not even try to load it, now the mystery is why it would think it's not user code.

@eglasius 2011-05-12 18:58:58

Effectively, that was the issue on my case. We had a postcompile that made it to not be considered 'User Code' ... now, I have to see what's up with that, but I do confirmed that without the postcompile modifications, the symbols are loaded. @Hans thank you, saved me some good minutes! sends a virtual beer

@Nicolas Raoul 2012-09-21 08:56:38

The question is about express edition, to which this answer does not apply, unfortunately. Actually none of the answers work for me, I also tried removing the Debug folder and rebuilding.

@Thibault D. 2013-05-21 07:12:38

I'm new to Visual Studio and didn't get one word of what you are mentioning here... But I'm sure it works...

@Don Thomas Boyle 2013-09-23 13:16:57

Very nice this works to figure out how and what files don't have symbol File's loaded, however, how would one figure out what symbol file to attach? if that's what you would call it.

@Andrus 2014-03-05 18:14:44

Microsoft Visual Studio Express 2013 for Web does not have Debug Windows Modules option. Howo to use fix this in this case ?

@Andy Danger Gagne 2014-03-10 14:59:07

As a hint, turn on your exceptions so it breaks where you want it to (if you are unable to put a break-point in the beginning of the process)... You then follow Han's recommended process of Debug > Windows > Modules. Look for the project you were trying to step into and look at the PATH. if it says "C:\windows\assembly" then its pointing to a GAC dll and NOT the project...

@eddie_cat 2014-07-01 20:44:30

I love you so much for this. As soon as I went to Symbol Information, I just hit Load All Symbols and now the breakpoints are being hit. I don't understand it but I'm awful happy.

@Prageeth godage 2014-08-14 19:38:10

In visual studio command prompt type >gacutil /i (yourdll name).dll

@Prageeth godage 2015-03-20 09:47:36

sometime you need to find the project (not the solution) obj/Debug/*.pdb file remove it and rebuild it works for me.

@Khurram 2015-05-06 08:00:05

It was unable to find pdb file of project, i deleted obj folder of the project and then built.. it worked out. Thanks

@gilad 2015-07-12 10:45:23

i had my solution's active solution configuration set to Release , changing it back to Debug solve my problem. This answer helped me "remember" what to look for

@CSS 2016-01-09 00:21:05

When I go to the debug -> break all, I get a window that says "No Source Available". This doesn't seem helpful. Any ideas? It was connecting just fine a couple hours ago and showing me the breaks and giving me variables in the Locals subtab.

@CoffeeSipper 2016-02-17 07:42:52

For those who couldn't understand "Start debugging, Debug + Windows + Modules". In simple words, place a breakpoint elsewhere in the application(not in the current file that you have made changes) and make it hit there. Then navigate to menu Debug>Windows>Modules (only available for paid versions and community edition). Rest is same as explained by @Hans Passant.

@T.E.D. 2016-03-18 22:51:35

It doesn't look like this works if the DLL is loaded at runtime with LoadLibrary().

@Hans Passant 2016-03-18 23:13:34

You must of course enable unmanaged debugging to see such DLLs back in the Modules list.

@Beginner 2016-05-18 17:04:42

"In normal projects, the assembly and its .pdb file should always have been copied by the IDE into the same folder" is really important point in this answer. In my case the .pbd and .dll were not getting copied into required folder that is why while debugging by attaching to w3wp.exe process, It was showing this message. So it is worth checking the .pdb and .dll in folder.

@Ryan Bennett 2016-08-25 20:26:20

Only took me ten years to google this answer...

@Yairt 2016-09-05 04:51:11

Experienced this issue in VS2015 and after looking in Debug -> Windows -> Modules found that my DLL's are for some reason excluded from 'Automatically load symbols' (do not remember ever excluding them), after they were removed from the excluded list the breakpoints started to work

@476rick 2016-09-19 14:17:07

Visual Studio 2015 Professional doesn't have the option Modules in Debug -> Windows...

@Jerry Xue 2016-12-12 06:34:06

Thanks! very useful. basically start debugger first, then from Debug -> Windows -> Modules, find the module you want to debug, right click, and select Load Symbols. You will see the User Code column for that module changed from No to Yes

@Lenny K 2017-01-24 17:12:07

Looking at the modules and assembly info helped me realize that I already had this application installed and it was loading that DLL instead of the one from my project. After uninstalling the old app, the issue was resolved for me. Thanks!

@frostymarvelous 2017-04-01 20:08:51

In my case, I had forgotten to change from Release to Debug, innocuous enough. But I wasted enough time.

@AminM 2017-06-06 17:11:57

Cannot find or open the PDB file. ?????

@Phil Teare 2017-10-11 17:09:31

I've gone to "Symbol Load Information" and it's looking in the wrong place for the PDB file (it gives this info: "C:\Windows\System32\inetsrv\CDS.Web.pdb: Cannot find or open the PDB file.") How can I change that to look in the debug/bin folder instead? Thanks

@n4esa 2018-01-27 00:24:06

This is going to sound crazy but for me nothing here worked, until I realized I was testing some angular code and had my 'startup' page set to an html file, soon as I set it to an aspx page the symbols loaded

@jimboweb 2018-05-18 20:56:01

I am trying to do this. But when I go to Debug > Windows > Modules I can't see the dll for my program to load them. In the Process Explorer window there are two options: chrome.exe (or iexplore.exe if I'm viewing it in explorer) and neither of them has the dll of the app I'm running. I've tried using Debug > Attach to process but I can't find my app in there either. How can I find my app so I can load my symbols?

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

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 .

@Mark Longmire 2019-02-04 15:46:57

In my case, The "Automatic symbol loading preference" was set to "Load only specified modules". Changed back to "Load all modules, unless excluded", and that enabled all breakpoints. Thanks for the hint to get to this setting. To get the setting quickly(VS2017), Debug\Options->Debugging.Symbols

@Paul Zahra 2017-05-18 09:14:13

Will put this here in the hope that it helps someone.

I had the missing symbols issue with regards to a web service.

The daft solution was that the setup project was not set to build when the solution was built, which meant that when I right clicked the setup project and installed the service, then attached to the process; the same out of date service was being installed without the pdb because it didn't match = no working breakpoints.

The manual solution was to right click the setup project and build it, then install from it. I then altered the solution project build list to include the setup project when the solution is built in debug mode.

Related Questions

Sponsored Content

49 Answered Questions

13 Answered Questions

1 Answered Questions

[SOLVED] Breakpoints not hit, no symbols loaded

Sponsored Content