[NativeAOT] Remove linux-arm as a supported RID in .NET8 - #102072

Merged
ivanpovazan merged 1 commit into
dotnet:release/8.0-stagingfrom
ivanpovazan:naot-delete-unsupported-rids
May 24, 2024
Merged

[NativeAOT] Remove linux-arm as a supported RID in .NET8#102072
ivanpovazan merged 1 commit into
dotnet:release/8.0-stagingfrom
ivanpovazan:naot-delete-unsupported-rids

Conversation

@ivanpovazan

Copy link
Copy Markdown
Member

Customer Impact

  • Customer reported
  • Found internally

In .NET8 linux-arm is incorrectly listed as the officially supported RID with NativeAOT:

<OfficialBuildRIDInclude="linux-arm"Platform="arm" />
which can cause build failures during project Restore as NuGet will not be able to find the required runtime package.

IMPORTANT: This does not impact .NET9 as we now do have support for linux-arm.

The customer issue - mobile scenario

In #100929 customer reported build failures when trying out NativeAOT deployments with their MAUI apps targeting iOS platforms with .NET8 from Visual Studio.

The project build fails during the Restore target with the following error:

_Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.3)
Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
Found 0 version(s) in /usr/local/share/dotnet/library-packs_

The internal find - desktop scenario

The same issue can occur with the following set up:

Project file:

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<RuntimeIdentifiers>linux-x64;linux-arm</RuntimeIdentifiers>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

Build with:

dotnet publish -f net8.0

Fails with:

/workspaces/tmp/naot.csproj : error NU1103: Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
/workspaces/tmp/naot.csproj : error NU1103: - Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]

Regression

  • Yes
  • No

As @MichalStrehovskynoted this seems to be a left over from: dotnet/runtimelab#1530 and was not discovered until now.

Testing

Manually verified that by removing the linux-arm entry from: ~/.nuget/packages/microsoft.dotnet.ilcompiler/8.0.2/runtime.json which is a file generated from ILCompilerRIDs.props fixes the issue and the project builds properly.

Risk

Low.


Fixes#100929

@ivanpovazanivanpovazan added Servicing-consider Issue for next servicing release review area-NativeAOT-coreclr labels May 10, 2024
@ivanpovazanivanpovazan added this to the 8.0.x milestone May 10, 2024
@ivanpovazanivanpovazan self-assigned this May 10, 2024
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

@ivanpovazan

Copy link
Copy Markdown
MemberAuthor

/cc: @simonrozsival

jkotas
jkotas previously requested changes May 10, 2024

@jkotasjkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think that this is the right fix

<ItemGroup>
<!-- The officially-supported subset of these RIDs should be included in ILCompilerSupportedRids in
https://github.com/dotnet/installer/blob/main/src/redist/targets/GenerateBundledVersions.targets -->
<OfficialBuildRID Include="linux-arm" Platform="arm" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lists all packages that may possibly exists.

linux-arm is not the only package that is not officially shipping. freebsd later in this list is not officially shipping either.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the key here is that nobody will have freebsd in their RuntimeIdentifiers because nothing will restore with that in the RuntimeIdentifiers list (even if we take native AOT out of the picture completely, like I did in the below):

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;freebsd-x64</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>

Running dotnet publish on this:

D:\restoreerror>dotnet publish -bl
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Runtime.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.App.Runtime.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Host.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
Restore failed with 3 error(s) in 1.4s

Now if we put native AOT back in the picture and try with a RID that is properly annotated as non-existent:

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

Try that:

D:\restoreerror>dotnet publish -bl
Restore complete (0.5s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
restoreerror succeeded (3.4s) → bin\Release\net8.0\win-x64\publish\
Build succeeded in 4.1s

Note this succeeded even though win-x86 doesn't work in .NET 8.

And now try with the bad one that is getting addressed here;

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;linux-arm</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

This results in:

D:\restoreerror>dotnet publish -bl
D:\restoreerror\restoreerror.csproj : error NU1103:
Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
- Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
- Found 0 version(s) in Microsoft Visual Studio Offline Packages
- Found 0 version(s) in C:\Program Files\dotnet\library-packs
- Found 0 version(s) in NET8
Restore failed with 1 error(s) in 1.6s

I think this fix is good and complete given NuGet's odd behaviors (I don't get why it needs to restore RIDs we're not building, but this behavior is not native AOT specific).

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you both.
I will investigate this further.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NuGet's odd behaviors (I don't get why it needs to restore RIDs we're not building

Isn't the whole purpose of RuntimeIdentifiers to tell NuGet the list of RIDs that you plan to build for, so that you can run a single restore and then build for multiple RIDs without redoing the restore?

@ivanpovazanivanpovazanMay 13, 2024

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW the presence of runtime.json makes NuGet Restore try to merge runtimes defined for Microsoft.DotNet.ILCompiler which I think causes the restore to fail (notice the: Merging in runtimes defined in package/Microsoft.DotNet.ILCompiler 8.0.2.).

For project:

 <PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifiers>osx-arm64;linux-arm</RuntimeIdentifiers>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
</PropertyGroup>

Built with: dotnet publish

Restoring packages for /Users/ivan/tmp/naot_rids/naot_rids.csproj...
Restoring packages for .NETCoreApp,Version=v8.0...
Resolving conflicts for net8.0...
Scanning packages for runtime.json files...
Merging in runtimes defined in package/Microsoft.DotNet.ILCompiler 8.0.2.
Restoring packages for net8.0/linux-arm...
Restoring packages for net8.0/osx-arm64...
Resolving conflicts for net8.0/osx-arm64...
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Algorithms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Algorithms.dll, MVID: 01b05f88-ddd1-481c-a82c-7cf815ec6308, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Primitives, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Primitives.dll, MVID: 5969dcae-99a3-40d5-9227-3330c81a8815, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Serialization.Formatters, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Serialization.Formatters.dll, MVID: 4014afb0-9078-4651-b39d-7ba50fba2edc, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Diagnostics.TraceSource, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Diagnostics.TraceSource.dll, MVID: e641c01b-b934-4762-b8e0-c746319635ff, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Data.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Data.Common.dll, MVID: 7f8f6503-7ea7-4c77-84de-bcde27273caa, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.ComponentModel, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.ComponentModel.dll, MVID: e92d0acc-26bc-4c82-85da-ffa2f4743b9c, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null (location: , MVID: d6dae581-dca2-42b0-8b60-c45bb1b744cf, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3-flatcontainer/runtime.linux-arm.microsoft.dotnet.ilcompiler/index.json
Resolving conflicts for net8.0/linux-arm...
1>/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: - Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: - Found 0 version(s) in /usr/local/share/dotnet/library-packs

while when I remove the entry for linux-arm (or completely remove runtime.json) the restore succeeds.

Restoring packages for .NETCoreApp,Version=v8.0...
Resolving conflicts for net8.0...
Scanning packages for runtime.json files...
Restoring packages for net8.0/linux-arm...
Resolving conflicts for net8.0/linux-arm...
Restoring packages for net8.0/osx-arm64...
Resolving conflicts for net8.0/osx-arm64...
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Net.Http, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Net.Http.dll, MVID: d15a0545-b86a-46a0-841b-8f1dd4433417, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Algorithms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Algorithms.dll, MVID: 01b05f88-ddd1-481c-a82c-7cf815ec6308, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Primitives, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Primitives.dll, MVID: 5969dcae-99a3-40d5-9227-3330c81a8815, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3/vulnerabilities/index.json
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Serialization.Formatters, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Serialization.Formatters.dll, MVID: 4014afb0-9078-4651-b39d-7ba50fba2edc, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Text.Encodings.Web, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Text.Encodings.Web.dll, MVID: 9fc1299c-c5e0-4fa8-9504-79550313bec2, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Intrinsics, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Intrinsics.dll, MVID: 8bbeaa60-2722-4527-be01-8b072b37ce67, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3-vulnerabilities/2024.05.11.01.16.50/vulnerability.base.json
CACHE https://api.nuget.org/v3-vulnerabilities/2024.05.11.01.16.50/2024.05.13.07.16.55/vulnerability.update.json
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Diagnostics.TraceSource, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Diagnostics.TraceSource.dll, MVID: e641c01b-b934-4762-b8e0-c746319635ff, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Data.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Data.Common.dll, MVID: 7f8f6503-7ea7-4c77-84de-bcde27273caa, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.ComponentModel, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.ComponentModel.dll, MVID: e92d0acc-26bc-4c82-85da-ffa2f4743b9c, AssemblyLoadContext: Default)
All packages and projects are compatible with net8.0.
All packages and projects are compatible with net8.0 (linux-arm).
All packages and projects are compatible with net8.0 (osx-arm64).
Committing restore...

This happens somewhere around: https://github.com/NuGet/NuGet.Client/blob/78c8c0fddd17dbf23e110c44ea1455f49e50363f/src/NuGet.Core/NuGet.Commands/RestoreCommand/ProjectRestoreCommand.cs#L458 and I am not super familiar with the code, but I suppose the build should probably bail out earlier than this.

@agocke

Copy link
Copy Markdown
Member

I believe we've hit this before with PublishAot in a project file that contains TFMs that don't support AOT, like

<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<PublishAot>true</PublishAot>
</PropertyGroup>

My recollection is that we suggested users condition the PublishAot property to fix this, i.e.

<PropertyGroupCondition="'$(TargetFramework)' != 'net6.0'">true</PropertyGroup>

I don't know if there's a better alternative.

@vitek-karas

Copy link
Copy Markdown
Member

The plan of this was to try to find a real fix for 8.0, assuming it's possible.

@jkotas
jkotas dismissed their stale reviewMay 13, 2024 13:42

Ok, I see why this helps with the linux-arm case in .NET 8. It is not a generic solution for the underlying problem.

@jeffschwMSFTjeffschwMSFT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. we will take for consideration in 8.0.x

@leecowleecow added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels May 21, 2024
@leecowleecow modified the milestones: 8.0.x, 8.0.7May 21, 2024
@ivanpovazan
ivanpovazan merged commit 44d8248 into dotnet:release/8.0-stagingMay 24, 2024
@ivanpovazan
ivanpovazan deleted the naot-delete-unsupported-rids branch May 24, 2024 09:38
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Jun 24, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-NativeAOT-coreclrServicing-approvedApproved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@ivanpovazan@agocke@vitek-karas@jkotas@jeffschwMSFT@MichalStrehovsky@leecow
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

[NativeAOT] Remove linux-arm as a supported RID in .NET8 - #102072

Merged
ivanpovazan merged 1 commit into
dotnet:release/8.0-stagingfrom
ivanpovazan:naot-delete-unsupported-rids
May 24, 2024
Merged

[NativeAOT] Remove linux-arm as a supported RID in .NET8#102072
ivanpovazan merged 1 commit into
dotnet:release/8.0-stagingfrom
ivanpovazan:naot-delete-unsupported-rids

Conversation

@ivanpovazan

Copy link
Copy Markdown
Member

Customer Impact

  • Customer reported
  • Found internally

In .NET8 linux-arm is incorrectly listed as the officially supported RID with NativeAOT:

<OfficialBuildRIDInclude="linux-arm"Platform="arm" />
which can cause build failures during project Restore as NuGet will not be able to find the required runtime package.

IMPORTANT: This does not impact .NET9 as we now do have support for linux-arm.

The customer issue - mobile scenario

In #100929 customer reported build failures when trying out NativeAOT deployments with their MAUI apps targeting iOS platforms with .NET8 from Visual Studio.

The project build fails during the Restore target with the following error:

_Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.3)
Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
Found 0 version(s) in /usr/local/share/dotnet/library-packs_

The internal find - desktop scenario

The same issue can occur with the following set up:

Project file:

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<RuntimeIdentifiers>linux-x64;linux-arm</RuntimeIdentifiers>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

Build with:

dotnet publish -f net8.0

Fails with:

/workspaces/tmp/naot.csproj : error NU1103: Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
/workspaces/tmp/naot.csproj : error NU1103: - Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]

Regression

  • Yes
  • No

As @MichalStrehovskynoted this seems to be a left over from: dotnet/runtimelab#1530 and was not discovered until now.

Testing

Manually verified that by removing the linux-arm entry from: ~/.nuget/packages/microsoft.dotnet.ilcompiler/8.0.2/runtime.json which is a file generated from ILCompilerRIDs.props fixes the issue and the project builds properly.

Risk

Low.


Fixes#100929

@ivanpovazanivanpovazan added Servicing-consider Issue for next servicing release review area-NativeAOT-coreclr labels May 10, 2024
@ivanpovazanivanpovazan added this to the 8.0.x milestone May 10, 2024
@ivanpovazanivanpovazan self-assigned this May 10, 2024
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

@ivanpovazan

Copy link
Copy Markdown
MemberAuthor

/cc: @simonrozsival

jkotas
jkotas previously requested changes May 10, 2024

@jkotasjkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think that this is the right fix

<ItemGroup>
<!-- The officially-supported subset of these RIDs should be included in ILCompilerSupportedRids in
https://github.com/dotnet/installer/blob/main/src/redist/targets/GenerateBundledVersions.targets -->
<OfficialBuildRID Include="linux-arm" Platform="arm" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lists all packages that may possibly exists.

linux-arm is not the only package that is not officially shipping. freebsd later in this list is not officially shipping either.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the key here is that nobody will have freebsd in their RuntimeIdentifiers because nothing will restore with that in the RuntimeIdentifiers list (even if we take native AOT out of the picture completely, like I did in the below):

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;freebsd-x64</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>

Running dotnet publish on this:

D:\restoreerror>dotnet publish -bl
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Runtime.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.App.Runtime.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Host.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
Restore failed with 3 error(s) in 1.4s

Now if we put native AOT back in the picture and try with a RID that is properly annotated as non-existent:

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

Try that:

D:\restoreerror>dotnet publish -bl
Restore complete (0.5s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
restoreerror succeeded (3.4s) → bin\Release\net8.0\win-x64\publish\
Build succeeded in 4.1s

Note this succeeded even though win-x86 doesn't work in .NET 8.

And now try with the bad one that is getting addressed here;

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;linux-arm</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

This results in:

D:\restoreerror>dotnet publish -bl
D:\restoreerror\restoreerror.csproj : error NU1103:
Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
- Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
- Found 0 version(s) in Microsoft Visual Studio Offline Packages
- Found 0 version(s) in C:\Program Files\dotnet\library-packs
- Found 0 version(s) in NET8
Restore failed with 1 error(s) in 1.6s

I think this fix is good and complete given NuGet's odd behaviors (I don't get why it needs to restore RIDs we're not building, but this behavior is not native AOT specific).

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you both.
I will investigate this further.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NuGet's odd behaviors (I don't get why it needs to restore RIDs we're not building

Isn't the whole purpose of RuntimeIdentifiers to tell NuGet the list of RIDs that you plan to build for, so that you can run a single restore and then build for multiple RIDs without redoing the restore?

@ivanpovazanivanpovazanMay 13, 2024

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW the presence of runtime.json makes NuGet Restore try to merge runtimes defined for Microsoft.DotNet.ILCompiler which I think causes the restore to fail (notice the: Merging in runtimes defined in package/Microsoft.DotNet.ILCompiler 8.0.2.).

For project:

 <PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifiers>osx-arm64;linux-arm</RuntimeIdentifiers>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
</PropertyGroup>

Built with: dotnet publish

Restoring packages for /Users/ivan/tmp/naot_rids/naot_rids.csproj...
Restoring packages for .NETCoreApp,Version=v8.0...
Resolving conflicts for net8.0...
Scanning packages for runtime.json files...
Merging in runtimes defined in package/Microsoft.DotNet.ILCompiler 8.0.2.
Restoring packages for net8.0/linux-arm...
Restoring packages for net8.0/osx-arm64...
Resolving conflicts for net8.0/osx-arm64...
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Algorithms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Algorithms.dll, MVID: 01b05f88-ddd1-481c-a82c-7cf815ec6308, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Primitives, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Primitives.dll, MVID: 5969dcae-99a3-40d5-9227-3330c81a8815, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Serialization.Formatters, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Serialization.Formatters.dll, MVID: 4014afb0-9078-4651-b39d-7ba50fba2edc, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Diagnostics.TraceSource, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Diagnostics.TraceSource.dll, MVID: e641c01b-b934-4762-b8e0-c746319635ff, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Data.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Data.Common.dll, MVID: 7f8f6503-7ea7-4c77-84de-bcde27273caa, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.ComponentModel, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.ComponentModel.dll, MVID: e92d0acc-26bc-4c82-85da-ffa2f4743b9c, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null (location: , MVID: d6dae581-dca2-42b0-8b60-c45bb1b744cf, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3-flatcontainer/runtime.linux-arm.microsoft.dotnet.ilcompiler/index.json
Resolving conflicts for net8.0/linux-arm...
1>/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: - Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: - Found 0 version(s) in /usr/local/share/dotnet/library-packs

while when I remove the entry for linux-arm (or completely remove runtime.json) the restore succeeds.

Restoring packages for .NETCoreApp,Version=v8.0...
Resolving conflicts for net8.0...
Scanning packages for runtime.json files...
Restoring packages for net8.0/linux-arm...
Resolving conflicts for net8.0/linux-arm...
Restoring packages for net8.0/osx-arm64...
Resolving conflicts for net8.0/osx-arm64...
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Net.Http, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Net.Http.dll, MVID: d15a0545-b86a-46a0-841b-8f1dd4433417, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Algorithms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Algorithms.dll, MVID: 01b05f88-ddd1-481c-a82c-7cf815ec6308, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Primitives, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Primitives.dll, MVID: 5969dcae-99a3-40d5-9227-3330c81a8815, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3/vulnerabilities/index.json
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Serialization.Formatters, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Serialization.Formatters.dll, MVID: 4014afb0-9078-4651-b39d-7ba50fba2edc, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Text.Encodings.Web, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Text.Encodings.Web.dll, MVID: 9fc1299c-c5e0-4fa8-9504-79550313bec2, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Intrinsics, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Intrinsics.dll, MVID: 8bbeaa60-2722-4527-be01-8b072b37ce67, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3-vulnerabilities/2024.05.11.01.16.50/vulnerability.base.json
CACHE https://api.nuget.org/v3-vulnerabilities/2024.05.11.01.16.50/2024.05.13.07.16.55/vulnerability.update.json
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Diagnostics.TraceSource, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Diagnostics.TraceSource.dll, MVID: e641c01b-b934-4762-b8e0-c746319635ff, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Data.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Data.Common.dll, MVID: 7f8f6503-7ea7-4c77-84de-bcde27273caa, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.ComponentModel, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.ComponentModel.dll, MVID: e92d0acc-26bc-4c82-85da-ffa2f4743b9c, AssemblyLoadContext: Default)
All packages and projects are compatible with net8.0.
All packages and projects are compatible with net8.0 (linux-arm).
All packages and projects are compatible with net8.0 (osx-arm64).
Committing restore...

This happens somewhere around: https://github.com/NuGet/NuGet.Client/blob/78c8c0fddd17dbf23e110c44ea1455f49e50363f/src/NuGet.Core/NuGet.Commands/RestoreCommand/ProjectRestoreCommand.cs#L458 and I am not super familiar with the code, but I suppose the build should probably bail out earlier than this.

@agocke

Copy link
Copy Markdown
Member

I believe we've hit this before with PublishAot in a project file that contains TFMs that don't support AOT, like

<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<PublishAot>true</PublishAot>
</PropertyGroup>

My recollection is that we suggested users condition the PublishAot property to fix this, i.e.

<PropertyGroupCondition="'$(TargetFramework)' != 'net6.0'">true</PropertyGroup>

I don't know if there's a better alternative.

@vitek-karas

Copy link
Copy Markdown
Member

The plan of this was to try to find a real fix for 8.0, assuming it's possible.

@jkotas
jkotas dismissed their stale reviewMay 13, 2024 13:42

Ok, I see why this helps with the linux-arm case in .NET 8. It is not a generic solution for the underlying problem.

@jeffschwMSFTjeffschwMSFT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. we will take for consideration in 8.0.x

@leecowleecow added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels May 21, 2024
@leecowleecow modified the milestones: 8.0.x, 8.0.7May 21, 2024
@ivanpovazan
ivanpovazan merged commit 44d8248 into dotnet:release/8.0-stagingMay 24, 2024
@ivanpovazan
ivanpovazan deleted the naot-delete-unsupported-rids branch May 24, 2024 09:38
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Jun 24, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-NativeAOT-coreclrServicing-approvedApproved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@ivanpovazan@agocke@vitek-karas@jkotas@jeffschwMSFT@MichalStrehovsky@leecow
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[NativeAOT] Remove linux-arm as a supported RID in .NET8 - #102072

Merged
ivanpovazan merged 1 commit into
dotnet:release/8.0-stagingfrom
ivanpovazan:naot-delete-unsupported-rids
May 24, 2024
Merged

[NativeAOT] Remove linux-arm as a supported RID in .NET8#102072
ivanpovazan merged 1 commit into
dotnet:release/8.0-stagingfrom
ivanpovazan:naot-delete-unsupported-rids

Conversation

@ivanpovazan

Copy link
Copy Markdown
Member

Customer Impact

  • Customer reported
  • Found internally

In .NET8 linux-arm is incorrectly listed as the officially supported RID with NativeAOT:

<OfficialBuildRIDInclude="linux-arm"Platform="arm" />
which can cause build failures during project Restore as NuGet will not be able to find the required runtime package.

IMPORTANT: This does not impact .NET9 as we now do have support for linux-arm.

The customer issue - mobile scenario

In #100929 customer reported build failures when trying out NativeAOT deployments with their MAUI apps targeting iOS platforms with .NET8 from Visual Studio.

The project build fails during the Restore target with the following error:

_Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.3)
Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
Found 0 version(s) in /usr/local/share/dotnet/library-packs_

The internal find - desktop scenario

The same issue can occur with the following set up:

Project file:

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<RuntimeIdentifiers>linux-x64;linux-arm</RuntimeIdentifiers>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

Build with:

dotnet publish -f net8.0

Fails with:

/workspaces/tmp/naot.csproj : error NU1103: Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
/workspaces/tmp/naot.csproj : error NU1103: - Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]

Regression

  • Yes
  • No

As @MichalStrehovskynoted this seems to be a left over from: dotnet/runtimelab#1530 and was not discovered until now.

Testing

Manually verified that by removing the linux-arm entry from: ~/.nuget/packages/microsoft.dotnet.ilcompiler/8.0.2/runtime.json which is a file generated from ILCompilerRIDs.props fixes the issue and the project builds properly.

Risk

Low.


Fixes#100929

@ivanpovazanivanpovazan added Servicing-consider Issue for next servicing release review area-NativeAOT-coreclr labels May 10, 2024
@ivanpovazanivanpovazan added this to the 8.0.x milestone May 10, 2024
@ivanpovazanivanpovazan self-assigned this May 10, 2024
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

@ivanpovazan

Copy link
Copy Markdown
MemberAuthor

/cc: @simonrozsival

jkotas
jkotas previously requested changes May 10, 2024

@jkotasjkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think that this is the right fix

<ItemGroup>
<!-- The officially-supported subset of these RIDs should be included in ILCompilerSupportedRids in
https://github.com/dotnet/installer/blob/main/src/redist/targets/GenerateBundledVersions.targets -->
<OfficialBuildRID Include="linux-arm" Platform="arm" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lists all packages that may possibly exists.

linux-arm is not the only package that is not officially shipping. freebsd later in this list is not officially shipping either.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the key here is that nobody will have freebsd in their RuntimeIdentifiers because nothing will restore with that in the RuntimeIdentifiers list (even if we take native AOT out of the picture completely, like I did in the below):

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;freebsd-x64</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>

Running dotnet publish on this:

D:\restoreerror>dotnet publish -bl
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Runtime.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.App.Runtime.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Host.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
Restore failed with 3 error(s) in 1.4s

Now if we put native AOT back in the picture and try with a RID that is properly annotated as non-existent:

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

Try that:

D:\restoreerror>dotnet publish -bl
Restore complete (0.5s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
restoreerror succeeded (3.4s) → bin\Release\net8.0\win-x64\publish\
Build succeeded in 4.1s

Note this succeeded even though win-x86 doesn't work in .NET 8.

And now try with the bad one that is getting addressed here;

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;linux-arm</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

This results in:

D:\restoreerror>dotnet publish -bl
D:\restoreerror\restoreerror.csproj : error NU1103:
Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
- Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
- Found 0 version(s) in Microsoft Visual Studio Offline Packages
- Found 0 version(s) in C:\Program Files\dotnet\library-packs
- Found 0 version(s) in NET8
Restore failed with 1 error(s) in 1.6s

I think this fix is good and complete given NuGet's odd behaviors (I don't get why it needs to restore RIDs we're not building, but this behavior is not native AOT specific).

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you both.
I will investigate this further.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NuGet's odd behaviors (I don't get why it needs to restore RIDs we're not building

Isn't the whole purpose of RuntimeIdentifiers to tell NuGet the list of RIDs that you plan to build for, so that you can run a single restore and then build for multiple RIDs without redoing the restore?

@ivanpovazanivanpovazanMay 13, 2024

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW the presence of runtime.json makes NuGet Restore try to merge runtimes defined for Microsoft.DotNet.ILCompiler which I think causes the restore to fail (notice the: Merging in runtimes defined in package/Microsoft.DotNet.ILCompiler 8.0.2.).

For project:

 <PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifiers>osx-arm64;linux-arm</RuntimeIdentifiers>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
</PropertyGroup>

Built with: dotnet publish

Restoring packages for /Users/ivan/tmp/naot_rids/naot_rids.csproj...
Restoring packages for .NETCoreApp,Version=v8.0...
Resolving conflicts for net8.0...
Scanning packages for runtime.json files...
Merging in runtimes defined in package/Microsoft.DotNet.ILCompiler 8.0.2.
Restoring packages for net8.0/linux-arm...
Restoring packages for net8.0/osx-arm64...
Resolving conflicts for net8.0/osx-arm64...
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Algorithms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Algorithms.dll, MVID: 01b05f88-ddd1-481c-a82c-7cf815ec6308, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Primitives, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Primitives.dll, MVID: 5969dcae-99a3-40d5-9227-3330c81a8815, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Serialization.Formatters, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Serialization.Formatters.dll, MVID: 4014afb0-9078-4651-b39d-7ba50fba2edc, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Diagnostics.TraceSource, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Diagnostics.TraceSource.dll, MVID: e641c01b-b934-4762-b8e0-c746319635ff, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Data.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Data.Common.dll, MVID: 7f8f6503-7ea7-4c77-84de-bcde27273caa, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.ComponentModel, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.ComponentModel.dll, MVID: e92d0acc-26bc-4c82-85da-ffa2f4743b9c, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null (location: , MVID: d6dae581-dca2-42b0-8b60-c45bb1b744cf, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3-flatcontainer/runtime.linux-arm.microsoft.dotnet.ilcompiler/index.json
Resolving conflicts for net8.0/linux-arm...
1>/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: - Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: - Found 0 version(s) in /usr/local/share/dotnet/library-packs

while when I remove the entry for linux-arm (or completely remove runtime.json) the restore succeeds.

Restoring packages for .NETCoreApp,Version=v8.0...
Resolving conflicts for net8.0...
Scanning packages for runtime.json files...
Restoring packages for net8.0/linux-arm...
Resolving conflicts for net8.0/linux-arm...
Restoring packages for net8.0/osx-arm64...
Resolving conflicts for net8.0/osx-arm64...
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Net.Http, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Net.Http.dll, MVID: d15a0545-b86a-46a0-841b-8f1dd4433417, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Algorithms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Algorithms.dll, MVID: 01b05f88-ddd1-481c-a82c-7cf815ec6308, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Primitives, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Primitives.dll, MVID: 5969dcae-99a3-40d5-9227-3330c81a8815, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3/vulnerabilities/index.json
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Serialization.Formatters, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Serialization.Formatters.dll, MVID: 4014afb0-9078-4651-b39d-7ba50fba2edc, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Text.Encodings.Web, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Text.Encodings.Web.dll, MVID: 9fc1299c-c5e0-4fa8-9504-79550313bec2, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Intrinsics, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Intrinsics.dll, MVID: 8bbeaa60-2722-4527-be01-8b072b37ce67, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3-vulnerabilities/2024.05.11.01.16.50/vulnerability.base.json
CACHE https://api.nuget.org/v3-vulnerabilities/2024.05.11.01.16.50/2024.05.13.07.16.55/vulnerability.update.json
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Diagnostics.TraceSource, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Diagnostics.TraceSource.dll, MVID: e641c01b-b934-4762-b8e0-c746319635ff, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Data.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Data.Common.dll, MVID: 7f8f6503-7ea7-4c77-84de-bcde27273caa, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.ComponentModel, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.ComponentModel.dll, MVID: e92d0acc-26bc-4c82-85da-ffa2f4743b9c, AssemblyLoadContext: Default)
All packages and projects are compatible with net8.0.
All packages and projects are compatible with net8.0 (linux-arm).
All packages and projects are compatible with net8.0 (osx-arm64).
Committing restore...

This happens somewhere around: https://github.com/NuGet/NuGet.Client/blob/78c8c0fddd17dbf23e110c44ea1455f49e50363f/src/NuGet.Core/NuGet.Commands/RestoreCommand/ProjectRestoreCommand.cs#L458 and I am not super familiar with the code, but I suppose the build should probably bail out earlier than this.

@agocke

Copy link
Copy Markdown
Member

I believe we've hit this before with PublishAot in a project file that contains TFMs that don't support AOT, like

<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<PublishAot>true</PublishAot>
</PropertyGroup>

My recollection is that we suggested users condition the PublishAot property to fix this, i.e.

<PropertyGroupCondition="'$(TargetFramework)' != 'net6.0'">true</PropertyGroup>

I don't know if there's a better alternative.

@vitek-karas

Copy link
Copy Markdown
Member

The plan of this was to try to find a real fix for 8.0, assuming it's possible.

@jkotas
jkotas dismissed their stale reviewMay 13, 2024 13:42

Ok, I see why this helps with the linux-arm case in .NET 8. It is not a generic solution for the underlying problem.

@jeffschwMSFTjeffschwMSFT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. we will take for consideration in 8.0.x

@leecowleecow added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels May 21, 2024
@leecowleecow modified the milestones: 8.0.x, 8.0.7May 21, 2024
@ivanpovazan
ivanpovazan merged commit 44d8248 into dotnet:release/8.0-stagingMay 24, 2024
@ivanpovazan
ivanpovazan deleted the naot-delete-unsupported-rids branch May 24, 2024 09:38
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Jun 24, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-NativeAOT-coreclrServicing-approvedApproved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@ivanpovazan@agocke@vitek-karas@jkotas@jeffschwMSFT@MichalStrehovsky@leecow
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[NativeAOT] Remove linux-arm as a supported RID in .NET8 - #102072

Merged
ivanpovazan merged 1 commit into
dotnet:release/8.0-stagingfrom
ivanpovazan:naot-delete-unsupported-rids
May 24, 2024
Merged

[NativeAOT] Remove linux-arm as a supported RID in .NET8#102072
ivanpovazan merged 1 commit into
dotnet:release/8.0-stagingfrom
ivanpovazan:naot-delete-unsupported-rids

Conversation

@ivanpovazan

Copy link
Copy Markdown
Member

Customer Impact

  • Customer reported
  • Found internally

In .NET8 linux-arm is incorrectly listed as the officially supported RID with NativeAOT:

<OfficialBuildRIDInclude="linux-arm"Platform="arm" />
which can cause build failures during project Restore as NuGet will not be able to find the required runtime package.

IMPORTANT: This does not impact .NET9 as we now do have support for linux-arm.

The customer issue - mobile scenario

In #100929 customer reported build failures when trying out NativeAOT deployments with their MAUI apps targeting iOS platforms with .NET8 from Visual Studio.

The project build fails during the Restore target with the following error:

_Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.3)
Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
Found 0 version(s) in /usr/local/share/dotnet/library-packs_

The internal find - desktop scenario

The same issue can occur with the following set up:

Project file:

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<RuntimeIdentifiers>linux-x64;linux-arm</RuntimeIdentifiers>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

Build with:

dotnet publish -f net8.0

Fails with:

/workspaces/tmp/naot.csproj : error NU1103: Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
/workspaces/tmp/naot.csproj : error NU1103: - Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]

Regression

  • Yes
  • No

As @MichalStrehovskynoted this seems to be a left over from: dotnet/runtimelab#1530 and was not discovered until now.

Testing

Manually verified that by removing the linux-arm entry from: ~/.nuget/packages/microsoft.dotnet.ilcompiler/8.0.2/runtime.json which is a file generated from ILCompilerRIDs.props fixes the issue and the project builds properly.

Risk

Low.


Fixes#100929

@ivanpovazanivanpovazan added Servicing-consider Issue for next servicing release review area-NativeAOT-coreclr labels May 10, 2024
@ivanpovazanivanpovazan added this to the 8.0.x milestone May 10, 2024
@ivanpovazanivanpovazan self-assigned this May 10, 2024
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

@ivanpovazan

Copy link
Copy Markdown
MemberAuthor

/cc: @simonrozsival

jkotas
jkotas previously requested changes May 10, 2024

@jkotasjkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think that this is the right fix

<ItemGroup>
<!-- The officially-supported subset of these RIDs should be included in ILCompilerSupportedRids in
https://github.com/dotnet/installer/blob/main/src/redist/targets/GenerateBundledVersions.targets -->
<OfficialBuildRID Include="linux-arm" Platform="arm" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lists all packages that may possibly exists.

linux-arm is not the only package that is not officially shipping. freebsd later in this list is not officially shipping either.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the key here is that nobody will have freebsd in their RuntimeIdentifiers because nothing will restore with that in the RuntimeIdentifiers list (even if we take native AOT out of the picture completely, like I did in the below):

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;freebsd-x64</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>

Running dotnet publish on this:

D:\restoreerror>dotnet publish -bl
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Runtime.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.App.Runtime.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Host.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
Restore failed with 3 error(s) in 1.4s

Now if we put native AOT back in the picture and try with a RID that is properly annotated as non-existent:

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

Try that:

D:\restoreerror>dotnet publish -bl
Restore complete (0.5s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
restoreerror succeeded (3.4s) → bin\Release\net8.0\win-x64\publish\
Build succeeded in 4.1s

Note this succeeded even though win-x86 doesn't work in .NET 8.

And now try with the bad one that is getting addressed here;

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;linux-arm</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

This results in:

D:\restoreerror>dotnet publish -bl
D:\restoreerror\restoreerror.csproj : error NU1103:
Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
- Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
- Found 0 version(s) in Microsoft Visual Studio Offline Packages
- Found 0 version(s) in C:\Program Files\dotnet\library-packs
- Found 0 version(s) in NET8
Restore failed with 1 error(s) in 1.6s

I think this fix is good and complete given NuGet's odd behaviors (I don't get why it needs to restore RIDs we're not building, but this behavior is not native AOT specific).

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you both.
I will investigate this further.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NuGet's odd behaviors (I don't get why it needs to restore RIDs we're not building

Isn't the whole purpose of RuntimeIdentifiers to tell NuGet the list of RIDs that you plan to build for, so that you can run a single restore and then build for multiple RIDs without redoing the restore?

@ivanpovazanivanpovazanMay 13, 2024

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW the presence of runtime.json makes NuGet Restore try to merge runtimes defined for Microsoft.DotNet.ILCompiler which I think causes the restore to fail (notice the: Merging in runtimes defined in package/Microsoft.DotNet.ILCompiler 8.0.2.).

For project:

 <PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifiers>osx-arm64;linux-arm</RuntimeIdentifiers>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
</PropertyGroup>

Built with: dotnet publish

Restoring packages for /Users/ivan/tmp/naot_rids/naot_rids.csproj...
Restoring packages for .NETCoreApp,Version=v8.0...
Resolving conflicts for net8.0...
Scanning packages for runtime.json files...
Merging in runtimes defined in package/Microsoft.DotNet.ILCompiler 8.0.2.
Restoring packages for net8.0/linux-arm...
Restoring packages for net8.0/osx-arm64...
Resolving conflicts for net8.0/osx-arm64...
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Algorithms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Algorithms.dll, MVID: 01b05f88-ddd1-481c-a82c-7cf815ec6308, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Primitives, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Primitives.dll, MVID: 5969dcae-99a3-40d5-9227-3330c81a8815, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Serialization.Formatters, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Serialization.Formatters.dll, MVID: 4014afb0-9078-4651-b39d-7ba50fba2edc, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Diagnostics.TraceSource, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Diagnostics.TraceSource.dll, MVID: e641c01b-b934-4762-b8e0-c746319635ff, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Data.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Data.Common.dll, MVID: 7f8f6503-7ea7-4c77-84de-bcde27273caa, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.ComponentModel, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.ComponentModel.dll, MVID: e92d0acc-26bc-4c82-85da-ffa2f4743b9c, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null (location: , MVID: d6dae581-dca2-42b0-8b60-c45bb1b744cf, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3-flatcontainer/runtime.linux-arm.microsoft.dotnet.ilcompiler/index.json
Resolving conflicts for net8.0/linux-arm...
1>/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: - Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: - Found 0 version(s) in /usr/local/share/dotnet/library-packs

while when I remove the entry for linux-arm (or completely remove runtime.json) the restore succeeds.

Restoring packages for .NETCoreApp,Version=v8.0...
Resolving conflicts for net8.0...
Scanning packages for runtime.json files...
Restoring packages for net8.0/linux-arm...
Resolving conflicts for net8.0/linux-arm...
Restoring packages for net8.0/osx-arm64...
Resolving conflicts for net8.0/osx-arm64...
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Net.Http, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Net.Http.dll, MVID: d15a0545-b86a-46a0-841b-8f1dd4433417, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Algorithms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Algorithms.dll, MVID: 01b05f88-ddd1-481c-a82c-7cf815ec6308, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Primitives, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Primitives.dll, MVID: 5969dcae-99a3-40d5-9227-3330c81a8815, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3/vulnerabilities/index.json
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Serialization.Formatters, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Serialization.Formatters.dll, MVID: 4014afb0-9078-4651-b39d-7ba50fba2edc, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Text.Encodings.Web, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Text.Encodings.Web.dll, MVID: 9fc1299c-c5e0-4fa8-9504-79550313bec2, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Intrinsics, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Intrinsics.dll, MVID: 8bbeaa60-2722-4527-be01-8b072b37ce67, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3-vulnerabilities/2024.05.11.01.16.50/vulnerability.base.json
CACHE https://api.nuget.org/v3-vulnerabilities/2024.05.11.01.16.50/2024.05.13.07.16.55/vulnerability.update.json
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Diagnostics.TraceSource, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Diagnostics.TraceSource.dll, MVID: e641c01b-b934-4762-b8e0-c746319635ff, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Data.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Data.Common.dll, MVID: 7f8f6503-7ea7-4c77-84de-bcde27273caa, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.ComponentModel, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.ComponentModel.dll, MVID: e92d0acc-26bc-4c82-85da-ffa2f4743b9c, AssemblyLoadContext: Default)
All packages and projects are compatible with net8.0.
All packages and projects are compatible with net8.0 (linux-arm).
All packages and projects are compatible with net8.0 (osx-arm64).
Committing restore...

This happens somewhere around: https://github.com/NuGet/NuGet.Client/blob/78c8c0fddd17dbf23e110c44ea1455f49e50363f/src/NuGet.Core/NuGet.Commands/RestoreCommand/ProjectRestoreCommand.cs#L458 and I am not super familiar with the code, but I suppose the build should probably bail out earlier than this.

@agocke

Copy link
Copy Markdown
Member

I believe we've hit this before with PublishAot in a project file that contains TFMs that don't support AOT, like

<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<PublishAot>true</PublishAot>
</PropertyGroup>

My recollection is that we suggested users condition the PublishAot property to fix this, i.e.

<PropertyGroupCondition="'$(TargetFramework)' != 'net6.0'">true</PropertyGroup>

I don't know if there's a better alternative.

@vitek-karas

Copy link
Copy Markdown
Member

The plan of this was to try to find a real fix for 8.0, assuming it's possible.

@jkotas
jkotas dismissed their stale reviewMay 13, 2024 13:42

Ok, I see why this helps with the linux-arm case in .NET 8. It is not a generic solution for the underlying problem.

@jeffschwMSFTjeffschwMSFT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. we will take for consideration in 8.0.x

@leecowleecow added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels May 21, 2024
@leecowleecow modified the milestones: 8.0.x, 8.0.7May 21, 2024
@ivanpovazan
ivanpovazan merged commit 44d8248 into dotnet:release/8.0-stagingMay 24, 2024
@ivanpovazan
ivanpovazan deleted the naot-delete-unsupported-rids branch May 24, 2024 09:38
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Jun 24, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-NativeAOT-coreclrServicing-approvedApproved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@ivanpovazan@agocke@vitek-karas@jkotas@jeffschwMSFT@MichalStrehovsky@leecow
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

[NativeAOT] Remove linux-arm as a supported RID in .NET8 - #102072

Merged
ivanpovazan merged 1 commit into
dotnet:release/8.0-stagingfrom
ivanpovazan:naot-delete-unsupported-rids
May 24, 2024
Merged

[NativeAOT] Remove linux-arm as a supported RID in .NET8#102072
ivanpovazan merged 1 commit into
dotnet:release/8.0-stagingfrom
ivanpovazan:naot-delete-unsupported-rids

Conversation

@ivanpovazan

Copy link
Copy Markdown
Member

Customer Impact

  • Customer reported
  • Found internally

In .NET8 linux-arm is incorrectly listed as the officially supported RID with NativeAOT:

<OfficialBuildRIDInclude="linux-arm"Platform="arm" />
which can cause build failures during project Restore as NuGet will not be able to find the required runtime package.

IMPORTANT: This does not impact .NET9 as we now do have support for linux-arm.

The customer issue - mobile scenario

In #100929 customer reported build failures when trying out NativeAOT deployments with their MAUI apps targeting iOS platforms with .NET8 from Visual Studio.

The project build fails during the Restore target with the following error:

_Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.3)
Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
Found 0 version(s) in /usr/local/share/dotnet/library-packs_

The internal find - desktop scenario

The same issue can occur with the following set up:

Project file:

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<RuntimeIdentifiers>linux-x64;linux-arm</RuntimeIdentifiers>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

Build with:

dotnet publish -f net8.0

Fails with:

/workspaces/tmp/naot.csproj : error NU1103: Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
/workspaces/tmp/naot.csproj : error NU1103: - Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]

Regression

  • Yes
  • No

As @MichalStrehovskynoted this seems to be a left over from: dotnet/runtimelab#1530 and was not discovered until now.

Testing

Manually verified that by removing the linux-arm entry from: ~/.nuget/packages/microsoft.dotnet.ilcompiler/8.0.2/runtime.json which is a file generated from ILCompilerRIDs.props fixes the issue and the project builds properly.

Risk

Low.


Fixes#100929

@ivanpovazanivanpovazan added Servicing-consider Issue for next servicing release review area-NativeAOT-coreclr labels May 10, 2024
@ivanpovazanivanpovazan added this to the 8.0.x milestone May 10, 2024
@ivanpovazanivanpovazan self-assigned this May 10, 2024
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

@ivanpovazan

Copy link
Copy Markdown
MemberAuthor

/cc: @simonrozsival

jkotas
jkotas previously requested changes May 10, 2024

@jkotasjkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think that this is the right fix

<ItemGroup>
<!-- The officially-supported subset of these RIDs should be included in ILCompilerSupportedRids in
https://github.com/dotnet/installer/blob/main/src/redist/targets/GenerateBundledVersions.targets -->
<OfficialBuildRID Include="linux-arm" Platform="arm" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lists all packages that may possibly exists.

linux-arm is not the only package that is not officially shipping. freebsd later in this list is not officially shipping either.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the key here is that nobody will have freebsd in their RuntimeIdentifiers because nothing will restore with that in the RuntimeIdentifiers list (even if we take native AOT out of the picture completely, like I did in the below):

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;freebsd-x64</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>

Running dotnet publish on this:

D:\restoreerror>dotnet publish -bl
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Runtime.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.App.Runtime.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Host.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
Restore failed with 3 error(s) in 1.4s

Now if we put native AOT back in the picture and try with a RID that is properly annotated as non-existent:

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

Try that:

D:\restoreerror>dotnet publish -bl
Restore complete (0.5s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
restoreerror succeeded (3.4s) → bin\Release\net8.0\win-x64\publish\
Build succeeded in 4.1s

Note this succeeded even though win-x86 doesn't work in .NET 8.

And now try with the bad one that is getting addressed here;

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;linux-arm</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

This results in:

D:\restoreerror>dotnet publish -bl
D:\restoreerror\restoreerror.csproj : error NU1103:
Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
- Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
- Found 0 version(s) in Microsoft Visual Studio Offline Packages
- Found 0 version(s) in C:\Program Files\dotnet\library-packs
- Found 0 version(s) in NET8
Restore failed with 1 error(s) in 1.6s

I think this fix is good and complete given NuGet's odd behaviors (I don't get why it needs to restore RIDs we're not building, but this behavior is not native AOT specific).

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you both.
I will investigate this further.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NuGet's odd behaviors (I don't get why it needs to restore RIDs we're not building

Isn't the whole purpose of RuntimeIdentifiers to tell NuGet the list of RIDs that you plan to build for, so that you can run a single restore and then build for multiple RIDs without redoing the restore?

@ivanpovazanivanpovazanMay 13, 2024

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW the presence of runtime.json makes NuGet Restore try to merge runtimes defined for Microsoft.DotNet.ILCompiler which I think causes the restore to fail (notice the: Merging in runtimes defined in package/Microsoft.DotNet.ILCompiler 8.0.2.).

For project:

 <PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifiers>osx-arm64;linux-arm</RuntimeIdentifiers>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
</PropertyGroup>

Built with: dotnet publish

Restoring packages for /Users/ivan/tmp/naot_rids/naot_rids.csproj...
Restoring packages for .NETCoreApp,Version=v8.0...
Resolving conflicts for net8.0...
Scanning packages for runtime.json files...
Merging in runtimes defined in package/Microsoft.DotNet.ILCompiler 8.0.2.
Restoring packages for net8.0/linux-arm...
Restoring packages for net8.0/osx-arm64...
Resolving conflicts for net8.0/osx-arm64...
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Algorithms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Algorithms.dll, MVID: 01b05f88-ddd1-481c-a82c-7cf815ec6308, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Primitives, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Primitives.dll, MVID: 5969dcae-99a3-40d5-9227-3330c81a8815, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Serialization.Formatters, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Serialization.Formatters.dll, MVID: 4014afb0-9078-4651-b39d-7ba50fba2edc, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Diagnostics.TraceSource, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Diagnostics.TraceSource.dll, MVID: e641c01b-b934-4762-b8e0-c746319635ff, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Data.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Data.Common.dll, MVID: 7f8f6503-7ea7-4c77-84de-bcde27273caa, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.ComponentModel, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.ComponentModel.dll, MVID: e92d0acc-26bc-4c82-85da-ffa2f4743b9c, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null (location: , MVID: d6dae581-dca2-42b0-8b60-c45bb1b744cf, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3-flatcontainer/runtime.linux-arm.microsoft.dotnet.ilcompiler/index.json
Resolving conflicts for net8.0/linux-arm...
1>/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: - Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: - Found 0 version(s) in /usr/local/share/dotnet/library-packs

while when I remove the entry for linux-arm (or completely remove runtime.json) the restore succeeds.

Restoring packages for .NETCoreApp,Version=v8.0...
Resolving conflicts for net8.0...
Scanning packages for runtime.json files...
Restoring packages for net8.0/linux-arm...
Resolving conflicts for net8.0/linux-arm...
Restoring packages for net8.0/osx-arm64...
Resolving conflicts for net8.0/osx-arm64...
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Net.Http, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Net.Http.dll, MVID: d15a0545-b86a-46a0-841b-8f1dd4433417, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Algorithms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Algorithms.dll, MVID: 01b05f88-ddd1-481c-a82c-7cf815ec6308, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Primitives, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Primitives.dll, MVID: 5969dcae-99a3-40d5-9227-3330c81a8815, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3/vulnerabilities/index.json
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Serialization.Formatters, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Serialization.Formatters.dll, MVID: 4014afb0-9078-4651-b39d-7ba50fba2edc, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Text.Encodings.Web, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Text.Encodings.Web.dll, MVID: 9fc1299c-c5e0-4fa8-9504-79550313bec2, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Intrinsics, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Intrinsics.dll, MVID: 8bbeaa60-2722-4527-be01-8b072b37ce67, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3-vulnerabilities/2024.05.11.01.16.50/vulnerability.base.json
CACHE https://api.nuget.org/v3-vulnerabilities/2024.05.11.01.16.50/2024.05.13.07.16.55/vulnerability.update.json
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Diagnostics.TraceSource, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Diagnostics.TraceSource.dll, MVID: e641c01b-b934-4762-b8e0-c746319635ff, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Data.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Data.Common.dll, MVID: 7f8f6503-7ea7-4c77-84de-bcde27273caa, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.ComponentModel, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.ComponentModel.dll, MVID: e92d0acc-26bc-4c82-85da-ffa2f4743b9c, AssemblyLoadContext: Default)
All packages and projects are compatible with net8.0.
All packages and projects are compatible with net8.0 (linux-arm).
All packages and projects are compatible with net8.0 (osx-arm64).
Committing restore...

This happens somewhere around: https://github.com/NuGet/NuGet.Client/blob/78c8c0fddd17dbf23e110c44ea1455f49e50363f/src/NuGet.Core/NuGet.Commands/RestoreCommand/ProjectRestoreCommand.cs#L458 and I am not super familiar with the code, but I suppose the build should probably bail out earlier than this.

@agocke

Copy link
Copy Markdown
Member

I believe we've hit this before with PublishAot in a project file that contains TFMs that don't support AOT, like

<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<PublishAot>true</PublishAot>
</PropertyGroup>

My recollection is that we suggested users condition the PublishAot property to fix this, i.e.

<PropertyGroupCondition="'$(TargetFramework)' != 'net6.0'">true</PropertyGroup>

I don't know if there's a better alternative.

@vitek-karas

Copy link
Copy Markdown
Member

The plan of this was to try to find a real fix for 8.0, assuming it's possible.

@jkotas
jkotas dismissed their stale reviewMay 13, 2024 13:42

Ok, I see why this helps with the linux-arm case in .NET 8. It is not a generic solution for the underlying problem.

@jeffschwMSFTjeffschwMSFT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. we will take for consideration in 8.0.x

@leecowleecow added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels May 21, 2024
@leecowleecow modified the milestones: 8.0.x, 8.0.7May 21, 2024
@ivanpovazan
ivanpovazan merged commit 44d8248 into dotnet:release/8.0-stagingMay 24, 2024
@ivanpovazan
ivanpovazan deleted the naot-delete-unsupported-rids branch May 24, 2024 09:38
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Jun 24, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-NativeAOT-coreclrServicing-approvedApproved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@ivanpovazan@agocke@vitek-karas@jkotas@jeffschwMSFT@MichalStrehovsky@leecow
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[NativeAOT] Remove linux-arm as a supported RID in .NET8 - #102072

Merged
ivanpovazan merged 1 commit into
dotnet:release/8.0-stagingfrom
ivanpovazan:naot-delete-unsupported-rids
May 24, 2024
Merged

[NativeAOT] Remove linux-arm as a supported RID in .NET8#102072
ivanpovazan merged 1 commit into
dotnet:release/8.0-stagingfrom
ivanpovazan:naot-delete-unsupported-rids

Conversation

@ivanpovazan

Copy link
Copy Markdown
Member

Customer Impact

  • Customer reported
  • Found internally

In .NET8 linux-arm is incorrectly listed as the officially supported RID with NativeAOT:

<OfficialBuildRIDInclude="linux-arm"Platform="arm" />
which can cause build failures during project Restore as NuGet will not be able to find the required runtime package.

IMPORTANT: This does not impact .NET9 as we now do have support for linux-arm.

The customer issue - mobile scenario

In #100929 customer reported build failures when trying out NativeAOT deployments with their MAUI apps targeting iOS platforms with .NET8 from Visual Studio.

The project build fails during the Restore target with the following error:

_Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.3)
Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
Found 0 version(s) in /usr/local/share/dotnet/library-packs_

The internal find - desktop scenario

The same issue can occur with the following set up:

Project file:

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<RuntimeIdentifiers>linux-x64;linux-arm</RuntimeIdentifiers>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

Build with:

dotnet publish -f net8.0

Fails with:

/workspaces/tmp/naot.csproj : error NU1103: Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
/workspaces/tmp/naot.csproj : error NU1103: - Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]

Regression

  • Yes
  • No

As @MichalStrehovskynoted this seems to be a left over from: dotnet/runtimelab#1530 and was not discovered until now.

Testing

Manually verified that by removing the linux-arm entry from: ~/.nuget/packages/microsoft.dotnet.ilcompiler/8.0.2/runtime.json which is a file generated from ILCompilerRIDs.props fixes the issue and the project builds properly.

Risk

Low.


Fixes#100929

@ivanpovazanivanpovazan added Servicing-consider Issue for next servicing release review area-NativeAOT-coreclr labels May 10, 2024
@ivanpovazanivanpovazan added this to the 8.0.x milestone May 10, 2024
@ivanpovazanivanpovazan self-assigned this May 10, 2024
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

@ivanpovazan

Copy link
Copy Markdown
MemberAuthor

/cc: @simonrozsival

jkotas
jkotas previously requested changes May 10, 2024

@jkotasjkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think that this is the right fix

<ItemGroup>
<!-- The officially-supported subset of these RIDs should be included in ILCompilerSupportedRids in
https://github.com/dotnet/installer/blob/main/src/redist/targets/GenerateBundledVersions.targets -->
<OfficialBuildRID Include="linux-arm" Platform="arm" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lists all packages that may possibly exists.

linux-arm is not the only package that is not officially shipping. freebsd later in this list is not officially shipping either.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the key here is that nobody will have freebsd in their RuntimeIdentifiers because nothing will restore with that in the RuntimeIdentifiers list (even if we take native AOT out of the picture completely, like I did in the below):

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;freebsd-x64</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>

Running dotnet publish on this:

D:\restoreerror>dotnet publish -bl
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Runtime.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.App.Runtime.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Host.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
Restore failed with 3 error(s) in 1.4s

Now if we put native AOT back in the picture and try with a RID that is properly annotated as non-existent:

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

Try that:

D:\restoreerror>dotnet publish -bl
Restore complete (0.5s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
restoreerror succeeded (3.4s) → bin\Release\net8.0\win-x64\publish\
Build succeeded in 4.1s

Note this succeeded even though win-x86 doesn't work in .NET 8.

And now try with the bad one that is getting addressed here;

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;linux-arm</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

This results in:

D:\restoreerror>dotnet publish -bl
D:\restoreerror\restoreerror.csproj : error NU1103:
Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
- Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
- Found 0 version(s) in Microsoft Visual Studio Offline Packages
- Found 0 version(s) in C:\Program Files\dotnet\library-packs
- Found 0 version(s) in NET8
Restore failed with 1 error(s) in 1.6s

I think this fix is good and complete given NuGet's odd behaviors (I don't get why it needs to restore RIDs we're not building, but this behavior is not native AOT specific).

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you both.
I will investigate this further.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NuGet's odd behaviors (I don't get why it needs to restore RIDs we're not building

Isn't the whole purpose of RuntimeIdentifiers to tell NuGet the list of RIDs that you plan to build for, so that you can run a single restore and then build for multiple RIDs without redoing the restore?

@ivanpovazanivanpovazanMay 13, 2024

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW the presence of runtime.json makes NuGet Restore try to merge runtimes defined for Microsoft.DotNet.ILCompiler which I think causes the restore to fail (notice the: Merging in runtimes defined in package/Microsoft.DotNet.ILCompiler 8.0.2.).

For project:

 <PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifiers>osx-arm64;linux-arm</RuntimeIdentifiers>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
</PropertyGroup>

Built with: dotnet publish

Restoring packages for /Users/ivan/tmp/naot_rids/naot_rids.csproj...
Restoring packages for .NETCoreApp,Version=v8.0...
Resolving conflicts for net8.0...
Scanning packages for runtime.json files...
Merging in runtimes defined in package/Microsoft.DotNet.ILCompiler 8.0.2.
Restoring packages for net8.0/linux-arm...
Restoring packages for net8.0/osx-arm64...
Resolving conflicts for net8.0/osx-arm64...
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Algorithms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Algorithms.dll, MVID: 01b05f88-ddd1-481c-a82c-7cf815ec6308, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Primitives, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Primitives.dll, MVID: 5969dcae-99a3-40d5-9227-3330c81a8815, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Serialization.Formatters, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Serialization.Formatters.dll, MVID: 4014afb0-9078-4651-b39d-7ba50fba2edc, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Diagnostics.TraceSource, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Diagnostics.TraceSource.dll, MVID: e641c01b-b934-4762-b8e0-c746319635ff, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Data.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Data.Common.dll, MVID: 7f8f6503-7ea7-4c77-84de-bcde27273caa, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.ComponentModel, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.ComponentModel.dll, MVID: e92d0acc-26bc-4c82-85da-ffa2f4743b9c, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null (location: , MVID: d6dae581-dca2-42b0-8b60-c45bb1b744cf, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3-flatcontainer/runtime.linux-arm.microsoft.dotnet.ilcompiler/index.json
Resolving conflicts for net8.0/linux-arm...
1>/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: - Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: - Found 0 version(s) in /usr/local/share/dotnet/library-packs

while when I remove the entry for linux-arm (or completely remove runtime.json) the restore succeeds.

Restoring packages for .NETCoreApp,Version=v8.0...
Resolving conflicts for net8.0...
Scanning packages for runtime.json files...
Restoring packages for net8.0/linux-arm...
Resolving conflicts for net8.0/linux-arm...
Restoring packages for net8.0/osx-arm64...
Resolving conflicts for net8.0/osx-arm64...
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Net.Http, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Net.Http.dll, MVID: d15a0545-b86a-46a0-841b-8f1dd4433417, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Algorithms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Algorithms.dll, MVID: 01b05f88-ddd1-481c-a82c-7cf815ec6308, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Primitives, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Primitives.dll, MVID: 5969dcae-99a3-40d5-9227-3330c81a8815, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3/vulnerabilities/index.json
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Serialization.Formatters, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Serialization.Formatters.dll, MVID: 4014afb0-9078-4651-b39d-7ba50fba2edc, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Text.Encodings.Web, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Text.Encodings.Web.dll, MVID: 9fc1299c-c5e0-4fa8-9504-79550313bec2, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Intrinsics, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Intrinsics.dll, MVID: 8bbeaa60-2722-4527-be01-8b072b37ce67, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3-vulnerabilities/2024.05.11.01.16.50/vulnerability.base.json
CACHE https://api.nuget.org/v3-vulnerabilities/2024.05.11.01.16.50/2024.05.13.07.16.55/vulnerability.update.json
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Diagnostics.TraceSource, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Diagnostics.TraceSource.dll, MVID: e641c01b-b934-4762-b8e0-c746319635ff, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Data.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Data.Common.dll, MVID: 7f8f6503-7ea7-4c77-84de-bcde27273caa, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.ComponentModel, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.ComponentModel.dll, MVID: e92d0acc-26bc-4c82-85da-ffa2f4743b9c, AssemblyLoadContext: Default)
All packages and projects are compatible with net8.0.
All packages and projects are compatible with net8.0 (linux-arm).
All packages and projects are compatible with net8.0 (osx-arm64).
Committing restore...

This happens somewhere around: https://github.com/NuGet/NuGet.Client/blob/78c8c0fddd17dbf23e110c44ea1455f49e50363f/src/NuGet.Core/NuGet.Commands/RestoreCommand/ProjectRestoreCommand.cs#L458 and I am not super familiar with the code, but I suppose the build should probably bail out earlier than this.

@agocke

Copy link
Copy Markdown
Member

I believe we've hit this before with PublishAot in a project file that contains TFMs that don't support AOT, like

<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<PublishAot>true</PublishAot>
</PropertyGroup>

My recollection is that we suggested users condition the PublishAot property to fix this, i.e.

<PropertyGroupCondition="'$(TargetFramework)' != 'net6.0'">true</PropertyGroup>

I don't know if there's a better alternative.

@vitek-karas

Copy link
Copy Markdown
Member

The plan of this was to try to find a real fix for 8.0, assuming it's possible.

@jkotas
jkotas dismissed their stale reviewMay 13, 2024 13:42

Ok, I see why this helps with the linux-arm case in .NET 8. It is not a generic solution for the underlying problem.

@jeffschwMSFTjeffschwMSFT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. we will take for consideration in 8.0.x

@leecowleecow added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels May 21, 2024
@leecowleecow modified the milestones: 8.0.x, 8.0.7May 21, 2024
@ivanpovazan
ivanpovazan merged commit 44d8248 into dotnet:release/8.0-stagingMay 24, 2024
@ivanpovazan
ivanpovazan deleted the naot-delete-unsupported-rids branch May 24, 2024 09:38
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Jun 24, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-NativeAOT-coreclrServicing-approvedApproved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@ivanpovazan@agocke@vitek-karas@jkotas@jeffschwMSFT@MichalStrehovsky@leecow
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[NativeAOT] Remove linux-arm as a supported RID in .NET8 - #102072

Merged
ivanpovazan merged 1 commit into
dotnet:release/8.0-stagingfrom
ivanpovazan:naot-delete-unsupported-rids
May 24, 2024
Merged

[NativeAOT] Remove linux-arm as a supported RID in .NET8#102072
ivanpovazan merged 1 commit into
dotnet:release/8.0-stagingfrom
ivanpovazan:naot-delete-unsupported-rids

Conversation

@ivanpovazan

Copy link
Copy Markdown
Member

Customer Impact

  • Customer reported
  • Found internally

In .NET8 linux-arm is incorrectly listed as the officially supported RID with NativeAOT:

<OfficialBuildRIDInclude="linux-arm"Platform="arm" />
which can cause build failures during project Restore as NuGet will not be able to find the required runtime package.

IMPORTANT: This does not impact .NET9 as we now do have support for linux-arm.

The customer issue - mobile scenario

In #100929 customer reported build failures when trying out NativeAOT deployments with their MAUI apps targeting iOS platforms with .NET8 from Visual Studio.

The project build fails during the Restore target with the following error:

_Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.3)
Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
Found 0 version(s) in /usr/local/share/dotnet/library-packs_

The internal find - desktop scenario

The same issue can occur with the following set up:

Project file:

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<RuntimeIdentifiers>linux-x64;linux-arm</RuntimeIdentifiers>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

Build with:

dotnet publish -f net8.0

Fails with:

/workspaces/tmp/naot.csproj : error NU1103: Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
/workspaces/tmp/naot.csproj : error NU1103: - Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]

Regression

  • Yes
  • No

As @MichalStrehovskynoted this seems to be a left over from: dotnet/runtimelab#1530 and was not discovered until now.

Testing

Manually verified that by removing the linux-arm entry from: ~/.nuget/packages/microsoft.dotnet.ilcompiler/8.0.2/runtime.json which is a file generated from ILCompilerRIDs.props fixes the issue and the project builds properly.

Risk

Low.


Fixes#100929

@ivanpovazanivanpovazan added Servicing-consider Issue for next servicing release review area-NativeAOT-coreclr labels May 10, 2024
@ivanpovazanivanpovazan added this to the 8.0.x milestone May 10, 2024
@ivanpovazanivanpovazan self-assigned this May 10, 2024
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

@ivanpovazan

Copy link
Copy Markdown
MemberAuthor

/cc: @simonrozsival

jkotas
jkotas previously requested changes May 10, 2024

@jkotasjkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think that this is the right fix

<ItemGroup>
<!-- The officially-supported subset of these RIDs should be included in ILCompilerSupportedRids in
https://github.com/dotnet/installer/blob/main/src/redist/targets/GenerateBundledVersions.targets -->
<OfficialBuildRID Include="linux-arm" Platform="arm" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lists all packages that may possibly exists.

linux-arm is not the only package that is not officially shipping. freebsd later in this list is not officially shipping either.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the key here is that nobody will have freebsd in their RuntimeIdentifiers because nothing will restore with that in the RuntimeIdentifiers list (even if we take native AOT out of the picture completely, like I did in the below):

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;freebsd-x64</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>

Running dotnet publish on this:

D:\restoreerror>dotnet publish -bl
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Runtime.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.App.Runtime.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Host.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
Restore failed with 3 error(s) in 1.4s

Now if we put native AOT back in the picture and try with a RID that is properly annotated as non-existent:

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

Try that:

D:\restoreerror>dotnet publish -bl
Restore complete (0.5s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
restoreerror succeeded (3.4s) → bin\Release\net8.0\win-x64\publish\
Build succeeded in 4.1s

Note this succeeded even though win-x86 doesn't work in .NET 8.

And now try with the bad one that is getting addressed here;

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;linux-arm</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

This results in:

D:\restoreerror>dotnet publish -bl
D:\restoreerror\restoreerror.csproj : error NU1103:
Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
- Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
- Found 0 version(s) in Microsoft Visual Studio Offline Packages
- Found 0 version(s) in C:\Program Files\dotnet\library-packs
- Found 0 version(s) in NET8
Restore failed with 1 error(s) in 1.6s

I think this fix is good and complete given NuGet's odd behaviors (I don't get why it needs to restore RIDs we're not building, but this behavior is not native AOT specific).

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you both.
I will investigate this further.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NuGet's odd behaviors (I don't get why it needs to restore RIDs we're not building

Isn't the whole purpose of RuntimeIdentifiers to tell NuGet the list of RIDs that you plan to build for, so that you can run a single restore and then build for multiple RIDs without redoing the restore?

@ivanpovazanivanpovazanMay 13, 2024

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW the presence of runtime.json makes NuGet Restore try to merge runtimes defined for Microsoft.DotNet.ILCompiler which I think causes the restore to fail (notice the: Merging in runtimes defined in package/Microsoft.DotNet.ILCompiler 8.0.2.).

For project:

 <PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifiers>osx-arm64;linux-arm</RuntimeIdentifiers>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
</PropertyGroup>

Built with: dotnet publish

Restoring packages for /Users/ivan/tmp/naot_rids/naot_rids.csproj...
Restoring packages for .NETCoreApp,Version=v8.0...
Resolving conflicts for net8.0...
Scanning packages for runtime.json files...
Merging in runtimes defined in package/Microsoft.DotNet.ILCompiler 8.0.2.
Restoring packages for net8.0/linux-arm...
Restoring packages for net8.0/osx-arm64...
Resolving conflicts for net8.0/osx-arm64...
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Algorithms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Algorithms.dll, MVID: 01b05f88-ddd1-481c-a82c-7cf815ec6308, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Primitives, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Primitives.dll, MVID: 5969dcae-99a3-40d5-9227-3330c81a8815, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Serialization.Formatters, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Serialization.Formatters.dll, MVID: 4014afb0-9078-4651-b39d-7ba50fba2edc, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Diagnostics.TraceSource, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Diagnostics.TraceSource.dll, MVID: e641c01b-b934-4762-b8e0-c746319635ff, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Data.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Data.Common.dll, MVID: 7f8f6503-7ea7-4c77-84de-bcde27273caa, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.ComponentModel, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.ComponentModel.dll, MVID: e92d0acc-26bc-4c82-85da-ffa2f4743b9c, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null (location: , MVID: d6dae581-dca2-42b0-8b60-c45bb1b744cf, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3-flatcontainer/runtime.linux-arm.microsoft.dotnet.ilcompiler/index.json
Resolving conflicts for net8.0/linux-arm...
1>/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: - Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: - Found 0 version(s) in /usr/local/share/dotnet/library-packs

while when I remove the entry for linux-arm (or completely remove runtime.json) the restore succeeds.

Restoring packages for .NETCoreApp,Version=v8.0...
Resolving conflicts for net8.0...
Scanning packages for runtime.json files...
Restoring packages for net8.0/linux-arm...
Resolving conflicts for net8.0/linux-arm...
Restoring packages for net8.0/osx-arm64...
Resolving conflicts for net8.0/osx-arm64...
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Net.Http, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Net.Http.dll, MVID: d15a0545-b86a-46a0-841b-8f1dd4433417, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Algorithms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Algorithms.dll, MVID: 01b05f88-ddd1-481c-a82c-7cf815ec6308, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Primitives, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Primitives.dll, MVID: 5969dcae-99a3-40d5-9227-3330c81a8815, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3/vulnerabilities/index.json
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Serialization.Formatters, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Serialization.Formatters.dll, MVID: 4014afb0-9078-4651-b39d-7ba50fba2edc, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Text.Encodings.Web, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Text.Encodings.Web.dll, MVID: 9fc1299c-c5e0-4fa8-9504-79550313bec2, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Intrinsics, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Intrinsics.dll, MVID: 8bbeaa60-2722-4527-be01-8b072b37ce67, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3-vulnerabilities/2024.05.11.01.16.50/vulnerability.base.json
CACHE https://api.nuget.org/v3-vulnerabilities/2024.05.11.01.16.50/2024.05.13.07.16.55/vulnerability.update.json
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Diagnostics.TraceSource, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Diagnostics.TraceSource.dll, MVID: e641c01b-b934-4762-b8e0-c746319635ff, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Data.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Data.Common.dll, MVID: 7f8f6503-7ea7-4c77-84de-bcde27273caa, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.ComponentModel, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.ComponentModel.dll, MVID: e92d0acc-26bc-4c82-85da-ffa2f4743b9c, AssemblyLoadContext: Default)
All packages and projects are compatible with net8.0.
All packages and projects are compatible with net8.0 (linux-arm).
All packages and projects are compatible with net8.0 (osx-arm64).
Committing restore...

This happens somewhere around: https://github.com/NuGet/NuGet.Client/blob/78c8c0fddd17dbf23e110c44ea1455f49e50363f/src/NuGet.Core/NuGet.Commands/RestoreCommand/ProjectRestoreCommand.cs#L458 and I am not super familiar with the code, but I suppose the build should probably bail out earlier than this.

@agocke

Copy link
Copy Markdown
Member

I believe we've hit this before with PublishAot in a project file that contains TFMs that don't support AOT, like

<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<PublishAot>true</PublishAot>
</PropertyGroup>

My recollection is that we suggested users condition the PublishAot property to fix this, i.e.

<PropertyGroupCondition="'$(TargetFramework)' != 'net6.0'">true</PropertyGroup>

I don't know if there's a better alternative.

@vitek-karas

Copy link
Copy Markdown
Member

The plan of this was to try to find a real fix for 8.0, assuming it's possible.

@jkotas
jkotas dismissed their stale reviewMay 13, 2024 13:42

Ok, I see why this helps with the linux-arm case in .NET 8. It is not a generic solution for the underlying problem.

@jeffschwMSFTjeffschwMSFT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. we will take for consideration in 8.0.x

@leecowleecow added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels May 21, 2024
@leecowleecow modified the milestones: 8.0.x, 8.0.7May 21, 2024
@ivanpovazan
ivanpovazan merged commit 44d8248 into dotnet:release/8.0-stagingMay 24, 2024
@ivanpovazan
ivanpovazan deleted the naot-delete-unsupported-rids branch May 24, 2024 09:38
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Jun 24, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-NativeAOT-coreclrServicing-approvedApproved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@ivanpovazan@agocke@vitek-karas@jkotas@jeffschwMSFT@MichalStrehovsky@leecow
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

[NativeAOT] Remove linux-arm as a supported RID in .NET8 - #102072

Merged
ivanpovazan merged 1 commit into
dotnet:release/8.0-stagingfrom
ivanpovazan:naot-delete-unsupported-rids
May 24, 2024
Merged

[NativeAOT] Remove linux-arm as a supported RID in .NET8#102072
ivanpovazan merged 1 commit into
dotnet:release/8.0-stagingfrom
ivanpovazan:naot-delete-unsupported-rids

Conversation

@ivanpovazan

Copy link
Copy Markdown
Member

Customer Impact

  • Customer reported
  • Found internally

In .NET8 linux-arm is incorrectly listed as the officially supported RID with NativeAOT:

<OfficialBuildRIDInclude="linux-arm"Platform="arm" />
which can cause build failures during project Restore as NuGet will not be able to find the required runtime package.

IMPORTANT: This does not impact .NET9 as we now do have support for linux-arm.

The customer issue - mobile scenario

In #100929 customer reported build failures when trying out NativeAOT deployments with their MAUI apps targeting iOS platforms with .NET8 from Visual Studio.

The project build fails during the Restore target with the following error:

_Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.3)
Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
Found 0 version(s) in /usr/local/share/dotnet/library-packs_

The internal find - desktop scenario

The same issue can occur with the following set up:

Project file:

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<RuntimeIdentifiers>linux-x64;linux-arm</RuntimeIdentifiers>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

Build with:

dotnet publish -f net8.0

Fails with:

/workspaces/tmp/naot.csproj : error NU1103: Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
/workspaces/tmp/naot.csproj : error NU1103: - Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]

Regression

  • Yes
  • No

As @MichalStrehovskynoted this seems to be a left over from: dotnet/runtimelab#1530 and was not discovered until now.

Testing

Manually verified that by removing the linux-arm entry from: ~/.nuget/packages/microsoft.dotnet.ilcompiler/8.0.2/runtime.json which is a file generated from ILCompilerRIDs.props fixes the issue and the project builds properly.

Risk

Low.


Fixes#100929

@ivanpovazanivanpovazan added Servicing-consider Issue for next servicing release review area-NativeAOT-coreclr labels May 10, 2024
@ivanpovazanivanpovazan added this to the 8.0.x milestone May 10, 2024
@ivanpovazanivanpovazan self-assigned this May 10, 2024
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

@ivanpovazan

Copy link
Copy Markdown
MemberAuthor

/cc: @simonrozsival

jkotas
jkotas previously requested changes May 10, 2024

@jkotasjkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think that this is the right fix

<ItemGroup>
<!-- The officially-supported subset of these RIDs should be included in ILCompilerSupportedRids in
https://github.com/dotnet/installer/blob/main/src/redist/targets/GenerateBundledVersions.targets -->
<OfficialBuildRID Include="linux-arm" Platform="arm" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lists all packages that may possibly exists.

linux-arm is not the only package that is not officially shipping. freebsd later in this list is not officially shipping either.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the key here is that nobody will have freebsd in their RuntimeIdentifiers because nothing will restore with that in the RuntimeIdentifiers list (even if we take native AOT out of the picture completely, like I did in the below):

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;freebsd-x64</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>

Running dotnet publish on this:

D:\restoreerror>dotnet publish -bl
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Runtime.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.App.Runtime.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Host.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
Restore failed with 3 error(s) in 1.4s

Now if we put native AOT back in the picture and try with a RID that is properly annotated as non-existent:

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

Try that:

D:\restoreerror>dotnet publish -bl
Restore complete (0.5s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
restoreerror succeeded (3.4s) → bin\Release\net8.0\win-x64\publish\
Build succeeded in 4.1s

Note this succeeded even though win-x86 doesn't work in .NET 8.

And now try with the bad one that is getting addressed here;

<ProjectSdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;linux-arm</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>

This results in:

D:\restoreerror>dotnet publish -bl
D:\restoreerror\restoreerror.csproj : error NU1103:
Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
- Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
- Found 0 version(s) in Microsoft Visual Studio Offline Packages
- Found 0 version(s) in C:\Program Files\dotnet\library-packs
- Found 0 version(s) in NET8
Restore failed with 1 error(s) in 1.6s

I think this fix is good and complete given NuGet's odd behaviors (I don't get why it needs to restore RIDs we're not building, but this behavior is not native AOT specific).

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you both.
I will investigate this further.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NuGet's odd behaviors (I don't get why it needs to restore RIDs we're not building

Isn't the whole purpose of RuntimeIdentifiers to tell NuGet the list of RIDs that you plan to build for, so that you can run a single restore and then build for multiple RIDs without redoing the restore?

@ivanpovazanivanpovazanMay 13, 2024

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW the presence of runtime.json makes NuGet Restore try to merge runtimes defined for Microsoft.DotNet.ILCompiler which I think causes the restore to fail (notice the: Merging in runtimes defined in package/Microsoft.DotNet.ILCompiler 8.0.2.).

For project:

 <PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifiers>osx-arm64;linux-arm</RuntimeIdentifiers>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
</PropertyGroup>

Built with: dotnet publish

Restoring packages for /Users/ivan/tmp/naot_rids/naot_rids.csproj...
Restoring packages for .NETCoreApp,Version=v8.0...
Resolving conflicts for net8.0...
Scanning packages for runtime.json files...
Merging in runtimes defined in package/Microsoft.DotNet.ILCompiler 8.0.2.
Restoring packages for net8.0/linux-arm...
Restoring packages for net8.0/osx-arm64...
Resolving conflicts for net8.0/osx-arm64...
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Algorithms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Algorithms.dll, MVID: 01b05f88-ddd1-481c-a82c-7cf815ec6308, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Primitives, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Primitives.dll, MVID: 5969dcae-99a3-40d5-9227-3330c81a8815, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Serialization.Formatters, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Serialization.Formatters.dll, MVID: 4014afb0-9078-4651-b39d-7ba50fba2edc, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Diagnostics.TraceSource, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Diagnostics.TraceSource.dll, MVID: e641c01b-b934-4762-b8e0-c746319635ff, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Data.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Data.Common.dll, MVID: 7f8f6503-7ea7-4c77-84de-bcde27273caa, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.ComponentModel, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.ComponentModel.dll, MVID: e92d0acc-26bc-4c82-85da-ffa2f4743b9c, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null (location: , MVID: d6dae581-dca2-42b0-8b60-c45bb1b744cf, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3-flatcontainer/runtime.linux-arm.microsoft.dotnet.ilcompiler/index.json
Resolving conflicts for net8.0/linux-arm...
1>/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: - Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: - Found 0 version(s) in /usr/local/share/dotnet/library-packs

while when I remove the entry for linux-arm (or completely remove runtime.json) the restore succeeds.

Restoring packages for .NETCoreApp,Version=v8.0...
Resolving conflicts for net8.0...
Scanning packages for runtime.json files...
Restoring packages for net8.0/linux-arm...
Resolving conflicts for net8.0/linux-arm...
Restoring packages for net8.0/osx-arm64...
Resolving conflicts for net8.0/osx-arm64...
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Net.Http, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Net.Http.dll, MVID: d15a0545-b86a-46a0-841b-8f1dd4433417, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Algorithms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Algorithms.dll, MVID: 01b05f88-ddd1-481c-a82c-7cf815ec6308, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Primitives, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Primitives.dll, MVID: 5969dcae-99a3-40d5-9227-3330c81a8815, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3/vulnerabilities/index.json
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Serialization.Formatters, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Serialization.Formatters.dll, MVID: 4014afb0-9078-4651-b39d-7ba50fba2edc, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Text.Encodings.Web, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Text.Encodings.Web.dll, MVID: 9fc1299c-c5e0-4fa8-9504-79550313bec2, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Intrinsics, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Intrinsics.dll, MVID: 8bbeaa60-2722-4527-be01-8b072b37ce67, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3-vulnerabilities/2024.05.11.01.16.50/vulnerability.base.json
CACHE https://api.nuget.org/v3-vulnerabilities/2024.05.11.01.16.50/2024.05.13.07.16.55/vulnerability.update.json
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Diagnostics.TraceSource, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Diagnostics.TraceSource.dll, MVID: e641c01b-b934-4762-b8e0-c746319635ff, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Data.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Data.Common.dll, MVID: 7f8f6503-7ea7-4c77-84de-bcde27273caa, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.ComponentModel, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.ComponentModel.dll, MVID: e92d0acc-26bc-4c82-85da-ffa2f4743b9c, AssemblyLoadContext: Default)
All packages and projects are compatible with net8.0.
All packages and projects are compatible with net8.0 (linux-arm).
All packages and projects are compatible with net8.0 (osx-arm64).
Committing restore...

This happens somewhere around: https://github.com/NuGet/NuGet.Client/blob/78c8c0fddd17dbf23e110c44ea1455f49e50363f/src/NuGet.Core/NuGet.Commands/RestoreCommand/ProjectRestoreCommand.cs#L458 and I am not super familiar with the code, but I suppose the build should probably bail out earlier than this.

@agocke

Copy link
Copy Markdown
Member

I believe we've hit this before with PublishAot in a project file that contains TFMs that don't support AOT, like

<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<PublishAot>true</PublishAot>
</PropertyGroup>

My recollection is that we suggested users condition the PublishAot property to fix this, i.e.

<PropertyGroupCondition="'$(TargetFramework)' != 'net6.0'">true</PropertyGroup>

I don't know if there's a better alternative.

@vitek-karas

Copy link
Copy Markdown
Member

The plan of this was to try to find a real fix for 8.0, assuming it's possible.

@jkotas
jkotas dismissed their stale reviewMay 13, 2024 13:42

Ok, I see why this helps with the linux-arm case in .NET 8. It is not a generic solution for the underlying problem.

@jeffschwMSFTjeffschwMSFT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. we will take for consideration in 8.0.x

@leecowleecow added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels May 21, 2024
@leecowleecow modified the milestones: 8.0.x, 8.0.7May 21, 2024
@ivanpovazan
ivanpovazan merged commit 44d8248 into dotnet:release/8.0-stagingMay 24, 2024
@ivanpovazan
ivanpovazan deleted the naot-delete-unsupported-rids branch May 24, 2024 09:38
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Jun 24, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-NativeAOT-coreclrServicing-approvedApproved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@ivanpovazan@agocke@vitek-karas@jkotas@jeffschwMSFT@MichalStrehovsky@leecow