Repository navigation
Description
Description
Runtime does not support RID format for alpha / beta releases of Alpine Linux which uses a VERSION_ID format which goes as such: x.xx_alphayyyymmdd (i.e. alpine.3.17_alpha20220715-x64) During build, even when RID is added to JSON RID graph using source-build's _IsBootstrapping=true flag and eng/native/init-distro-rid.sh logics are modified to not cut what's after alpine.3, fails with MSB4018: System.FormatException: Input string was not in a correct format. in src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj(55,5)
Reproduction Steps
- Run
abuild -rusing aport as available here in current Alpine Edge environment
Expected behavior
Either GenerateRuntimeGraph should be able to cope with that VERSION_ID format, as it is within spec of /etc/os-release, or [System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier should cut whatever's after _ as irrelevant information, just as it does with subversions. (i.e 3.17.1 becomes 3.17, thus should 3.17_alpha20220715 become 3.17)
Actual behavior
Computed RID through eng/native/init-distro-rid is alpine.3-x64 and through [System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier it is alpine.3.17_alpha20220715-x64
Regression?
No response
Known Workarounds
No response
Configuration
Note that this is done within source-build environment with 6.0.107 release on an Alpine Linux LXC container. Many patches are also applied by Alpine's build system. Patches relevant to runtime are prefixed by runtime_ in aport here
Other information
Full error is as follows:
/var/build/dotnet6-fix-rid/community/dotnet6-stage0/src/source-build-tarball-6.0.107/src/runtime/artifacts/source-build/self/src/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj(55,5): error MSB4018: The "GenerateRuntimeGraph" task failed unexpectedly.
/var/build/dotnet6-fix-rid/community/dotnet6-stage0/src/source-build-tarball-6.0.107/src/runtime/artifacts/source-build/self/src/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj(55,5): error MSB4018: System.FormatException: Input string was not in a correct format.
/var/build/dotnet6-fix-rid/community/dotnet6-stage0/src/source-build-tarball-6.0.107/src/runtime/artifacts/source-build/self/src/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj(55,5): error MSB4018: at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)
/var/build/dotnet6-fix-rid/community/dotnet6-stage0/src/source-build-tarball-6.0.107/src/runtime/artifacts/source-build/self/src/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj(55,5): error MSB4018: at System.Version.TryParseComponent(ReadOnlySpan`1 component, String componentName, Boolean throwOnFailure, Int32& parsedComponent)
/var/build/dotnet6-fix-rid/community/dotnet6-stage0/src/source-build-tarball-6.0.107/src/runtime/artifacts/source-build/self/src/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj(55,5): error MSB4018: at System.Version.ParseVersion(ReadOnlySpan`1 input, Boolean throwOnFailure)
/var/build/dotnet6-fix-rid/community/dotnet6-stage0/src/source-build-tarball-6.0.107/src/runtime/artifacts/source-build/self/src/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj(55,5): error MSB4018: at System.Version.Parse(String input)
/var/build/dotnet6-fix-rid/community/dotnet6-stage0/src/source-build-tarball-6.0.107/src/runtime/artifacts/source-build/self/src/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj(55,5): error MSB4018: at Microsoft.NETCore.Platforms.BuildTasks.RuntimeVersion..ctor(String versionString) in /var/build/dotnet6-fix-rid/community/dotnet6-stage0/src/source-build-tarball-6.0.107/src/runtime/artifacts/source-build/self/src/src/libraries/Microsoft.NETCore.Platforms/src/RuntimeVersion.cs:line 37
/var/build/dotnet6-fix-rid/community/dotnet6-stage0/src/source-build-tarball-6.0.107/src/runtime/artifacts/source-build/self/src/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj(55,5): error MSB4018: at Microsoft.NETCore.Platforms.BuildTasks.RID.Parse(String runtimeIdentifier) in /var/build/dotnet6-fix-rid/community/dotnet6-stage0/src/source-build-tarball-6.0.107/src/runtime/artifacts/source-build/self/src/src/libraries/Microsoft.NETCore.Platforms/src/RID.cs:line 152
/var/build/dotnet6-fix-rid/community/dotnet6-stage0/src/source-build-tarball-6.0.107/src/runtime/artifacts/source-build/self/src/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj(55,5): error MSB4018: at Microsoft.NETCore.Platforms.BuildTasks.GenerateRuntimeGraph.AddRuntimeIdentifiers(ICollection`1 runtimeGroups) in /var/build/dotnet6-fix-rid/community/dotnet6-stage0/src/source-build-tarball-6.0.107/src/runtime/artifacts/source-build/self/src/src/libraries/Microsoft.NETCore.Platforms/src/GenerateRuntimeGraph.cs:line 325
/var/build/dotnet6-fix-rid/community/dotnet6-stage0/src/source-build-tarball-6.0.107/src/runtime/artifacts/source-build/self/src/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj(55,5): error MSB4018: at Microsoft.NETCore.Platforms.BuildTasks.GenerateRuntimeGraph.Execute() in /var/build/dotnet6-fix-rid/community/dotnet6-stage0/src/source-build-tarball-6.0.107/src/runtime/artifacts/source-build/self/src/src/libraries/Microsoft.NETCore.Platforms/src/GenerateRuntimeGraph.cs:line 157
/var/build/dotnet6-fix-rid/community/dotnet6-stage0/src/source-build-tarball-6.0.107/src/runtime/artifacts/source-build/self/src/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj(55,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
/var/build/dotnet6-fix-rid/community/dotnet6-stage0/src/source-build-tarball-6.0.107/src/runtime/artifacts/source-build/self/src/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj(55,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)
478 Warning(s)
1 Error(s)
Time Elapsed 00:10:20.07
Build failed with exit code 1. Check errors above.
/var/build/dotnet6-fix-rid/community/dotnet6-stage0/src/source-build-tarball-6.0.107/Tools/source-built/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/SourceBuildArcadeBuild.targets(194,5): error MSB3073: The command "./build.sh --arch x64 --configuration Release --allconfigurations --verbosity minimal --nodereuse false --warnAsError false /p:MicrosoftNetFrameworkReferenceAssembliesVersion=1.0.2 /p:PackageRid=alpine.3.17_alpha20220715-x64 /p:NoPgoOptimize=true /p:KeepNativeSymbols=true /p:RuntimeOS=alpine.3.17_alpha20220715 /p:PortableBuild=false /p:BuildDebPackage=false --cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE /p:ArcadeInnerBuildFromSource=true /p:DotNetBuildFromSource=true /p:RepoRoot=/var/build/dotnet6-fix-rid/community/dotnet6-stage0/src/source-build-tarball-6.0.107/src/runtime/artifacts/source-build/self/src/ /p:ArtifactsDir=/var/build/dotnet6-fix-rid/community/dotnet6-stage0/src/source-build-tarball-6.0.107/src/runtime/artifacts/source-build/self/src/artifacts/ /bl:/var/build/dotnet6-fix-rid/community/dotnet6-stage0/src/source-build-tarball-6.0.107/src/runtime/artifacts/source-build/self/src/artifacts/sourcebuild.binlog /p:ContinuousIntegrationBuild=true /p:SourceBuildOutputDir=/var/build/dotnet6-fix-rid/community/dotnet6-stage0/src/source-build-tarball-6.0.107/src/runtime/artifacts/source-build/ /p:SourceBuiltBlobFeedDir= /p:EnableSourceControlManagerQueries=false /p:EnableSourceLink=false /p:DeterministicSourcePaths=false /p:DotNetBuildOffline=true /p:DotNetPackageVersionPropsPath=/var/build/dotnet6-fix-rid/community/dotnet6-stage0/src/source-build-tarball-6.0.107/artifacts/obj/x64/Release/PackageVersions.props" exited with code 1. [/var/build/dotnet6-fix-rid/community/dotnet6-stage0/src/source-build-tarball-6.0.107/Tools/source-built/Microsoft.DotNet.Arcade.Sdk/tools/Build.proj]
Full log of build here
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity
ayakael commentedon Aug 8, 2022
The following bit of code is relevant to this issue:
runtime/src/native/corehost/hostmisc/pal.unix.cpp
Lines 718 to 748 in c1dba41
I think it'd be easy to fix if there was some logic put in place to strip any information following a '_' character, similar to how minor version numbers are stripped.
ayakael commentedon Aug 15, 2022
I've mitigated this issue by doing two things:
p:TargetRid=alpine.3.17-x64eng/native/init-distro-rid.shto cut out_*from `alpine.3.17_alpha20220715```As you see above, I removed the distro-specific
VERSION_IDnormalization logics in favor of distro-agnostic logics. I do not know if this would break build on other platforms, but it would probably be worthwhile to explore other ways to normalize this variable.LakshanF commentedon Aug 16, 2022
Moving to 8.0 since there is a mitigation
ayakael commentedon Nov 21, 2022
Of note, with #74504 changing
init-distro-rid.shis not necessary asTargetRidis now used to define__DistroRidwhen in source-build.[System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifiershould be changed as to parse allVERSION_IDvariables that respects the specification so thatTargetRidis well defined.ayakael commentedon Nov 23, 2022
To add to the above, this means the following manipulations should be supported on Alpine:
alpine.3.17.0-$arch-»alpine.3.17-$archalpine.3.17-$arch-»alpine.3.17-$archalpine.3.17_alpha-$arch-»alpine.3.17-$archalpine.3.17.0_rc1-»alpine.3.17-$archMy knowledge of c++ is non-existent, so I've been working on
pal.unix.cppto, just like cut anything after_, and then cut after..soutieslak commentedon Feb 16, 2023
Hi all, I think I've run into the same issue as described above.
I am using the official ASP.NET Core runtime image as my base image i.e. "mcr.microsoft.com/dotnet/aspnet:7.0.2-alpine3.17-amd64".
When I want to populate my image with my application, I follow these 4 basic steps:
dotnet restore
dotnet build
dotnet publish
copy the published app to the container
So in other words, I am publishing my application for all RIDs, but then when I run my container, I get a segmentation fault -> This is where I assumed its selecting the wrong RID.
I then tried a different approach, and instead of publishing my application for all RIDs, I targeted a specific RID i.e. 'linux-musl-x64'. This results in a single RID variant of my application. If I then copy this published app to the container, it works as expected.
As @ayakael mentioned, I think this is because I am using the 'alpine3.17-amd64' base image i.e. 'alpine.3.17-$arch' which seems like a manipulation that is not yet supported on Alpine. Is that right?
ayakael commentedon Mar 30, 2023
Sorry for the late reply! Your application should be supported. This issue occurs when running dotnet on
edge, thus you should not get a segmentation fault. Have you tried using the aspnetcore package that Alpine provides?agocke commentedon Jun 26, 2023
No longer relevant, as https://learn.microsoft.com/en-us/dotnet/core/compatibility/deployment/8.0/rid-asset-list is now the default in .NET 8.