dotnet / dotnet/sdk

[Windows 11] LockBatchFilesWhenInUse registry key blocks NativeAOT

Open
#54,196 0 comments 0 reactions 0 assignees View on GitHub
Area-NativeAOT untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Describe the bug
When the registry key LockBatchFilesWhenInUse (placed under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor) is set to 1, it breaks NativeAOT compilation during the `SetupOSSpecificProps` step. It simply hangs.

### To Reproduce

In Windows 11 Build 26200.8328 (and 26100.8328) simply set the registry key and attempt to publish the app (which has `PublishAot` set to true).

### Exceptions (if any)

None. If verbosity is set to Diagnostic, I get "Maximum setlocal recursion level reached" when aborting the build.

### Further technical details
details of dotnet --info


.NET SDK:
Version: 10.0.203
Commit: c23858a6d8
Workload version: 10.0.203.1
MSBuild version: 18.3.3+c23858a6d

Runtime Environment:
OS Name: Windows
OS Version: 10.0.26200
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.203\

.NET workloads installed:
[android]
Installation Source: SDK 10.0.200, VS 18.5.11723.231
Manifest Version: 36.1.53/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.android\36.1.53\WorkloadManifest.json
Install Type: Msi

[ios]
Installation Source: SDK 10.0.200, VS 18.5.11723.231
Manifest Version: 26.4.10259/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.ios\26.4.10259\WorkloadManifest.json
Install Type: Msi

[maccatalyst]
Installation Source: SDK 10.0.200, VS 18.5.11723.231
Manifest Version: 26.4.10259/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.maccatalyst\26.4.10259\WorkloadManifest.json
Install Type: Msi

[maui-windows]
Installation Source: SDK 10.0.200, VS 18.5.11723.231
Manifest Version: 10.0.20/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.maui\10.0.20\WorkloadManifest.json
Install Type: Msi

[wasm-tools]
Installation Source: SDK 10.0.200
Manifest Version: 10.0.107/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.workload.mono.toolchain.current\10.0.107\WorkloadManifest.json
Install Type: Msi

Configured to use workload sets when installing new manifests.

Host:
Version: 10.0.7
Architecture: x64
Commit: b16286c228

.NET SDKs installed:
10.0.203 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.26 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
Not found

I use Visual Studio 2026 (18.5.2). Although, this issue happens on the CLI, it could also happen when publishing via VS.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.