My Application stucking when it on debug mode - c#

I build winform application.
When I try to debug my project, I do rebuild and the debug.
The application run, but stuck before the winform is visible.
if I press the Pause button (in Visual Studio) and the the play button, the winform released.
If I debug the application line by line, the winform is not stuck.
What can I do?
I don't know where to begin.
Thanks a lot

Enable First Chance Exceptions in Visual Studio (if they are not yet enabled) and see if there is any exception that disturbs expected execution flow in any way.
Use Eqatec profiler to profile app, to see what happens on startup.

Related

Application only crashes when debugger is attached

Currently I am developing a global exception handling in a .NET C# application. I get some strange behavior:
If I debug the application from Visual Studio (F5), an unhandled exception causes the main thread to be terminated.
If I start the application without Visual Studio (click on the .EXE) with the exact same compile output (DEBUG-Build), the App doesnt crash after an unhandled exception occured.
This is kind of weird behavior...Does anyone know what's going on here?
EDIT:
It seems as if something changes within the running code as soon as a debugger attaches to the process... If I start the App without Debugging from within VS, the App doesnt crash.
I’ve been doing some work with ASP.NET MVC but was having periodic issues with Visual Studio 2008 hanging (freezing / becoming unresponsive) when I tried to run my web application with debugging. The problem only occurred with a specific web project.
I tried deleting the Temporary ASP.NET Files (%userprofile%\AppData\Local\Temp\Temporary ASP.NET Files) but that did not solve the problem.
I tried deleting the obj folder. No luck.
I tried waiting it out one evening. I eventually feel asleep and when I awoke sometime in the middle of the night, my web app was happily waiting for input and Visual Studio debugging was completely responsive. That proved to be a temporary salve.
showallfiles The problem resurfaced again a few days later and I finally figured out the problem with my uncooperative debugger. I have a folder containing approximately 20,000 images that are not included in the Visual Studio web project but are sitting in a directory in the web site. I had turned on "Show All Files" in Solution Explorer to add some script files into the project. When "Show All Files" is off, F5 (Start Debugging) works like champ. When "Show All Files" is on, Visual Studio becomes unresponsive. In reality it is not "frozen" but simply taking a very long time to process those 20,000 image files.
Mystery solved.

Visual Studio Error when Compiling - "Microsoft.VsHub.Server.HttpeHostx64.exe has stopped working"

I'm trying to learn to code on my own having a ten year break since I coded in C and Java back in college. I downloaded Microsoft Visual Community on a brand new laptop, i7 2GHZ, 12GB RAM, 512 SSD. Upon compiling my first C# Hello World, from the MVA C# Tutorial program, I keep getting this error repeatedly, so much so that I get multiple instances of the Error window:
"Microsoft.VsHub.Server.HttpeHostx64.exe has stopped working"
Debug | Click to Close
If I close the window, the window pops up again
If I click debug, Visual Studio opens up again and it requests to load Microsoft Symbols from an online library. It then rests in a steady state showing a project window identifying: Microsoft.VsHub.Server.HttpeHostx64 as a project.
How do I make this error go away?
I am also experiencing this same problem with Visual Studio Community, trying to do a simple windows form application in Visual Basic. After I code the form and execute it, the build takes place and the single form displays on the screen. Then I receive the message you identified. Regardless of pressing debug or close, the error continues to pop up, even after I shut down Studio. To stop it, I must go to task manager and end the VSHub.Server process

Start Visual Studio Debugger at any time while application is running

I am developing an application using Visual Studio, and when I install it (via Setup Project, .msi file) in a client machine and run it, I get some "Heisenbug" exception.
I am almost sure the error comes from earlier in the codepath, so I would like to debug it.
Fact is: when the application crashes, the following dialog is displayed (referring to my application instead of Windows Explorer, of course):
and if I choose "Debug the program", the Visual Studio Debugger (which is somehow available in the deployed machine) starts and shows details from the exception.
What I would like to do is to start the debugging session from the very start, so I can go on hitting F10 and F11 and check some intermediate values.
Anyone know how can I start the Visual Studio debugging session at any time while the application is running? Not that I am running the deployed application, not starting it from Visual Studio.
Since you have Visual Studio up and running on the machine running the deployed application, it should be straightforward:
Run the application
Load the project in Visual Studio
Go to DEBUG -> Attach to process...
A list will pop up with all the running processes
From the list, pick the process corresponding to the application, it should be named after your exe (if you sort by the numeric IDs, it's very likely it will be near the highest end)
Click "Attach", Visual Studio will should start debugging similarly as when you normally start with F5.
I also have another suggestion: implement heavy logging until you have everything figured out. Write down everything you have doubts about for further analysis in case something goes wrong: values, queries, etc.
You can start the application directly under the Visual Studio Debugger using the debugexe parameter:
devenv /debugexe “C:\MyApplication\Debug\MyApplication.exe”
This will launch the application with the debugger immediately attached. Otherwise it's very hard to debug issues that happen at the time the application is starting. You won't be able to manually attach in time to catch any events that happen during this time.
You can also place the following piece of code at the first line of you application (usually the Main(string[] args)) to force a debugger to attach and cause the application to break immediately:
System.Diagnostics.Debugger.Break();
If your application starts and runs fine for some time, you can use the "Attach to Program" feature as described by #Alex.
If you don't have the sources available on the target machine, you can either copy them over, or if you're using Source and Symbol Indexing features of TFS Team Build, you can tell the debugger where to look for your Debug Symbols (which will then resolve to TFS source control automatically).

Debug mode of Visual Studio 2010 is not running well

I've problem in my Visual Studio 2010 Ultimate version. When I push play button on my project and the browser (IE) is appear and suddenly the play button is not gray out and in a debug mode position. It's back to normal mode as I'm not pressing the button play yet. Please help and advice the solution. Attached image for the illustration.
Thanks in advance.
http://i.stack.imgur.com/0XPJM.png
something makes your program exit.
perhaps exception.
start debugging using F11 (step into).
and and go slowly until you find the reason.
also you can use
Visual Studio: How to break on handled exceptions?

My VS can't stop at the crash location while debugging

I am using VS 2010. While debuging my C# website, if there is any run time error, my debug internet browser will crash and only the triangle on the left-bottom roughly shows the error info. Previously in the normal situation, my VS could stop at the code where this crash happens in case of run time error occurs.
Is there any setting in VS that I can restore this feature? BTW, I installed Just-Code but disabled its add-in in VS, don't know if this software caused this problem.
Thanks,
Wei
In VS, in the toolbar click on the Debug -> Exceptions.
Then check the Throw checkbox for the Exceptions you are interested in.
Check out is Silverlight debugging is turned on for the project by mistake. You can debug either JavaScript OR Silverlight.

Categories