Visual Studio project execution stopped shortly after starting - visual-studio

Yesterday I wanted to continue working on a project of mine, so I started Visual Studio and asked it to run the project to remind myself, what was already implemented and what wasn't.
The project got built and started, but seemed to quit right away. No error message, nothing.
No matter what I did, whether I rebuilt the project or cleaned it, nothing changed.
This didn't make sense, since the last time I tested the project, it worked perfectly (and I didn't modify anything in the code since then)
So, I assumed I had a hidden bug somewhere in the code, that just didn't show up previously.
I put a Breakpoint somewhere near the beginning of the code, and ran the project.
As expected, Visual Studio paused the execution at the Breakpoint and highlighted it.
I decided to set another Breakpoint somewhere later in the code and continue execution, but before I could even move my mouse, the project stopped.
Restarting Visual Studio didn't help, but restarting the PC did. Therefore, I'm assuming that something on my system was terminating my project, shortly after execution begun.
Now my question is: What exactly happened, and especially: why did it happen?
The problem came back while I was writing this question. I don't feel like restarting my PC every couple of hours...
I really appreciate the time you took reading this and I look forward to your answers.

I'm aware that I'm answering my own question, but since I've solved it myself, I thought others might want to know how I did it (for the sake of future generations)
The thing is: I've recently added Visual C++ to Visual C# before Visual C# started having problems.
So I deduced, that maybe the installer for Visual Studio messed up with something and decided to reinstall Visual Studio.
Problem solved.
So: if your projects stop without warning even while paused on a Breakpoint and you've changed something in your Visual Studio installation (like added Visual C++ in my case), you might need to reinstall the whole thing.
Luckily, the Visual Studio installer offers a "Reinstall" option, so you don't need to uninstall and reinstall manually.
I found about this solution, after talking to a more experienced colleague. I just wish I asked him first. Still appreciate your efforts in the matter, though.
EDIT:
I recently noticed a similar bug acting up for C++ programs this time, where the window border would be outlined in red. The thing is: it's not Visual Studio's fault, but in fact Avast Antivirus' fault. More specifically, its Sandbox mode.
So, if for any reason, you notice programs quitting without crashing, shortly after starting and their window border having a red outline, you're very likely using Avast Antivirus and should deactivate the Sandbox mode.

Happens to me from time to time.
Sometimes closing and opening VS helps, sometimes you have to restart the computer.
I assume it must be related to some DLL or something that is loaded into memory and corrupt, or something like VS loosing the reference to it, and not unloading it correctly/replacing it.
I also once had this strange bug, where I started VS, just like any other day, and my project crashes instantly with some H_RESULT error (some DLL related Error) upon run. After having spent around 1hour searching for the source of the problem, I went into the reference section, and what did I see there : the worst possible circular reference ever : my business project had a reference to ... itself ! The kind of stuff you could not do if you wanted to.
The weirdest part of this, must of been that VS managed to compile the project, and it only crashed while trying to run it ...

Related

Blazor Intellisense in .razor file stops working after publishing

I have a Blazor application using Visual Studio 2019 version 16.10.4. Every time I publish to an IIS server using the Publish... command from the Solution Explorer, Intellisense stops working in the .razor file that I have open and all text coloring goes away, so that all the text becomes the same color (and all auto-indentation stops working). If I close the .razor file and reopen it, Intellisense and colors start working again.
Is that a known issue, or is it a problem that I can fix? I've seen other posts about Intellisense not working in Blazor, but those all seem to be older posts with older minor version numbers of Visual Studio, and they don't mention the problem occurring only when publishing.
This kind of thing happens all the time. The solution is to jiggle it a little bit: close and re-open the file, restart VS, delete bin files, etc. etc.
In Blazor, there are a couple other common culprits. EventCallback with a declared Type often complains that it can't covert the type, even though if you ignore it, it will still compile and run.
It appears a fix is coming for this. As much as it's a frustrating issue, at least it will be resolved soon.
https://github.com/dotnet/razor-tooling/issues/5103

Intel Visual Fortran Compiler Freezes During Compilation

When I try to build my Intel Visual Fortran Project (Intel Parallel Studio XE 2015 [15.0.1.148] and Visual Studio 2012) my build process hangs on one specific file and will not finish compilation and yields no errors messages.
Yesterday was the first time I encountered this problem, and it was easily fixed, by manually ending the build process in visual studio and then end fortcom.exe process from task manager. I then tried to build again and it completed. Today, it happened again only I've tried multiple times to do what worked before to no avail. I've also restarted Visual Studio and tried again, and restarted the computer and tried again.
There have been no project or solution setting changes I'm aware of recently, and I've checked back through, but I can find no problem. I've also tried commenting out the newest code I've added, but have gotten no change.
I can't post the project in question as it is proprietary. I understand it is not likely someone could tell me what the issue is from this, but I'm hoping someone can direct me into how to find the issue because I don't know what else to look at.
The answer to my problem ended up being unsatisfactory. I commented out a lot of code in the offending file and then slowly uncomment it. Sometimes I would uncomment out too much and it would freeze during compilation again. Eventually when I thought I was narrowing down to the problem line, but eventually there were no lines left and no problems and it built properly.
If anyone has any ideas as to what might be the underlying issue, I'll still give that credit for the answer.

Updating Visual Studio leaves my app critically wounded

I updated the Visual Studio Developer tools and voila! Some of my code no longer functions. I can debug, but 90% of the fixes I had made in the past day disapears whenever I debug. It worked earlier today with the old Visual Studio; but now, the effects of the code simply don't show up when I debug.
I can see the code in the code-editing window, but it doesn't debug any way I try. Does anybody know how I can fix this?
P.S. If this belongs on SuperUser, I'll be happy to put it there. Simply tell me, and I'll move it.
Manually clean the solution and output folders (by deleting the obj and bin folders while Studio is closed). Re-open and rebuild. If it's in a referenced DLL, drop the reference in the consumer, build to get a failure, then re-add.

Visual Studio 2010 debugger skipping

Occasionally during debugging the debugger skips forward randomly. Sometimes I Step into a function inside of another function and instead of going to the next line it skips through to a seemly random place in the future. sometimes to a line partway through another function.
It always seems to respect breakpoints though, i.e. if a breakpoint is set in the future it never will skip past it.
I'm running 64 bit Win 7 and visual studio 2010 ultimate. I'm not using threads. This never happened for me in visual studio 2008. How can I fix this?
Do you have optimizations turned on? If the program is highly optimized, the order of execution can be thrown off, and things can be expanded or rearranged in ways that are not always clear.
I'm running into similar problems debugging a C# program with Visual Studio 2010 on an XP machine. The debugger just randomly skips to some other line or the next break point.
It seems that Microsoft has released a Fix for this in the SP1.
Are you sure that the assembly your code calls has debug symbols? You maybe referencing a dll that was compiled in release mode.
This can happen when the debugger is running against pdb files that don't match the source code you are looking at. Make sure the bin (or where you are running from) is up to date and was built from the same source code you are running in the debugger.
Are you using threads or background workers? When debugging I believe that all threads are paused so it could be switching between them. Otherwise you may have out of date debugging information, Delete your bin and obj directories and do a clean build.
This can also happen when your Debug solution configuration is up to date, but you try to debug the program in Release configuration (if that is not also up-to-date)... or vice versa.
You can switch back and forth between running in Debug or Release configuration using the drop-down next to the green 'play' arrow at the top of the screen.
I had a similar problem in Visual C++ 2008 on Windows 7 32-bit recently. Several minutes before the problem first appeared, a system dialog window “VC.exe encountered a problem and needs to quit” was displayed but the Visual C++ window seemed to survive.
After the problem first appeared, I tried several ways to getting it back to work like rebuilding the solution or restarting Visual Studio. However, it continued to behave strange: It failed to link with an object file I hadn’t touched for weeks, displayed “The breakpoint will not currently be hit. The source code is different from the original version.” etc.
Nothing helped until I rebooted the computer and finally rebuilt the solution (twice, actually).
Click Rebuild Solution.

Visual studio 2008 crashes when starting to debug

When I press F5, everything compiles fine, but when the app is to be started, VS crashes, showing the "Just in time debugger" dialog.
More than one (similar) solution has this problem. A new solution containing just a form, works. This problem started out of the blue, I have made no changes to the environment as far as I can understand.
I can start the app without debugging (ctrl+F5), and then attach the debugger.
I'm using VS 2008 sp 1.
Never seen this issue, have you tried turning off all your plug-ins like reSharper, CodeRush, etc.?
Update: When worst comes to worst I usually try this command line.
devenv.exe /ResetSettings
devenv.exe /ResetSkipPkgs
devenv.exe /Setup
try all these you can do them all at once or do them individually it is up to you. But be aware that you will be deleting all your settings that you have customized in to Visual Studio, so you may want to back them up.
The last thing you can try is this, to see if the problem is with something weird that is running.
devenv.exe /SafeMode
Starts Visual Studio in safe mode, and loads only the default environment and services, and shipped versions of third-party packages.
I've found the problem now. I had "Step framework source" enabled, which somehow broke the debugger (strange though, because it usually works). Turning that off, made me debug as usual again.
If you have undocked windows in debug layout search KB960075 on code.msdn.microsoft.com (can't add hrefs).
Do you have CLI.exe error issues? Check your event log. I've had the same issue and simply re-staged my machine out of panic since I was so near a deadline. I assumed that it was an issue with the registry and couldn't find an answer.
try repair or reinstall, don't waste time findin' the reason of the problem
I had the same problem, out of the blue the IDE would crash when I started to debug. Happened with any existing project that I opened, even the visual studio samples. I created a new project, just a blank dialog, ran it, and all was good. After that, the problem went away and I was able to debug again.
This happened to me just now, after my computer rebooted itself last night. When I was pressing F5 the app started but instantly shut down and the VS IDE crashed.
To fix it: Debug->Delete All Breakpoints. It worked for me.

Resources