Search code examples
.netvisual-studio.net-coreide

After updating Visual Studio to v17.9.3 the IDE closes and dotnet.exe command reports Fatal error. Internal CLR error. (0x80131506)


VS 2022 Community was running flawlessly for a month. Two days ago I was notified there was the update v17.9.3, so I launched it and left (I did a previous update some weeks ago with no troubles). When I was back the update was successful, VS told me that now I needed to log in with MS account so I tried but clicking the button didn't do anything! So I just had to click Ignore for now.

The IDE started but I saw some upper left error messages about not found main IDE functionalities. Then a MessageBox with the error 'VSPackage' not loaded correctly. Rebooting the IDE didn't help.

I tried repairing VS, and even completely uninstalling and reinstalling it, but nothing helped. I wanted to check my DotNet Core version, so I typed dotnet --info in a command prompt, but I received the message:

Fatal error. Internal CLR error. (0x80131506)

I finally succeeded in load and run one console program, before the IDE crashed, but in the console I received as output the same Fatal error. Internal CLR error. (0x80131506) message, so every error in the IDE depends on that dotnet.exe error message!

I tried downloading and installing the SKD 8.03, but same error.

I have 3 dotnet.exe files on my drive, 2 work and 1 not:

C:\Program Files\dotnet\dotnet.exe --info
Fatal error. Internal CLR error. (0x80131506)

C:\Program Files (x86)\dotnet\dotnet.exe --info
v8.03

C:\Program Files\Microsoft Visual Studio\2022\Community\dotnet\net8.0\runtime\dotnet.exe --info
v8.03

Opening the Developer Command Prompt for VS 2022 and executing dotnet.exe --info I get the same internal error.

Concerning thing: I tried to install the Microsoft SDK 8.03 in a clean VM with Win10 and got the same internal error!

I tried repairing VS several times, even uninstalling VS and all the .Net related packages from my system, reinstalling VS from scratch, installing SDK .Net 8 manually, but nothing worked. I even tried the Enterprise demo version of VS.

I expect dotnet.exe produce a successful output with no error message, because the VS strange behavior depends on this.


Solution

  • I had the exact same problem after recent upate,HostCrashException and package error,internal error etc , looks like its a version bug

    try the solution mentioned here: https://stackoverflow.com/a/78175128/8543147

    no need to change the system dotnet at c:\Program Files\dotnet,it's done using a manual replace of dotnet that is being used by VS.this probably fixes your IDE crash problem and it seems fixing that CLR error is not neccessary for fixing the VS HostCrashException.

    Update:
    A tip was added to the mentioned solution about fixing that CLR error(based on SilverBlack answer in that topic)