Search code examples
windowsvisual-studiowindows-10visual-studio-2017administrator

Visual Studio 2017 installer keeps telling me "elevation required"?


When I try to install VS 2017 on a machine, the installer gives me the following error despite the fact that I'm already an administrator (yes I've tried "Run as Administrator" and messing with UAC etc... trust me I've tried all the usual stuff and know how Windows works):

Elevation Required

This program requires administrator privileges to perform setup operations.
Please rerun the program as administrator.

Tracing with ProcMon, I see a log in my temp directory that seems to be indicating the cause:

Information : Log configuration: $SERVICEHUBTRACELEVEL=""
Error : HubHost 'desktopClr$C94B8CFE-E3FD-4BAF-A941-2866DBB566FE' PID 3736 stderr: Error running host: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: creationOptions
   at System.Threading.Tasks.Task..ctor(Object state, TaskCreationOptions creationOptions, Boolean promiseStyle)
   at Microsoft.ServiceHub.HostLib.Host..ctor(String hostId, String pipeName, DevHubTraceSource logger)
   at Microsoft.ServiceHub.HostLib.Program.<MainAsync>d__0.MoveNext()

Error : HubHost 'desktopClr$C94B8CFE-E3FD-4BAF-A941-2866DBB566FE' PID 3736 stderr: 

Error : HubHost 'desktopClr$C94B8CFE-E3FD-4BAF-A941-2866DBB566FE' PID 3736 stderr: Unhandled Exception: 
Error : HubHost 'desktopClr$C94B8CFE-E3FD-4BAF-A941-2866DBB566FE' PID 3736 stderr: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: creationOptions
   at System.Threading.Tasks.Task..ctor(Object state, TaskCreationOptions creationOptions, Boolean promiseStyle)
   at Microsoft.ServiceHub.HostLib.Host..ctor(String hostId, String pipeName, DevHubTraceSource logger)
   at Microsoft.ServiceHub.HostLib.Program.<MainAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at ServiceHub.Host.Program.Main(String[] args)

Error : Error starting service 'SetupEngine.ProductsProvider' requested by ProductsProvider (pid: 3340): Hub host 'desktopClr', PID: 3736 exited. code: '3762504530'.
Error : Error starting service 'SetupEngine.Installer' requested by Installer (pid: 3340): Hub host 'desktopClr', PID: 3736 exited. code: '3762504530'.

It seems their code is buggy except this is only happening on my machine? Why isn't everyone seeing this? What's triggering this problem and how do I fix it?


Solution

  • I finally solved this by installing .NET Framework 4.7, though I suspect updating 4.0 to even a slightly more recent version might work too.

    The issue seemed to be a bug in the System.Threading.Tasks.Task class, where it didn't allow passing a flag that was supposed to be legal. I assumed this was a version mismatch and fixed.