Skip to content
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

win-arm64 native files in the nuget tree breaks builds from linux/mac #46635

Closed
lilith opened this issue Feb 7, 2025 · 3 comments
Closed

win-arm64 native files in the nuget tree breaks builds from linux/mac #46635

lilith opened this issue Feb 7, 2025 · 3 comments
Labels
Area-NuGet untriaged Request triage from a team member

Comments

@lilith
Copy link

lilith commented Feb 7, 2025

Describe the bug

dotnet restore has broken restore logic around packages that just contain win-arm64 native binaries. Specifically, those native files don't get copied, which later crashes the build even though they're not used in the end. On Windows (even x64), they DO get copied, but on linux-x64/linux-arm64/osx, they do not. The error message is no help:

"GenerateDepsFile" task failed unexpectedly [..] error MSB4018: System.IO.FileNotFoundException: /Users/runner/.nuget/packages/imageflow.nativeruntime.win-arm64/2.1.0-rc01/runtimes/win-arm64/native/imageflow.dll

I was able to narrow this down by listing all native binaries in /Users/runner/.nuget/packages/imageflow.nativeruntime.* before and after dotnet restore.

Here's the workflow run, showing the failures. Only those with (os,true, [rid]) attempted the test.
https://github.com/imazen/imageflow-dotnet/actions/runs/13194655584

To Reproduce

Checkout https://github.com/imazen/imageflow-dotnet/tree/win-arm64-breaks-others
Execute tests/Imageflow.TestWebAOT/test.ps1

Or, depend on https://www.nuget.org/packages/Imageflow.NativeRuntime.win-arm64/2.1.0-rc01 (transitively) and try to build on a non-windows platform.

https://github.com/imazen/imageflow-dotnet/blob/21ee14fd051323185fc83a75527f8d593548fda5/tests/Imageflow.TestWebAOT/test.ps1

Special notes

On precisely one OS+sdk combo, if dotnet restore is run from /src - rather than silently failing to do its job - it provided this helpful NU1202 error

/home/lilith/.nuget/packages/imageflow.nativeruntime.win-x86_64/2.1.0-rc01/runtimes/win-x64/native/imageflow.dll
    /home/lilith/work/imageflow-dotnet/src/Imageflow.AllPlatforms/Imageflow.AllPlatforms.csproj : error NU1202: Package Imageflow.NativeRuntime.win-arm64 2.1.0-rc01 is not compatible with net8.0 (.NETCoreApp,Version=v8.0). Package Imageflow.NativeRuntime.win-arm64 2.1.0-rc01 supports: netstandard1.0 (.NETStandard,Version=v1.0)
    /home/lilith/work/imageflow-dotnet/src/Imageflow.AllPlatforms/Imageflow.AllPlatforms.csproj : error NU1202: Package Imageflow.NativeRuntime.win-arm64 2.1.0-rc01 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package Imageflow.NativeRuntime.win-arm64 2.1.0-rc01 supports: netstandard1.0 (.NETStandard,Version=v1.0)
    /home/lilith/work/imageflow-dotnet/src/Imageflow.AllPlatforms/Imageflow.AllPlatforms.csproj : error NU1202: Package Imageflow.NativeRuntime.win-arm64 2.1.0-rc01 is not compatible with net8.0 (.NETCoreApp,Version=v8.0) / linux-x64. Package Imageflow.NativeRuntime.win-arm64 2.1.0-rc01 supports: netstandard1.0 (.NETStandard,Version=v1.0)
    /home/lilith/work/imageflow-dotnet/src/Imageflow.AllPlatforms/Imageflow.AllPlatforms.csproj : error NU1202: Package Imageflow.NativeRuntime.win-arm64 2.1.0-rc01 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0) / linux-x64. Package Imageflow.NativeRuntime.win-arm64 2.1.0-rc01 supports: netstandard1.0 (.NETStandard,Version=v1.0)

However, this error is not thrown on windows, and stuff just works. And this also brings up the question of HOW netstandard1.0 isn't compatible with .net8.0 or netstandard2.0, and why this is only true for this package with a runtimes/win-arm64/native/imageflow.dll file in it, and also only true when the SDK isn't on windows.

BIZARRELY, right after dotnet restore throws something possibly useful, a subsequent execution of dotnet publish silently does the wrong thing and then crashes as always.

Exception

Restore complete (0.6s)
  Imageflow.Net net8.0 succeeded (0.1s) → Imageflow/bin/Release/net8.0/Imageflow.Net.dll
  Imageflow.AllPlatforms net8.0 failed with 1 error(s) (0.3s)
    /usr/share/dotnet/sdk/9.0.102/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(322,5): error MSB4018: 
      The "GenerateDepsFile" task failed unexpectedly.
      System.IO.FileNotFoundException: /home/lilith/.nuget/packages/imageflow.nativeruntime.win-arm64/2.1.0-rc01/runtimes/win-arm64/native/imageflow.dll
         at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)

Further technical details

PS /home/lilith/work/imageflow-dotnet/tests/Imageflow.TestWebAOT> dotnet --info
.NET SDK:
 Version:           9.0.102
 Commit:            cb83cd4923
 Workload version:  9.0.100-manifests.43af17c7
 MSBuild version:   17.12.18+ed8c6aec5

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  22.04
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/9.0.102/

.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.

Host:
  Version:      9.0.1
  Architecture: x64
  Commit:       c8acea2262

.NET SDKs installed:
  6.0.424 [/usr/share/dotnet/sdk]
  7.0.410 [/usr/share/dotnet/sdk]
  8.0.405 [/usr/share/dotnet/sdk]
  9.0.102 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.12 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.12 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT       [/usr/lib/dotnet]

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-NuGet untriaged Request triage from a team member labels Feb 7, 2025
@lilith
Copy link
Author

lilith commented Feb 7, 2025

I tried removing netstandard1.0 as a dependency of the native packages. Rather than fixing the issue, it makes that revision nonexistent as far as mac/nix dotnet is concerned. But only for win-arm64.

PS /home/lilith/work/imageflow-dotnet> dotnet restore src/Imageflow.dncore.sln --force
    /home/lilith/work/imageflow-dotnet/src/Imageflow.AllPlatforms/Imageflow.AllPlatforms.csproj : error NU1102: 
      Unable to find package Imageflow.NativeRuntime.win-arm64 with version (>= 2.1.0-rc02)
        - Found 1 version(s) in nuget.org [ Nearest version: 2.1.0-rc01 ]
    /home/lilith/work/imageflow-dotnet/tests/Imageflow.Test/Imageflow.Test.csproj : error NU1102: 
      Unable to find package Imageflow.NativeRuntime.win-arm64 with version (>= 2.1.0-rc02)
        - Found 1 version(s) in nuget.org [ Nearest version: 2.1.0-rc01 ]

After spending nearly $100 on github runner CPU and months to get win-arm supported on my open-source projects, I'm realizing that .NET doesn't really support it either.

Copy link
Contributor

Thanks for creating this issue! We believe this issue is related to NuGet tooling, which is maintained by the NuGet team. Thus, we closed this one and encourage you to raise this issue in the NuGet repository instead. Don’t forget to check out NuGet’s contributing guide before submitting an issue!

If you believe this issue was closed out of error, please comment to let us know.

Happy Coding!

@lilith
Copy link
Author

lilith commented Feb 7, 2025

You can't transfer the issue? TBH, my biggest business liability is .NET at this point, with tooling bugs costing more than development overall.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-NuGet untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

1 participant