-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Adjust elevation check for net host #12386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a handshake failure between elevated MSBuild.exe processes (running on .NET Framework) and dotnet.exe child processes (running on .NET). The issue occurs because MSBuild.exe can check for administrator privileges using Windows APIs that are unavailable in modern .NET runtimes, causing handshake mismatches.
- Modified elevation check logic to skip administrator privilege validation for .NET task host scenarios
- Added conditional guard to prevent HandshakeOptions.Administrator flag when communicating with .NET endpoints
- Maintains security intent while resolving cross-platform compatibility issues
src/Build.UnitTests/TestAssets/ExampleNetTask/TestNetTask/TestNetTask.csproj
Show resolved
Hide resolved
56e3ed3 to
67176ee
Compare
Fixes #12385
Context
MSBuild handshake failures occur when an elevated MSBuild.exe process (running on .NET Framework) attempts to communicate with dotnet.exe child processes (running on .NET). The issue stems from a platform compatibility problem where:
HandshakeOptions.Administratorflag when running elevated (due toFEATURE_SECURITY_PRINCIPAL_WINDOWSbeing available)WindowsPrincipal/WindowsIdentityAPIs are not available in modern .NET runtimesChanges Made
GetHandshakeOptions()to make elevation validation avaialble for .NET task host scenariosTesting