Visual Studio 2012 unable to hit a breakpoint - c#

I have code written in C#. I don't know why but Visual Studio 2012 is not hitting a break point in an of the solutions that I have. I have tried following solutions:
Deleting the .pdb files.
Clean, build again.
Restart Visual Studio/Computer.
Deleting the bin folder and build again.
Check the debug settings against someone's for whom its working.
I took the whole code again from our central server. But none of it is working.
What could be the issue?

Verify that if you are building the code in Release Mode instead of Debug mode.
Check your standard toolbar and select Debug.

Related

change output path of MVC x64 project

Ever since I've changed my MVC 4 project output path,
any changes I make to my Controller are not reflected.
When I try to debug my Controller with a breakpoint, it doesn't hit and I get
The breakpoint will not currently be hit. The source code is different from the original version.
I'm using Visual Studio 2015
UPDATE
So I've deleted the old bin folder and re-run the application. I've got the following error
I've followed the solution suggested in this post and now I get
Any ideas?
Whenever I encounter issues like this, I do the following:
close Visual Studio
stop the IIS webapp/website (if not running on IIS Express)
delete bin and obj folders
start Visual Studio
rebuild
This usually helps with all kinds of issues that sometimes occur.
It seems that there's two different version of binaries at your project. By deleting the binaries, you might find out what the real issue is.

Breakpoints not getting hit in Xamarin Studio

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".

breakpoint will not be hit no symbols have been loaded for vs website

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).

Unable to hit the breakpoints after attaching the Microsoft Word process while debugging in Visual Studio 2013

We have a C# application which communicates with Microsoft Word. We have recently migrated from Visual Studio 2008 to 2013. While debugging we have to attach the Word process in order to hit the break points. We are not able to hit the breakpoints even after attaching the Word process in VS 2013. Kindly help us on this.
Thanks.
This might help you:
Open Task Manager and try ending the process for any copy of WinWord.exe.
Open a Windows Explorer. Navigate to C:\Users\Local Settings..\AssemblyCache
If you don't see AssemblyCache, Organize > Folder and search options > View > uncheck "Hide protected operating system files (recommended)"
In the directories in AssemblyCache, look for the one containing your .dll.
Delete the .dll.
Rebuild the project and debug. Once your add in activates you should see the cache contents get refreshed.
If desired, re-hide the protected OS files.
I referred folowing link:
https://gis.stackexchange.com/questions/13606/why-cant-the-breakpoint-be-hit-when-debugging-an-arcgis-10-add-in
Not sure if this works for VS2013 too. Please try it out. All the best.

How to enable Edit and Continue in Visual Studio

I was using Visual Studio 2010 Express for a project and recently changed over to ultimate 2010. I am noticing that when I would debug in express I could put a break point, edit the code if needed and continue without having to recompile.
With VS 2010 ultimate it tells me the version has changed and i have to stop and restart. How do i get the functionality that express had in ultimate?
Thanks for the help.
EDIT: More specifically, here is the message i get:
"This source file has changed. It no longer matches the versio nof the file used to build the application being debugged".
You have to enable 'Edit & Continue' both in the debug menu (should be on by default. check by going to debug > options+settings) and possibly again in the specific project if it's a web project of some sort. It should be a checkbox there.
edit: it's been a bit since i've tried it, but as far as i recall, that's the how. i'll see if i can grab you a link.

Categories

Resources