0

Running the latest Visual Studio Code (v1.48.1 at the time of posting this) with C# Extension, I'm seeing this errors:

Razor.VSCode version 6.0.0-alpha.1.20418.9
...
[Error - 4:20:16 PM] Server initialization failed. 
Message: Internal Error - System.UnauthorizedAccessException: Access to the path 'c:\Users\UserName\Application Data' is denied.

I've tried reinstalling VS and all extensions but that didn't help.

Is anyone else seeing this? Is there a workaround?

noseratio
  • 2,963

1 Answers1

2

A quick and dirty fix, as a note to my future self.

Running:

Icacls "%USERPROFILE%\Application Data"

Shows:

C:\Users\UserName\Application Data 
Everyone:(DENY)(S,RD)
NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F)
BUILTIN\Administrators:(I)(OI)(CI)(F)
PC\UserName:(I)(OI)(CI)(F) 

I have no idea what user account Razor.VSCode runs under (if it's different from UserName at all), but removing Everyone from the above access list solved this problem. I had to repeat it for some other folders. This is not a proper fix as it may compromise the system's security, but I needed a quick fix:

Icacls "%USERPROFILE%\Application Data" /remove Everyone /t
noseratio
  • 2,963