Reputation: 60691
How do I get my breakpoints working?
I am getting this message when running a C# console app in debug mode:
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:
Here are my settings for the projects:
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:
How do I get my breakpoints working?
Upvotes: 7
Views: 1819
Reputation: 2331
My solution was to click on that button which is to the left of the device button,
And I selected edit scheme from the drop down menu
I then selected Run from the list on the left of the pop-up, and checked the box "debug executable" (it was unchecked previously)
Upvotes: 0
Reputation: 114
I just created new console app + class library. Please be sure that console app has reference on class library (like on image)
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: 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:
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):
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:
If you have BAD refence (on a .dll file):
than delete that reference via context menu in VS and add a correct one.
I hope that will help you.
Upvotes: 2
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
Reputation: 11720
With anomalies like this it is well worth cleaning the solution (including manually deleting bin and obj folders then rebooting.
Upvotes: -1
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.
If I think of others I will be post here.
Upvotes: 1
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
Reputation: 3880
I've had this problem in framework code before. Try this:
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
Reputation: 802
did you try unchecking the option Debugging > general > Require source file to exactly match the original version ?
Upvotes: 1
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
Reputation: 434
You have my sympathy for trying to fix this. When I compare settings with mine I find 2 differences in Debugging|General:
The first one may fix your problem.
Upvotes: 1
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