I know that this question has been asked several times, and many people here have suggested different answers. Though none of them are working for me.
I created a Windows Forms application with Visual Studio and .NET framework 4.0 and added a breakpoint. However, when I debug the application, an exclamation mark appears on the breakpoint and it says..
The breakpoint will not currently be hit. No executable code is associated with this line. Possible causes include: conditional compilation or compiler optimizations.
I have tried out several suggested solutions
Cleaned the project
Deleted the pdb
Checked the configuration and ensured that it is debug
Set the debug configuration from "x86" to "Any CPU"
Tried creating project from scratch
Tried re-installing .NET framework
Removed temporary ASP.NET files
However, none of them seems to be working. I was able to debug my projects with breakpoints before and for some reason, something happened and I am not able to debug the projects any more. What should I look out for or fix to resolve this issue?
Probably your breakpoint is in a project which is not dependent on the "startup project". Implicitly these projects are not compiled on Run (button F5).
Go to: menu Tools → Options → Project and Solutions → Build and Run → uncheck first check box (only build startup projects and dependencies on Run).
I recently had this problem and it stumped me for a while. Ends up I had inadvertently switched my build configuration away from DEBUG to another configuration that was more optimized and did not "Define DEBUG constant": Project > Properties > Build > (first check box).
This may also happen if other projects in your solution are set to configurations other than DEBUG, usually accidentally, in the Solution Configuration Manager.
In Visual Studio go to the menubar, menu Debug → Windows → Modules, find the assembly your code is located in and check the Symbol state. Chances are you're having Visual Studio loading a different version not matching your PDB files.
I had the same problem here...
I was using Visual Studio 2005 - Professional Edition, and my problem was when I tried to breakpoint a Windows Forms application.
I've searched in many forums on the Internet, and I hadn't found any answer.
But the solution for this problem was easier than I had expected. Just right click on a Visual Studio shortcut (or .exe) and unmark execute in compatibility mode.
Your best option is to create a new project. Then import all the files in the previous project, including your forms if any.
You are now set to OK to continue.
Related
I have a multi-project solution that I was building in Visual Studio 2013 and it was working fine but now that I have upgraded to Visual Studio 2015 I can no longer hit break points in debug mode for any project exect the main project selected as the Startup project in the Project Properties page. I used to be able to click on the other projects and just choose Debug -> Start New Instance. I am getting the error The breakpoint will not currently be hit. No symbols have been loaded for this document. I have tried a lot of things found on Google including:
Clean/Rebuild
Delete the OBJ and BIN folder form the projects
Did VS repair
Rebooted
Uninstalled/Reinstalled
Confirmed Define DEBUG constraint is enabled for Properties -> Build
Confirmed Optimize Code is unchecked for Properties -> Build
Confirmed Properties -> Build => Platform target was set to Any CPU for all projects
Tried running VS using "Run as Administrator"
Deleted all the files in /AppData/Local/Temp/Temporary ASP.Net Files/
Made sure Debug -> Attack to Process -> Select had "Automatically determine the type of code to debug" was selected
Made sure the Properties -> Web -> Debuggerts had ASP.Net checked (my properties has ASP.NEt and Enable Edit and Continue Checked, Natvie Code SQL Server and Silverlight unchecked)
Confirmed Target framework in Properties -> Application was set to the same version (4.6) as in the Web.Config/App.Config files.
So what am I missing here? Why can I no longer debug the other projects?
I had a similar problem, when I created a new build configuration. After hunting around settings in VS2015, I noticed that there were no *.pdb files in my build output. Obviously, debugging would not work if there were *.pdb files.
The fix for me was to go into every project's properties -> 'build' page -> click the "advanced" button at the bottom of the page -> In the dialog's 'Output' section, I set "debug info" to equal "full".
Basically, I created a new solution and project and copied all the build properties into the solution that the debugger was not stopping at break points anymore. In addition to the setting above, I also changed the following setting to match the default debug settings:
I set on the same advanced page "Internal Compiler Error Reporting" to "prompt"
In the main 'build' page, I checked in the 'general' section "Define DEBUG constant" and "Define TRACE constant"
I solved this problem when checked Options->Debugging->General->Suppress jit optimization on module load. Before I did that I have also unchecked Tools->Options "Projects and Solutions" "Build and Run" "Only build startup projects and dependencies on run". Don't know if that has any reason why it works after suppress jit is unchecked.
My situation was that I have enabled "Optimize code" in the project properties.
If you only hit breakpoints in the startup project:
Tools > Options > Projects and Solutions > Build and Run
Uncheck Only build startup projects and dependencies on Run
And here it is in German:
Running the VS command prompt as admin as running the command: devenv /setup fixed this for me.
I never figured out what happened but I ended up building a whole new project and just importing the files into it and everything works now.
This sent me insane, until I realised in another solution I set to release configuration, changing it back to debug worked.
This probably isn't your particular answer, but thought I would share it "just in case" someone else gets driven to distraction by something obvious!
The debugger wasn't hitting breakpoints for my ASP application after migrating from my old system to my new system. I forgot to configure in IIS for debugging.
To configure IIS for debugging:
Sites > MyWebsite
IIS > ASP > Debugging Properties
Set Enable Client-side Debugging to True
Set Enable Server-side Debugging to True
In my case I just changed the setting of my running mode.
Before, I used "release" running mode:
And now, I'm using "debug" running mode:
I just fixed this issue for one of our front end developers. It may or may not apply to you. We use IIS Express for local debugging, and somehow his had become detached from the correct process when debugging.
To fix, I checked what process ID it was attached to according to IIS Express (right click IIS icon on taskbar, select Show All Applications, check the PID listed for the application). I then attached it to the proper process (with the solution running in VS, click Debug on the toolbar, select attach to process, find the correct process using the PID gotten above from IIS Express). Hope this helps someone.
I was never able to get it to work with the above methods and finally rolled back to VS 2013 for the solution which worked fine. It is very upsetting that VS2015 feels much like VS2005 when it moved from the stable robust VS2003.
I hope 2017 resolves these inconsistencies.
You may leave everything as-is, just take care of the following:
Advanced Compiler Settings -> Generate debug info -> has to be either "pdb-only" or "full"
Advanced Compiler Settings -> Enable optimizations -> needs to be UNCHECKED
I was also facing this issue but after Visual Studio 2015 Update 1, its now fixed.
https://www.visualstudio.com/en-us/news/vs2015-update1-vs.aspx
Restarting Visual Studio worked for me.
I hope this helps anyone. If you are running code in your local machine under IIS, you need to attach your solution to the w3wp.exe process. So, select your project, on the menu go to debug->attach to process and in the list you should see w3wp.exe
Now, if you don't see w3wp.exe you might either select the show all processes checkbox, or go to your IIS Manager and browse your web site in order to actually run the w3wp.exe instance.
In my case I was unable to debug because I had breakpoint set in source control temporary file while analyzing file history instead of actual file in solution.
My project was an MVC web app, and when i was running the project with debugger, a new tab was opening in browser which was redirecting me to login page. But in another tab i had logged in user which could do anything, but it wasn't hitting the breakpoints, even though i was hard refreshing the page. And every time i was closing the newly opened tab that was redirecting to login page. Once, i closed old tab with logged in user and actually logged in to app again in the newly opened tab. Then it started to hit the break points.
uninstalling postsharp nuget solved my problem, it is explained in this post https://doc.postsharp.net/uninstalling
My breakpoints aren't getting hit in Xamarin Studio. I'm not sure if this has to do with my code, or not, but I feel as though it doesn't because I've tried over and over putting breakpoints all over my project (in places where I know they should definitely be hit, and in places that the code works perfectly and is completely unrelated to the feature I'm currently testing) and none of them are getting acknowledged when I debug. I don't have the breakpoints disabled, and I don't have them added in the wrong place. The breakpoints should work normally, and they're not. I'll also add that I'm not allowed to pause my application during the debugging process. I suppose you could say the debugger in my Xamarin Studio isn't working and I have no idea why. I believe I've determined it's unrelated to the code, but I can't be sure about that still. Please help. Thank you.
It is the most popular question about: "breakpoints are not being hit in xamarin" in google, so after whole day of trial and error I am gonna post here a solution for this problem for xamarin versions > 4.0.0.xxx. Yes, sadly this is simple.
SOLUTION
(This solution is for android app in visual studio, but should work in xamarin studio as well)
Remove all symbols from the path to your "Debug" Folder (usually: [path to your .sln file] \ [your solution name] \bin\Debug):
So if you got for example:
G:\My Files\Programming\C# (+ JS)\Test1\Examples\LINQ to Objects\AndroidDemo\AndroidDemo\bin\Debug
Change it to:
G:\My Files\Programming\CSharp\Test1\Examples\LINQ to Objects\AndroidDemo\AndroidDemo\bin\Debug
For me "(" and ")" symbols were causing the trouble (Who is using such symbols in the path anyway right?)
To verify that this is working, open your debug folder, in VIsual Studio Select "Clean Solution", "Recompile Solution", "Deploy".
"Deploy" action should generate *.mdb files which include your debugging data. If they are present, you should now be able to stop at breakpoints.
Now you can simply hit F5 like usual whenever you need to debug something.
I'm not sure if someone is still following this thread, but this workaround worked for me.
The problem sometimes has to do with the mono 5.
So the resolution is to use older version of mono:
Set "Project > Active Runtime" to "Mono 4.8.0 (8f6d0f6) (/Library/Frameworks/Mono.framework/Versions/4.8.0)".
for Mac users, change it in "Preferences" -> ".NET Runtimes"
Then Rebuild the Android app project.
Deleting the BIN folders and any *.SUO file is a favorite fix for this issue.
Can also try deleting any *.csproj.user
In worst case, reset VS Settings by launching (Run) with "Devenv.exe /ResetSettings"
Make sure you have your build configuration set to Debug.
Make sure your project's build settings are set to allow emitting DEBUG symbols for your Debug configuration.
Clean and Rebuild your solution/project.
Close and restart Xamarin Studio.
Reboot your computer.
Sometimes the build configurations for your solution can get complicated, and it's easy to miss something when building a complex build configuration. Make sure everything is setup properly in there.
I encountered this yesterday, using VS 2013 and Xamarin plugin. "All of a sudden" breakpoints in a PCL project were not active, even though breakpoints in an Android project still were. Everything had been working perfectly for weeks, and I had applied no updates. Looking at the VS Debug | Windows | Modules view, I could see that symbols were not loaded for the PCL assembly, and nothing I tried would force them to load, even though they were present in the folder with the running assemblies.
Then I remembered that the last thing I had done the prior day was not related to code, but was a bit of refactoring of csproj files to support a parameterized Jenkins build. I had placed an OutputPath definition in the first "shared" PropertyGroup, and removed it from all of the Configuration/Platform-specific PropertyGroups, e.g.:
<OutputPath>bin\$(Configuration)\</OutputPath>
I deleted this "common" OutputPath and put it back into each specific PropertyGroup (offending my DRY sensibilities, mind you), and things started working again.
This is probably not going to bite very many people, but it wasted a couple of my hours, so hopefully it spares someone else. The Xamarin build probably does some of its MSBuild/xbuild spelunking with strong expectations, so if you've modified your csproj files for a build process, this might be a possible culprit.
I add this answer because this is the only one that worked for me, in Project Properties > Build I wrongly checked Optimize Code.
Unchecking this box solved the issue.
I switched from stable to alpha Channel v.3.11.785 (Alpha). all breakpoints are now hit.
I faced this problem in Xamarin Forms app using Visual Studio for Mac. In my case, it was happened because of debugger. Visual studio was continuously showing "Waiting for the debugger to connect to the iOS simulator..." while running in an iOS simulator. I did reset the simulator (Hardware => Erase All Content and Settings) and cleaned up the solution. Then I could do the debugging with breakpoints. Hope this helps someone.
I had the same problem.
THE CAUSE (IMO):
In my case the problem is caused by Xamarin Studio (but with VS2013 is the same) build/rebuild process.
More in details, the *.mdb files are not correctly regenerated and therefore the debugger does not work properly.
You can check by doing a solution clean and going to bin/debug folder: if you still see *.mdf files then that's the problem in your case too!
SOLUTION
The only solution that works well is to manually delete all *.mdb files in bin/debug from all projects in your solution (so Android project and all PCL projects) and then do a Rebuild.
Let me know if this helps!
For me "(" and ")" symbols were also causing the trouble, I was searching for weeks for this problem. Remove the "(" and ")" in the full path, do a clean build and de breakpoints are hit again.
In my case, xamarin was not hitting any breakpoint. Red color rings were shown instead of filled red circles, because there were some syntax errors not able to be pointed out by xamarin, since I think solution build was not up to date, even I was able to run the app surprisingly. So I cleaned and build the solution, and it pointed out errors and relevant warnings after that. I fixed those, and ran the project. I was able to debug successfully after that!
If once the project launches on the device VS reverts to the standard editing mode (no debug options enabled in the menu) i.e. the debugger is not attached; check Project Properties > Android Options > Enable developer instrumentation is checked. For me the setting was disabled (most likely checked into source control after a release).
Use "Visual Studio for Mac" (Preview at the moment but works) instead of "Xamarin Studio". This fixed the problem for me. Breakpoints are working even in my PCL projects! Another thing... I had to change "project.json" (JSON format) to "packages.config" (XML format) when changing from "Xamarin Studio" to "Visual Studio for Mac".
I'm getting the subject error for breakpoints set on a vs 2010 website project.
When I view the modules window under Debug-->Windows-->Modules I see that it cannot find or open the PDB file for WebDev.WebHost40.dll -- it skips loading symbols for all other dlls. I tried to fix this by using Tools-->Options-->Debugging-->Symbols and checking Microsoft Symbol Servers, this fixed the cannot load symbols message in the module window, but it still wont debug and gives the same error message. I've also tried deleting the temp Visual Studio files, rebuilt the project, closed and re-opened visual studio, and also rebooted machine. Any other suggestions? Has my project perhaps been corrupted and I start fresh with a new project?
Thanks
A few things to check - in Visual studio - right click the project and go to the build tab. Make sure you are running under debug mode. Also check the debugging settings and target platform are OK. There are also adanced build settings worth checking in this tab. You mention that the pdb file isnt being created? If it is, try deleting it and then it will be recreated by VS. If it isn't there is something wrong with the build settings. I would try some changes in the build tab to see what works.
Try creating a brand new solution, if you can debug that then there's something wrong with one of your projects. You then need to work out what's different between the working project and the broken one.
If you can't debug a new project either, then at least you know it's not your project, and time to reinstall VS (boo).
When I hover my mouse over a variable when debugging a C# app in Visual Studio nothing popups. I expect to see the value of the variable (aka datatips). I'm running Visual Studio 2012 Ultimate (trial edition) on Windows 7 64bit. Does anyone know what may prevent them from showing?
Things I've tried to no avail:
- Reinstall VS
- Search for an enable/disable setting but there doesn't seem to be one
I can see the datatips correctly with the same C# project on Windows 8/64bit with the same version of Visual Studio.
THis helped me: you need to open in VS Tools | Options | Debugger | General and enable the flag [Use Managed Compatibility Mode].
Before running the application check you are running it in Debug mode. If set to Release mode change it to Debug and then run. The debugger will then provide the data-tips.
I have found this solutions:
reinstall Visual Studio as advised here, but you have already tried it
Open your VS->Tools->Import and Export Settings Wizard->Reset all settings->No, just reset settings, overwriting my current settings-> Choose a Default Collection of Settings from MSDN Forum: Debugging - hover watch has stopped working
maybe you have Release build configuration
set Code Optimization property to Disabled under Project property windows
as advised in similar question on SO
I had this problem so I deleted all the *.suo and *.user files I could find in the solution directory and that seemed to fix it.
I had this same problem. My project had somehow gone into Release mode, so I changed it back to Debug mode via Build|Configuration Manager and it was working again, the datatips reappeared.
I realize this is an older post. But I have the exact problem in Visual Studio 2019. The funny thing is that datatips are not showing on my external screens. But if I drag Visual Studio to my laptop screen, it shows without problems. Dragging it back to one of the two external screens and it won't show.
I also have a problem that the Project Properties and Team/Source Control Explorer does not show anything but white content until I switch to another tab and then back. Then it loads. I have tried enabling GPU support in Windows, but nothing.
Has anyone had the same experience?
I will of course try all of the suggestions for the datatips thing, as that's really decreasing my effectivity.
The same happened to me but only with C#, active mode administered compatibility (Managed Compatibility Mode) and it worked well, then I wanted to modify the code while had debugged and came out a motioning message
compatibility mode administered is not supports edit and continue
Then turn it off again, under native support is (Use the legacy C# and VB expression evaluators) enable this option and you can see the value of objects and edit code debugging.
Try deleting the .vs directory and restarting visual studio.
This 3 combinations solved it for me.
- Make sure you are in Debug mode
- Uncheck/Disable Use the legacy C#,VB.NET evaluator (Tools->Options->Debugger)
- Make sure Enable Just My Code is checked.
Using remote debugging on another machine makes it more challenging.
This thread talks about RPC Server being unavailable when using "Use Managed Compatibility Mode", which makes remote debug impossible with Managed Compatibility Mode
Remote Debugging not working. "Unable to attach to process. The RPC server is not available."
Native compatibility had the same effect.
It was only "Use legacy C# and VB expression evaluators" that allowed hover over variables AND remote debugging in my case.
I deleted the project and re-cloned it from git, then it worked. None of the other solutions worked for me.
I ended up with resetting VS Settings to make this work:
Ok, I'm not exactly sure why my Visual Studio 2019 v16.8.2 was not showing the data tips popup whenever I hover over the variables when I'm debugging. FYI, I am using a project that was created on another machine with the same version of Visual Studio. I got it fixed by doing the following steps.
Load up the project and set it to release build.
Visit Tools -> Options -> Use Managed Compatibility Code, set it to enabled. Close the Options menu.
Remove any breakpoints in your code.
Run the project in Release build mode, instead of Debug mode.
Let the program run for 5 seconds and then click red square that STOPS the debugging running program.
Open up the Options again and change the 'Use Managed Compatibility Code' back to disabled(uncheck it). Close Options.
Add some breakpoints and set the run mode back to 'Debug' mode and click Play to debug the program as per normal usage.
Doing these steps in this order solved the problem for me. I'm not exactly sure which steps solve the problem but somehow in doing the preceding list of things, it's now fixed. A reinstall of VS 2019 didn't help.
UPDATE: After going back to my project and attempting to debug, it appears it's back to not working again. I tried the above steps and that only fixes the problem for the first iteration of the loop I'm working in. It appears when the code is working, then the next iteration through the loop and when it comes to my breakpoints, they are no longer showing the little popup window that allows you to inspect the variable data. So doing the above-mentioned steps only solves the problem for the first time the breakpoints are hit.
P.S. I'm using two instances of Visual Studio 2019 and am recreating one of my older apps so that it is up to date. I'm not sure if this has anything to do with the datatip's not showing up when mouse hovers over the variables or not.
I updated the package of RestSharp, and my problem solved. Packages with warning icon on it can cause this problem.
drop this into .csproj of your project (first propertygroup).
<DebugEngines>{351668CC-8477-4fbf-BFE3-5F1006E4DB1F}</DebugEngines>
It's basically as adding for your project manually that it uses compatibility managed mode, since in vs2022 this option does not exist in options.
For me, this worked on Microsoft Visual Studio Community 2017, Version 15.9.9:
If you are facing this issue simply uninstall the current version and reinstall VS. After installing and running debugging mode first time, please choose "Disable Just My code and Continue" selection,it should work.(as shown in the attached screen shot).
If you do not want to uninstall and then re-install visual studio,then try these settings on the existing VS installation:
Go to: Options => Import and Export Settings ==>Reset All Settings==>No Just reset settings,overwrite my current settings =>Finish
after this simply start debugging and choose "Disable Just My code and Continue" option.
3.If you are still having problem,please also make sure by going to project =>properties ==> Configurations that you have configurations set to debug(sometimes configurations are set to release)
Go to Tools=>options =>Debugging ==> General ==> select Suppress JIT optimization on module load
Full Story
Typically, when I install Visual C# 2010 Express, the first thing that I do is switch to Expert Settings. That gives me access to build configurations, and the respective manager. This most recent installation seems to be misbehaving.
The first project that I created was an XNA 4.0 (Refresh) project. I imported some old code, switched to Expert Settings, and confirmed that I was able to access both the build configuration manager and the build configuration toolbar. However, when I opened the project properties and switched to the Build tab, the normal Configuration and Platform dropdowns were nowhere to be found. Additionally, the Release settings were clearly in use, even though Debug was selected as active in the toolbar/manager.
I tried everything from restarting Visual Studio to manually editing the .csproj XML--which, by the way, marked Debug as the active configuration: not Release. Interestingly, no matter what the order of the build configurations, if Release was present, that would be the configuration actually active in project properties (not selected from the dropdown in the toolbar). Remember, the dropdowns that usually appear on the project properties pages aren't present, for some reason.
Having no luck, I created two fresh projects in a separate solution: a console application and a WinForms application. This time, the build configuration manager wasn't even present in the Build menu, and the dropdowns in the toolbar were disabled, as if I didn't even have a solution open.
I've searched and searched, but I cannot find an explanation--or a solution--for this behavior.
Note: I do have access to Visual Studio 2010 through MSDN, so upgrading is a viable solution, if necessary.
tl;dr
Yes, I've switched to Expert Settings.
Windows 8 Pro, up-to-date
Fresh-ish Visual C# 2010 Express installation
XNA 4.0 Refresh
Problems
New XNA project:
Switching build configurations has no effect on actual configuration; it is always stuck on Release, despite saying otherwise.
In project properties -> Build, dropdowns for build configuration/platform aren't present.
New console/WinForms project:
Build Configuration Manager isn't in Build menu.
Build configuration toolbar has dropdowns disabled, and nothing is selected.
Already Attempted
Delete Release configuration
Effect: Switches to Debug
Recreate Release configuration
Effect: Switches to Debug upon deletion, then back to Release upon recreation
Fiddle with .csproj XML in text editor
Effect: None; looked fine to begin with
Recreate all configurations
Effect: Always lands on Release
Restart Visual C# Express 2010
Effect: None
Fiddle with settings
Effect: None
Reload project
Effect: None
Open menu: Tools -> Options...
Select Projects and Solutions
Check Show advanced build configurations
I don't recall needing to enable this in the past, though I did always have to switch to Expert Settings. Then again, I've been using Visual Studio 2012 for a while now, so I might just have forgotten. I also rarely used Express, so this might be a discrepancy between Express and full versions.