Skip to content

NativeAot related test failed when linker input file path length over MAX_PATH #3236

Description

@filzrev

On my local Windows environment.

LatestNativeAotVersionIsSupported test failed with following linker error.

LINK : fatal error LNK1104: cannot open file 'C:\Projects\GitHub\thirdparty\BenchmarkDotNet\tests\BenchmarkDotNet.IntegrationTests\bin\Release\net10.0\BenchmarkDotNet.IntegrationTests-1\.artifacts\obj\BenchmarkDotNet.Autogenerated\release_nMAet10.0_win-x64\native\BenchmarkDotNet.IntegrationTests-1.sourcelink' [C:\Projects\GitHub\thirdparty\BenchmarkDotNet\tests\BenchmarkDotNet.IntegrationTests\bin\Release\net10.0\BenchmarkDotNet.IntegrationTests-1\BenchmarkDotNet.Autogenerated.csproj::TargetFramework=net10.0]
C:\Users\admin\.nuget\packages\microsoft.dotnet.ilcompiler\10.0.9\build\Microsoft.NETCore.Native.targets(396,5): error MSB3073: The command ""C:\Program Files\Microsoft Visual Studio\18\Insiders\VC\Tools\MSVC\14.51.36231\bin\Hostx64\x64\link.exe" @"C:\Projects\GitHub\thirdparty\BenchmarkDotNet\tests\BenchmarkDotNet.IntegrationTests\bin\Release\net10.0\BenchmarkDotNet.IntegrationTests-1\.artifacts\obj\BenchmarkDotNet.Autogenerated\release_net10.0_win-x64\native\link.rsp"" exited with code 1104. [C:\Projects\GitHub\thirdparty\BenchmarkDotNet\tests\BenchmarkDotNet.IntegrationTests\bin\Release\net10.0\BenchmarkDotNet.IntegrationTests-1\BenchmarkDotNet.Autogenerated.csproj::TargetFramework=net10.0]

It looks like issue is caused by following path length is 262 and over MAX_PATH (260 chars)

C:\Projects\GitHub\thirdparty\BenchmarkDotNet\tests\BenchmarkDotNet.IntegrationTests\bin\Release\net10.0\BenchmarkDotNet.IntegrationTests-1.artifacts\obj\BenchmarkDotNet.Autogenerated\release_net10.0_win-x64\native\BenchmarkDotNet.IntegrationTests-1.sourcelink

On my environment, LongPathsEnabled setting is enabled.
Though link.exe seems not accept path over MAX_PATH length. (It's confirmed by execution link.exe standalone)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions