When I run a unit test visual studio crashed - c#

When I am working with a VS 2008 Team System solution with a very large number of projects VS crashes on me all the time.
Strange thing is that the other developers don't have the same problem and it has only been a problem for me the last couple of days. Don't know suddelny why i'm having this problem.
When i run a unit test it crashes and when i get rid of a bunch of projest from the solution and run the same unit test it's doesn't crash.
It has nothing to do with add ins, VS settings, the machine spec and i already tried reinstalled VS. It has something to do with VS running out of memory or something
Here are the steps i took so fare:
Reinstalled VS then rebuilt the solution, deleted all VS files like the .user file and deleted all add ins.
I also increaed my virtual memory. My machine isn't running at 100% CPU or 100% RAM at the time and there is no usful messages in the event log.
It crashes when i do anything really except opening and closing files, like running a unit test or going into debug mode
any suggestions?

Your question doesn't have a lot of info - no error messages, no steps you take to get the crash, no steps you've taken to troubleshoot or what the outcome was, not even what you mean by "very large number of projects"...
So when you say "it has nothing to do with add ins, VS settings.." it's hard to accept that on faith, (or even help you at all honestly).
First thing I would do would be to reset all settings with Tools | Import and Export settings..., then "Reset all settings". I would make sure all extensions are uninstalled (not just disabled. And I would delete my .suo file (been burned by that before).
If none of that works, a repair install or uninstall/reinstall would be next. I'd also look at any new applications or service packs I've installed over the last few days.

When using VS 2008 with ReSharper (5.1, 6.0 or 6.1) I had the same problem. After uninstalling a seperate NUnit installation the crashes disappeared for me.

Related

Visual Studio (xamarin) hanging on every build, clean, or rebuild with AAPT.exe running in the background while it does this

I've been banging my head against the wall for the last few days trying to figure this out.
Here is whats happening:
Anytime I open the project VS hangs responding every once in a while for a click I made a minute or so before. While you watch task manager you see that AAPT.exe is popping up every few seconds and running for a moment, after about 3-5 minutes it completes whatever it is doing and vs starts working again until I do one of the other things that sets it off.
Same thing when I clean the project.
Same thing when I build/rebuild the project.
When debugging to a physical device it will build and deploy to the device, then hang with the same issue for a few minutes before starting the debug
What I have discovered:
This issue could possibly be related to this bug report https://bugzilla.xamarin.com/show_bug.cgi?id=43081 however following the instructions provided on that don't help and only cause more errors.
It seems that aapt is crunching my pngs and that is causing the hang, however I only have a few small icons in terms of images in the entire project, nothing that should take 2-3 minutes to compress.
What I have tried:
Update all android sdks and resources to the latest available.
Update java(64bit) and removed all other instances of it besides the newest one
Removed and reinstalled all android resources.
Repaired Visual Studio(community 2015)
Nuked VS with https://github.com/Microsoft/VisualStudioUninstaller/releases
Attempted to install VS 2017 community however it never functioned with the error CLR20r3 from mscorlib 4.6.1 with the error being 'remoteHostService.servicehub.service.json' could not be found(I checked it existed where it should be, and it referenced VsixServiceDiscovery: A procedure imported by 'Microsoft.VisualStudio.Settings.15.0.dll' could not be loaded. (I unfortunately dont have the full trace anymore I got rid of 17)
After all that I reinstalled vs 15, which I got working(barely) but it still has the exact same issue as when I started.
At this point my next step is to nuke my computer completely, which I don't really want to do, so I'm desperately hoping that someone knows how to fix this.
So after playing with a few things I noticed that a decent portion of the packages from NuGet in my solution had a triangle on them, for not having the reference.
Ultimately what I've figured out is that after each of the events that I described above, AAPT was actually redownloading every single one of the ~20 packages that I have in my solution because for some reason it had failed to link the project to the local copies despite being there.
The solution was discovered on this thread:
https://forums.xamarin.com/discussion/89926/the-referenced-component-xamarin-android-support-xxx-could-not-be-found-after-upgrade-with-nuget
Ronald Peters
February 23
I fixed the yellow marks by forcing reinstall of packages: open NuGet Package Manager Console and execute "Update-Package –reinstall".
This forced all packages to remove all references from the project and reinstall themselves. Which ultimately most of them just found the local copy and just needed to be linked again.
After running this, VS no longer hangs after any of the events listed above, and everything seems to be working again.

Release builds hang/crash, regardless of code

For some reason I just started having an issue with my release builds.
I'm able to run any of my projects without issue from the debug builds, I can also run my release builds as long as I attach a debugger, but when I try to run the release builds on their own they either hang infinitely (The UI crashes, but I'm unable to stop the process with task manager), or they load up EXTREMELY slowly (I've only ever had them eventually load twice, and that was on a separate machine from my main PC).
I know I don't have any viruses or any other system issues (I take very good care of keeping my system extremely clean), and I've tried running the programs with AV disabled.
Nothing I do seems to make a difference, and the fact that debug builds of my projects perform exactly as expected leads me to believe somehow I've altered a setting in VS regarding how it builds releases or something similar.
Could this be the case? If so, how should I go about fixing it?
If you need any more information please let me know.
EDIT: Something else I've just noticed about this issue is, the only time I'm able to run any of the executables I've built is if they are in the bin\debug\ folder of my project. That includes copying the "release" build of my project into the debug folder. It then runs just fine. I've also tried building an installer for my project, and it also will only run while in the debug folder, and nowhere else on my system. Doesn't seem to matter whether it's a release or debug build, as long as it's in that folder.
I ended up doing a complete uninstall of Visual Studio Community 2015 and all of the runtimes/etc. that were installed on the same date as VS, and reinstalled the program.
I then deleted all of the debug/release builds for my project, cleaned the solution and rebuilt them.
So far everything seems to be working okay now.
I'm not sure what the issue was, but a fresh install seemed to fix it.

"Unable to step. Process is not synchronized" error in VS2010 after upgrading .NET Framework

I had Visual Studio 2010 installed on my Windows 7 desktop, that I was using primarily to debug ASP.NET solutions. Everything was working great, until one of the Windows updates installed a new version of the .NET Framework. Now I get the following message when I try to place a breakpoint and then do a "debugger step" in my C# code:
To make matters worse, it doesn't happen all the time. I tried to find any pattern, but the best way I can describe it is sporadic.
Any idea how to fix this?
I just got this in Visual Studio 2015. I was debugging on a separate thread, hit the breakpoint but could not continue. A reboot did not fix it.
I deleted all of my breakpoints, reset the two that I actually wanted and it works!
Can I suggest you try using the resharper test runner. I have also been hitting this error a lot in VS2017 15.5.2 I have found its something to do with the VS test system.
Even though this solution is a product recommendation (I don't work there) it solved my issue and I was able to get things debugged.

Code 'ghosts' in C#

The problem I have run into twice now is that my program seems to be running code that no longer exists. I figure that some old version is stuck some how but have no idea how to get the compiler to run the updated code I've written.
The way I have spotted the problem is by observing that bit maps I've loaded keep getting drawn even after I've removed instructions to do so. The problem persists even after removing every reference to the image in question, content load lines included.
The first time this happened restarting the compiler didn't fix the problem but restarting the computer did. Now the problem has persisted after a full shutdown.
I m using ms C# 2008 express edition if that has any bearing.
My first thought would be that the build is failing and that Visual Studio is running the old version. I don't have VS 2008, but in VS 2010 the option to change this option is in Tools->Options->Projects and Solutions->Build and Run.
You have to figure out where the mismatch is coming from.
What happens when you run the .exe from outside VS? What about from inside VS? Can you verify that after a build, the binary you're executing has an updated timestamp? Is the stale code in a .dll where the new version isn't getting pulled in?
In my experience this happens when configuration profile is changed from debug. For instance if I am running the debug profile, it works. Then I change to the QA profile and make changes and then build the new assemblies. The assemblies are built to a directory called "QA" however, when I debug through visual studio it runs the code from the debug profile. I can remove references, recompile the code, visual studio will still run from the debug profile. It appears that none of the changes I made are in the code. When in reality I'm inadvertently running a old build.

Visual Studio keeps crashing

Visual studio team system 2008 keeps crashing on me. Sometimes it just freezes, or certain parts of the UI get messed up or a weird popup box saying something about unable to load parameters or saying something else about memory or any other number of things.
it usually happens when I do a "complex" task like go into debug mode or do a search across of whole solution or run a unit tests or something like that.
I rebooted my machine countless time, reinstalled it VS, changed my virtual memory settings, flush my page file on every reboot and anything else i could think of.
It seems like VS runs out memory or something.
I have a powerfully machine with lots of RAM so that's not the issue
any suggestions?
You can always try some standard Visual Studio troubleshooting steps:
Clean the solution
Delete / rename all files in your solution created by VS, i.e. all .ncb, .suo, .user files
Launch Visual Studio with all add-ins disabled: devenv.exe /SafeMode
Reset All Settings: Tools -> Import / Export Settings -> Reset All Settings
Delete HKCU:\Software\Micosoft\VisualStudio\9.0 and then restart Visual Studio
Repair the Visual Studio installation through Add/Remove Programs
You might also check whether there is a hotfix available addressing your issue (e.g. KB960075 sounds like a good candidate for you), or whether you find your problem already reported on the Connect website.
The first step is to uninstall all 3rd party add-ins on Visual Studio. In particular if you have multiple add-ins as they can interfere with each other in unexpected ways and cause crashes. After uninstalling repeat your scenarios and see if this fixes the issue.
If not then it's best to consult the application log and find out why Visual Studio is crashing. The log will contain at least the error code of the crash which can searched on google or reposted here for us to take a look at.
Assuming this occurs with VS up to date with all service packs installed, you might try some of these suggestions. If you haven't tried with service packs, do that first.
What version of Windows are you using? If it is Windows 7, try launching Visual Studio with a compatibility mode and see if that resolves the issue. To do this, make a copy of the normal launch shortcut and go into the Properties dialog and set it to run as Windows Vista.
If this doesn't fix it, then you might also consider:
Checking your PATH environment for any weird settings which might be confusing it, e.g. paths pointing to other SDKs
Any 3rd party VS extensions such as source control, refactoring plugins, wizards etc.
Old versions of .NET or SQL server
Also test if the issue occurs for every kind of project or just certain kinds, e.g. does it happen for all projects? Does it happen in C++, C#, VB.NET projects etc.
You can also attach a debugger to Visual Studio, to see what it's doing. Sometimes a particular .sln will trigger bad behavior or more likely, some third-party add-on.
If you believe that you've gotten VS into a wired state, you can try the following command line switches
devenv.exe /ResetSettings (This will reset the visual studio settings to the defaults)
If that doesn't help, as a last resort, you can try
devenv.exe /ResetUserData

Categories