I am debugging an ASP page with visual studio 2013.
So, i set a breakpoint, the breakpoint gets hit, and the execution gets on hold.
Now, i just want to abort the current request stop executing the code for the current request (which is on hold as it had hit the breakpoint), without having to stop debugging and run again the project.
This seems too simple, yet i haven't figured out how to do it.
Let me explicity state that clicking "restart" is not what i need, as "restart" is just a shortcut to stop project and run again.
Based on our conversation in the comments, I am placing this as an answer.
What you are asking for is not part of the visual studio debugging process. unless you manually return from the request after the break point the process is going to continue running. When debugging you are just an observer of the process. Either the code kills the process via exception or returns from execution, or you kill the process externally.
It does not looks like what you are asking for is possible, and that is by design.
Related
I recently came across an issue I didn't realized before. The thing is that for instance: I want to delete an user and if a stop the debugging before the execution reaches that "delete" method, instead of stopping and NOT delete the user, it does delete user anyways.
Any bug related? What should I do?
Thanks in advance!
See https://msdn.microsoft.com/en-us/library/406kfbs1(v=vs.100).aspx:
"Stop Debugging terminates the process you are debugging if the program was launched from Visual Studio. If you attached to the process, instead of launching it from Visual Studio, the process continues running. If you want to terminate attached processes, you can terminate a single process from the Processes window or terminate all attached process with the Terminate All command."
Is it possible to have Visual Studio automatically stop in debug mode in the first line of server side code that is being executed, without having to explicitly set a breakpoint?
Lets say I have a web forms application and I have VS 2013 attached to the worker process. I would like, when I press a button, for VS to stop in the first line of server side code so that I can debug it without having to provide a break point.
Thank you in advance
You can use System.Diagnostics.Debugger.Launch to start debugging without setting break point. Make sure you remove this in production.
Instead of launch the debugger for tracking the application/data flow you better write log on each step to trace the flow and errors. As if you start debugger it would not return the response until the execution get completed and you manually complete the debugging.
If its possible for you to launch a new debugging session, you can try Debug -> Step Into new Instance from the context menu (right click) of your web project.
I find the Edit & Continue feature is a great advantage if you develop an ASP.NET project. The only "problem" I run into is that if I want to use Edit & Continue, I need to start the debugger and run the code in the ASP.NET Development Server. When I want to stop debugging for a moment, the server stops and the web app is not available anymore -> Logic.
I would like to be able to start the server with the Edit & Continue feature, but not attach the debugger to the process yet. After some actions (login, filling a form etc), I want to attach the debugger to the process and be able to break at breakpoints and use the Edit & Continue feature.
It does work to start the server without debugging mode and as soon as I attach to the development server process, it does break, but by that time, the Edit & Continue does not work anymore. It tells me:
Changes are not allowed in the following cases:
- When the degbugger has been attached to an already running process.
- The code being debugged was optimized at build or run time.
- The assembly being debugged is loaded as domain-neutral.
- The assembly being debugged was loaded through reflection.
- When Intellitrace events and call information is enabled."
Is there a way to attach later and have a working Edit & Continue?
Why do I want this:
Imagine that I have a lot of breakpoints in my code and don't want to disable them one by one, but I would like to attach to the server process only after I have made some actions (login, filling out a form etc), in order to prevent that I need to continue on each break. Once I am just before my action I need to debug, I want to attach and then be able to edit the code without the need of restarting the web server and doing all the actions all over again.
I hope I was clear enough...
I'm debugging some of my code on Visual Studio. This code belongs to a custom Session Provider that I created, and I'm debugging it on my web application launch. It starts initializing my provider, and on that function I have a breakpoint that is being hit successfully the first time. However, that same breakpoint is being hit again, but it has a small blue icon and if you hover over, this message is displayed:
The process or thread has changed since last step
On my research I've found several kinds of answers, from people saying that the breakpoint is hitting a different assembly to some others saying that the breakpoint has been hit from a different thread.
Does anybody know what does this really mean?
When you have multiple threads running the same piece of code and you have a breakpoint there, Visual Studio will stop the execution every time any of those threads hit the breakpoint.
This will happen for every thread, in an unpredictable order.
When you are debugging step by step on your code, another thread can execute the code that you were debugging and hit the breakpoint. Visual Studio will let you know about this by putting that blue circle with the exclamation mark on the next statement arrow.
See more here: Debug Multithreaded Applications in Visual Studio
This icon simply means the breakpoint was hit on a different thread than the last thread you were on. It doesn't affect the program behavior at all.
I am trying to debug some code in my ASP.NET web app.
I set a breakpoint in one of the page events of the page's codebehind, and this once came up with a special icon in place of the red breakpoint saying symbols have not been loaded and the breakpoint will not be hit.
This error has not repeated itself but why can't I hit the breakpoint?
Also, when I press stop, I get a popup in VS stating:
Stop Debugging In Progres...
Debugging is being stopped but is not yet complete. You can force debugging to stop completely, but any processes attached may terminate.
This window will automatically close when debugging has completely stopped.
Completely stop
I also don't get the website appear in my browser either when starting to debug. :(
To make things worse, I have a line of code like this in my page's codebehind:
RssFeedSites = opml.Parse(filestream);
I am putting the problematic breakpoint on this line. But I have a programatic breakpoint in the Parse() method of opml, but this does not get hit, either.
Thanks
Could you check if the dll is perhaps in the GAC? If it is it is probably an older version and the GAC has priority over local dll's. So if the dll is in the GAC visual studio is using that (older) version instead of the newly built one.
the debugging host could not find the correct pdb's to match your executable or the debugging host is failing.
Check your build, are your PDB's all up to date and in the correct directory to be found ?
Check the debugging host process if its having problem. If your using visual studio hosting process, then has the vshost.exe process somehow terminated prematurely ? If your remote debugging, check the remote debugger. Check your web server as well. If the debugging host process fails to respond, visual studio will be stuck when trying to debug.
I don't recall the specific reason for the message when I have seen it, but I always ignore it, because the symbols get loaded when the page is executed and it always hits the breakpoint assuming it's in the process flow of the page.
If you can't hit ANY debug points and you are running from local IIS, you will need to attach to the working process(w3wp.exe). Tools->Attach to Process.