10

I have solution with 3 projects. Project one - Library. Project two - Service (asmx). Project three - Test. In my service I have two config transform: PRODUCTION and TEST. They are equals, but name of databases is different. My solution:

Solution

If I Debug Test with PRODUCTION.config then all right - my breakpoints is active. If I Debug Test with TEST.config then bad. I get this:

The breakpoint will not currently be hit

What could be the problem? Sorry for my English.

Denis Bubnov
  • 2,619
  • 5
  • 30
  • 54
  • see this question below, it looks like he had same problem: http://stackoverflow.com/a/2155997/6165165 – Nikoloz Akhvlediani Apr 06 '16 at 08:42
  • @NikolozAkhvlediani, thanks! Answer of *juFo* is worked! – Denis Bubnov Apr 06 '16 at 09:05
  • I know its an old question but for me still closing visual studio and starting it again solves it :D – vibs2006 Jun 05 '19 at 13:27
  • @vibs2006 yep, it's an old question How I remember restart did not solve my problem – Denis Bubnov Jun 05 '19 at 13:35
  • I had the same problem when publishing the app as "self contained"/ "single file". Attach to process doesn't work in this case. If anyone is still struggling with this when publishing as "self contained" application - you have to publish as "framework dependent" to be able to attach the debugger remotely. – Kris Feb 11 '22 at 14:15

13 Answers13

24

Fixing:

  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. Click the Advanced button at the bottom of the Build tabpage
  6. Make sure that Debug Info: is set to Full
  7. Click OK and save changes
  8. Clean solution and rebuild the project

Link to source Fixing “The breakpoint will not currently be hit. No symbols have been loaded for this document.”.

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


For more information see next screenshots. Build settings:

Build options

Advanced settings of build:

Advanced build settings

Checked for Microsoft Visual Studio Enterprise 2015 and Microsoft Visual Studio Professional 2017.

Denis Bubnov
  • 2,619
  • 5
  • 30
  • 54
  • 3
    This works. In my case they were already set, so I changed "Debug Info" from "Full" to "None", clicked OK, then went back in and changed it back to "Full". That must have reset something because it works fine now. – Patrick Oct 31 '18 at 16:21
  • @DenisBubnov Unable to see `Define DEBUG constant` option – Prashant Pimpale Aug 09 '19 at 10:30
  • @PrashantPimpale please see my answer. It was updated. – Denis Bubnov Aug 09 '19 at 10:59
  • 1
    @Patrick 's suggestion to change "Debug Info" from "Full" to "None", click OK, and then to switch it back to "Full" again solved the issue for me on Visual Studio 2019. – dwymark Feb 14 '22 at 21:23
20

I had similar issue and I did the following simply:

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

Uncheck this one. This worked for me.

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263
5

Another reason this can happen is that if you are sharing multiple projects between solutions and you have set up custom build configurations then simply changing from release to debug on the toolbar (or other shortcuts) can mess up the active build configuration and create all sorts of random consequences.

Make sure that Solution > Properties > Active Config is what you expect ('Mixed' is usually bad) and use Solution > Configuration Manager if in doubt.

I forgot again and the tactics popular on the intertubes did not, of course, work so this is partly a note to self...

saminpa
  • 603
  • 1
  • 7
  • 13
2

Require source files to exactly match the original version

This has to be unchecked.

enter image description here

jainashish
  • 4,702
  • 5
  • 37
  • 48
Ram
  • 29
  • 1
2

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)

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

tayfun Kılıç
  • 2,042
  • 1
  • 14
  • 11
1

As a future reference, the same issue can happen when you have the same assembly both in GAC and bin\Debug folder. Just deleting the assembly from the GAC and it works again.

ilCosmico
  • 1,319
  • 15
  • 26
1

If you're doing multiple startup projects, make sure you have all your services your want to debug set to Start

Solution Properties > Startup

David
  • 3,488
  • 2
  • 21
  • 21
0

Try adding or updating your .csproj file with the tag <DebugType>full</DebugType> inside <PropertyGroup>. This solved my problem.

ndmeiri
  • 4,979
  • 12
  • 37
  • 45
0

I am using a solution with several projects (Visual Studio 2015). In my case, the problem was solved when I realized that one of the projects was being defined with another URL in: Project properties - Web - Servers - Project Url. After changing to use the same URL as the other projects, the problem was solved.

Image

nandox
  • 81
  • 5
0

I am using a solution with several projects (Visual Studio 2015). I tried several approach. This one worked for me. In my case, the problem was solved when I realized that one of the projects was being defined with another URL in: Project properties - Web - Servers - Project Url. After changing to use the same URL as the other projects, the problem was solved.

Image

nandox
  • 81
  • 5
0

In my case the project under which the debug breakpoints were not getting hit was also referenced by another solution which was at the time running. When I stopped that solution the breakpoints started hitting.

Saumil
  • 2,521
  • 5
  • 32
  • 54
0

If the library happens to be c++ with a C# consumer project actually doing the calling into it, you need to go to Properties -> Enable Native Debugging in the consumer project, and make sure this box is checked.

0

This can happen if you haven't set the current project as the startup project. In the solution explorer navigate to your project right click and select set as startup project.