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.

5
  • see this question below, it looks like he had same problem: stackoverflow.com/a/2155997/6165165 Apr 6, 2016 at 8:42
  • @NikolozAkhvlediani, thanks! Answer of juFo is worked! Apr 6, 2016 at 9:05
  • I know its an old question but for me still closing visual studio and starting it again solves it :D
    – vibs2006
    Jun 5, 2019 at 13:27
  • @vibs2006 yep, it's an old question 😊 How I remember restart did not solve my problem Jun 5, 2019 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.
    – Chris
    Feb 11, 2022 at 14:15

13 Answers 13

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.

4
  • 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, 2018 at 16:21
  • @DenisBubnov Unable to see Define DEBUG constant option Aug 9, 2019 at 10:30
  • @PrashantPimpale please see my answer. It was updated. Aug 9, 2019 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, 2022 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.

1
  • I tried many different solutions but this answer just solved it.
    – Jake
    Sep 3, 2020 at 8:59
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...

2
  • Thank you! Completely forgot about this!
    – ajwaka
    Apr 17, 2020 at 18:37
  • For me, I had to change Solution Platform from Auto to Mixed.
    – Bill Hoag
    Sep 14, 2021 at 15:04
2

Require source files to exactly match the original version

This has to be unchecked.

enter image description here

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

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.

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

0

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

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

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

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.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.