Alex Gordon
Alex Gordon

Reputation: 60691

symbols are created but debugging never stops at break point

How do I get my breakpoints working?

I am getting this message when running a C# console app in debug mode:

enter image description here

The breakpoint will not currently be hit. No symbols have been loaded for this document.

Here are other specs related to this issue:

Microsoft Visual Studio Professional 2015 Version 14.0.25123.00 Update 2 Microsoft .NET Framework Version 4.6.01055

Installed Version: Professional

ASP.NET and Web Tools 2015.1 (Beta8) 14.1.11106.0 ASP.NET and Web Tools 2015.1 (Beta8)

ASP.NET Web Frameworks and Tools 2012.2 4.1.41102.0 For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013 5.2.40314.0 For additional information, visit http://www.asp.net/

Code alignment 12.1 Code alignment helps you present your code beautifully, enhancing clarity and readability.

CodeMaid 10.1.93 CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, R, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.

Common Azure Tools 1.7 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

ConfigurationTransform 1.3 Automatically transform app.config during build process. Once the transformation is set, it will run on other build machines without the extension.

GitHub.VisualStudio 1.0 A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

JavaScript Language Service 2.0 JavaScript Language Service

JavaScript Project System 2.0 JavaScript Project System

JetBrains ReSharper Ultimate 10.0.2 Build 104.0.20151218.120627 JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2016 JetBrains, Inc.

Microsoft Azure Mobile Services Tools 1.4 Microsoft Azure Mobile Services Tools

Node.js Tools 1.1.31117.00 Adds support for developing and debugging Node.js apps in Visual Studio

Node.js Tools - Profiling 1.1.31117.00 Profiling support for Node.js projects.

NuGet Package Manager 3.4.3 NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

NuGet References 1.0 Save time by managing your NuGet references right from the Solution Explorer packages.config

PreEmptive Analytics Visualizer 1.2 Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools 14.0.60311.1 Microsoft SQL Server Data Tools

StyleCop 4.7 Provides source code style and consistency tools. See https://github.com/Visual-Stylecop/Visual-StyleCop for more details.

TypeScript 1.8.30.0 TypeScript tools for Visual Studio

Here are my debugging settings:

enter image description here enter image description here enter image description here enter image description here enter image description here

Here are my settings for the projects:

enter image description here enter image description here enter image description here

Here are the packages I am using:

 <package id="EntityFramework" version="6.1.3" targetFramework="net452" />
  <package id="log4net" version="2.0.3" targetFramework="net452" />
  <package id="Magnum" version="2.1.3" targetFramework="net452" />
  <package id="MassTransit" version="2.9.9" targetFramework="net452" />
  <package id="MassTransit.Log4Net" version="2.9.9" targetFramework="net452" />
  <package id="MassTransit.MSMQ" version="2.9.0" targetFramework="net452" />
  <package id="Newtonsoft.Json" version="6.0.6" targetFramework="net452" />

Other references not covered by nuget:

enter image description here

  1. The solution is made up of 2 projects: consoleProject, classLibraryProject.
  2. consoleProject references classLibraryProject.
  3. When going to debug->windows->Modules for classLibraryProject I am getting the message "Could not find or open the PDB file.
  4. When manually building the PDB for classLibraryProject and moving it into the bin\Debug for consoleProject, then I get a symbol status of "Symbols Loaded." **However, the breakpoints are not honored. **
  5. Yes, I am certain that the code is triggered because the side effects of the code are visible.

How do I get my breakpoints working?

Upvotes: 7

Views: 1819

Answers (11)

Sam
Sam

Reputation: 2331

My solution was to click on that button which is to the left of the device button,

enter image description here

And I selected edit scheme from the drop down menu

enter image description here

I then selected Run from the list on the left of the pop-up, and checked the box "debug executable" (it was unchecked previously)

enter image description here

Upvotes: 0

Artyom
Artyom

Reputation: 114

I just created new console app + class library. Please be sure that console app has reference on class library (like on image)

enter image description here

I wrote that because I don't see that on your screens.

Than plz right click on solution and select "properties..." You will see smth like that: enter image description here Check that configuration + platform are equal for your projects and that checkboxes 'Build' are both selected. If that checkboxes are selected then after 'clean build' of you solution you will see smth like that in the bin\Debug folder of colsole app:

enter image description here

Please notice that class library has 2 files (highlighted on screen): dll + pdb. In that case dll+pdb are in synchro state and your breakepoints will work in class library code.

If you have no pdb file for class library project after build than may be your reference on class library is NOT a reference on a VS project. Please check that you added reference correctly (like on image):

enter image description here

DO NOT reference on dll file of class library directly via 'Browse' dialog.

You can check that your console app refenced correctly on class library project - please open console app csproj file on edit and look on reference:

enter image description here

If you have BAD refence (on a .dll file):

enter image description here

than delete that reference via context menu in VS and add a correct one.

I hope that will help you.

Upvotes: 2

quest4truth
quest4truth

Reputation: 1140

I don't see where you are attaching to both processes. Visual Studio by default will only attach to the startup project. It appears that consoleProject is your startup project. After you start debugging consoleProject use the Debug menu and select "Attach to Process..." and choose the process corresponding to classLibraryProject. The breakpoints will now be available.

Ctl+Alt+P is the shortcut key for this.

Upvotes: 1

Brian Leeming
Brian Leeming

Reputation: 11720

With anomalies like this it is well worth cleaning the solution (including manually deleting bin and obj folders then rebooting.

Upvotes: -1

PeterS
PeterS

Reputation: 2944

Just thinking out loud, I have come across the following that has meant no debugging: These are general situations and not particular to any environment.

  • System running low on memory and so the JIT does not go into debugging mode. Increase where possible memory settings for the server.
  • Deployment is not replacing the old version somehow, bypass the build script and physically remove the artefact manually. Create a new artefact and deploy that also manually.
  • Build scripts are not overwritting old classes/binaries and these are being sourced from a maven style cache or other warehouse. Remove any references to these files and try again.
  • Classes are being built but these are not being wrapped up into the final object, again remove the final object and adjust the build script to remove this error.
  • Versioning (some servers) is not allowing the new artefact to be deployed, ensure the version is incremented per deploy and try again.
  • The server you are deploying on is not where you are connecting to per debug session, either wrong port or other listening issue. Stop the server to see if the session is indeed where you think it is.
  • Also from versioning, if your dated artefact is not in line with the server date - so an hour behind for example then it may not deploy again or the deployments will be erratic.

If I think of others I will be post here.

Upvotes: 1

dr. rAI
dr. rAI

Reputation: 1823

I had a problem just like this not too long ago ... and I am not really sure which of the things I performed actually solved the problem.

But what I can tell is that I found that (although the packages.config entries were looking ok) several (!) used libraries were not in the proper .net version (net461 in my case).

I used a tool called Target Framework Migrator to fix this. You can get it through Tools => extensions and updates => Online => Visual Studio Gallery

and then type Target Framework Migrator in the Search Field.

I do remember, that I also upgraded .Net to 4.6.1 during my attempts to fix the problem ... maybe you could try this too ... but in any case running the Target Framework Migrator for your own Libraries (and restarting VS 2015 on the way) is definitely worth a try.

Good luck!

Upvotes: 0

hoodaticus
hoodaticus

Reputation: 3880

I've had this problem in framework code before. Try this:

  1. Go to Debug -> Windows -> Breakpoints
  2. In the Breakpoint window, click New -> Break at Function
  3. Enter the fully-qualified method name.

That should at least get you a breakpoint at the start of the method that you can then step through.

Note that I always get an error message that tells me the breakpoint won't work when I use this technique. But it works anyway.

Note that I did have valid symbols loaded, so be sure to use your setup that tells you your symbols are loaded.

Upvotes: 1

Rajdeep
Rajdeep

Reputation: 802

did you try unchecking the option Debugging > general > Require source file to exactly match the original version ?

Upvotes: 1

bns
bns

Reputation: 384

There are different reasons why this could happen. I had the same problem and one of the possible solutions was to delete all .pdb and .idb files

Upvotes: 1

Dick Bos
Dick Bos

Reputation: 434

You have my sympathy for trying to fix this. When I compare settings with mine I find 2 differences in Debugging|General:

  1. check: Suppress JIT optimization on module load
  2. uncheck: Load dll exports

The first one may fix your problem.

Upvotes: 1

Matt Schley
Matt Schley

Reputation: 227

Make sure your configuration is set to Debug, not Release.

Try this if above is correct: Tools->Options->Debugging->Symbols and check "Microsoft Symbol Servers"

Upvotes: -1

Related Questions