Skip to content

[Unhandled Exception]: Cannot set thread priority #12130

@GlitchedCode922

Description

@GlitchedCode922

Issue Description

If Msbuild is not running in an environment with ability to set nice priority, it fails with this message:

/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : This is an unhandled exception in MSBuild -- PLEASE UPVOTE AN EXISTING ISSUE OR FILE A NEW ONE AT https://aka.ms/msbuild/unhandled [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error :     System.Threading.ThreadStateException: Unable to set thread priority. [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error :    at System.Threading.Thread.set_Priority(ThreadPriority value) [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error :    at Microsoft.Build.BackEnd.RequestBuilder.SetCommonWorkerThreadParameters() [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error :    at Microsoft.Build.BackEnd.RequestBuilder.RequestThreadProc(Boolean setThreadParameters) [/root/runtime/Build.proj]

Steps to Reproduce

Run MSBuild on an environment without privilege to set thread priority.

Actual Behavior

/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : This is an unhandled exception in MSBuild -- PLEASE UPVOTE AN EXISTING ISSUE OR FILE A NEW ONE AT https://aka.ms/msbuild/unhandled [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : System.Threading.ThreadStateException: Unable to set thread priority. [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : at System.Threading.Thread.set_Priority(ThreadPriority value) [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : at Microsoft.Build.BackEnd.RequestBuilder.SetCommonWorkerThreadParameters() [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : at Microsoft.Build.BackEnd.RequestBuilder.RequestThreadProc(Boolean setThreadParameters) [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : This is an unhandled exception in MSBuild -- PLEASE UPVOTE AN EXISTING ISSUE OR FILE A NEW ONE AT https://aka.ms/msbuild/unhandled [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : System.Threading.ThreadStateException: Unable to set thread priority. [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : at System.Threading.Thread.set_Priority(ThreadPriority value) [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : at Microsoft.Build.BackEnd.RequestBuilder.SetCommonWorkerThreadParameters() [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : at Microsoft.Build.BackEnd.RequestBuilder.RequestThreadProc(Boolean setThreadParameters) [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : This is an unhandled exception in MSBuild -- PLEASE UPVOTE AN EXISTING ISSUE OR FILE A NEW ONE AT https://aka.ms/msbuild/unhandled [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : System.Threading.ThreadStateException: Unable to set thread priority. [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : at System.Threading.Thread.set_Priority(ThreadPriority value) [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : at Microsoft.Build.BackEnd.RequestBuilder.SetCommonWorkerThreadParameters() [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : at Microsoft.Build.BackEnd.RequestBuilder.RequestThreadProc(Boolean setThreadParameters) [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : This is an unhandled exception in MSBuild -- PLEASE UPVOTE AN EXISTING ISSUE OR FILE A NEW ONE AT https://aka.ms/msbuild/unhandled [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : System.Threading.ThreadStateException: Unable to set thread priority. [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : at System.Threading.Thread.set_Priority(ThreadPriority value) [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : at Microsoft.Build.BackEnd.RequestBuilder.SetCommonWorkerThreadParameters() [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : at Microsoft.Build.BackEnd.RequestBuilder.RequestThreadProc(Boolean setThreadParameters) [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : This is an unhandled exception in MSBuild -- PLEASE UPVOTE AN EXISTING ISSUE OR FILE A NEW ONE AT https://aka.ms/msbuild/unhandled [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : System.Threading.ThreadStateException: Unable to set thread priority. [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : at System.Threading.Thread.set_Priority(ThreadPriority value) [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : at Microsoft.Build.BackEnd.RequestBuilder.SetCommonWorkerThreadParameters() [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : at Microsoft.Build.BackEnd.RequestBuilder.RequestThreadProc(Boolean setThreadParameters) [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : This is an unhandled exception in MSBuild -- PLEASE UPVOTE AN EXISTING ISSUE OR FILE A NEW ONE AT https://aka.ms/msbuild/unhandled [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : System.Threading.ThreadStateException: Unable to set thread priority. [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : at System.Threading.Thread.set_Priority(ThreadPriority value) [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : at Microsoft.Build.BackEnd.RequestBuilder.SetCommonWorkerThreadParameters() [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : at Microsoft.Build.BackEnd.RequestBuilder.RequestThreadProc(Boolean setThreadParameters) [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : This is an unhandled exception in MSBuild -- PLEASE UPVOTE AN EXISTING ISSUE OR FILE A NEW ONE AT https://aka.ms/msbuild/unhandled [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : System.Threading.ThreadStateException: Unable to set thread priority. [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : at System.Threading.Thread.set_Priority(ThreadPriority value) [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : at Microsoft.Build.BackEnd.RequestBuilder.SetCommonWorkerThreadParameters() [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : at Microsoft.Build.BackEnd.RequestBuilder.RequestThreadProc(Boolean setThreadParameters) [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : This is an unhandled exception in MSBuild -- PLEASE UPVOTE AN EXISTING ISSUE OR FILE A NEW ONE AT https://aka.ms/msbuild/unhandled [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : System.Threading.ThreadStateException: Unable to set thread priority. [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : at System.Threading.Thread.set_Priority(ThreadPriority value) [/root/runtime/Build.proj]
/root/runtime/.dotnet/sdk/10.0.100-preview.6.25315.102/NuGet.RestoreEx.targets(19,5): error : at Microsoft.Build.BackEnd.RequestBuilder.SetCommonWorkerThreadPa

Analysis

No response

Versions & Configurations

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed-by-botClosed due to lack of activityneeds-more-infoIssues that need more info to continue investigation.staleFor issues that haven't had activity in some time.triaged

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions