Closed jamescrosswell closed 1 week ago
The specific source of the error is line 117 here:
<!-- Skip this target for design time builds when there are missing workload packs.
This will prevent design time builds from failing and therefore allow
Visual Studio to collect the workloads from the GetSuggestedWorkloads target -->
<Target Name="_CheckForUnsupportedTargetPlatformIdentifier"
BeforeTargets="_CheckForInvalidConfigurationAndPlatform;RunResolvePackageDependencies;GetFrameworkPaths;GetReferenceAssemblyPaths;CollectPackageReferences"
Condition="'$(TargetPlatformIdentifier)' != '' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 5.0)) And ('$(DesignTimeBuild)' != 'true' Or '@(MissingWorkloadPack)' == '')" >
<PropertyGroup>
<TargetPlatformSupported Condition="'$(TargetPlatformIdentifier)' == 'Windows'">true</TargetPlatformSupported>
<UseWorkloadsSpecificError Condition="($(TargetPlatformIdentifier) == 'ios' or $(TargetPlatformIdentifier) == 'tvos' or $(TargetPlatformIdentifier) == 'maccatalyst' or $(TargetPlatformIdentifier) == 'android' or $(TargetPlatformIdentifier.StartsWith('browser'))) and '$(MSBuildEnableWorkloadResolver)' != 'true'">true</UseWorkloadsSpecificError>
</PropertyGroup>
<NETSdkError Condition="'$(TargetPlatformSupported)' != 'true' and '$(UseWorkloadsSpecificError)' != 'true'"
ResourceName="UnsupportedTargetPlatformIdentifier"
FormatArguments="$(TargetPlatformIdentifier)" />
<NETSdkError Condition="'$(TargetPlatformSupported)' != 'true' and '$(UseWorkloadsSpecificError)' == 'true'"
ResourceName="UnsupportedTargetPlatformIdentifierWithWorkloadsDisabled"
FormatArguments="$(TargetPlatformIdentifier)" />
</Target>
I'm not really sure I understand this check:
_CheckForUnsupportedTargetPlatformIdentifier
will always evaluate to true TargetPlatformSupported
gets set... searching the source code it seems the only place it gets set is here and only when dealing with windows targets. So TargetPlatformSupported
will always be false when targeting net8.0-android
.
UseWorkloadsSpecificError
will be true if '$(MSBuildEnableWorkloadResolver)' != 'true'
... again, not sure how/where that gets setIn any event, a diagnostic log of one of our failed runs is attached. Restore Output.zip
It looks like there are some initial errors... some of which appear to be related to the .NET 7 SDK missing (even though we explicitly install this before running dotnet restore
).
Errors: MSB4276: The default SDK resolver failed to resolve SDK "Microsoft.NET.SDK.WorkloadAutoImportPropsLocator" because directory "C:\Program Files\dotnet\sdk\8.0.404\Sdks\Microsoft.NET.SDK.WorkloadAutoImportPropsLocator\Sdk" did not exist.
Errors: MSB4276: The default SDK resolver failed to resolve SDK "Microsoft.NET.SDK.WorkloadManifestTargetsLocator" because directory "C:\Program Files\dotnet\sdk\8.0.404\Sdks\Microsoft.NET.SDK.WorkloadManifestTargetsLocator\Sdk" did not exist.
Errors: MSB4276: The default SDK resolver failed to resolve SDK "Microsoft.Android.Sdk.net7" because directory "C:\Program Files\dotnet\sdk\8.0.404\Sdks\Microsoft.Android.Sdk.net7\Sdk" did not exist.
Errors: MSB4276: The default SDK resolver failed to resolve SDK "Microsoft.NET.Runtime.MonoTargets.Sdk.net7" because directory "C:\Program Files\dotnet\sdk\8.0.404\Sdks\Microsoft.NET.Runtime.MonoTargets.Sdk.net7\Sdk" did not exist.
Errors: MSB4276: The default SDK resolver failed to resolve SDK "Microsoft.Maui.Sdk.net7" because directory "C:\Program Files\dotnet\sdk\8.0.404\Sdks\Microsoft.Maui.Sdk.net7\Sdk" did not exist.
Later eventaully we get the errors that show up in the GitHub console logs... there are 6 of these (for 6 different projects) but they're all more or less the same. Here's one from line 626,480 (the failure happens at the end of this snippet):
22:59:18.904 59:35>Project "D:\a\sentry-dotnet\sentry-dotnet\test\Sentry.Testing\Sentry.Testing.csproj" (59:35) is building "D:\a\sentry-dotnet\sentry-dotnet\test\Sentry.Testing\Sentry.Testing.csproj" (59:47) on node 1 (_GenerateProjectRestoreGraphPerFramework target(s)).
22:59:02.020 1>Project "D:\a\sentry-dotnet\sentry-dotnet\Sentry-CI-Build-Windows.slnf" (1) is building "D:\a\sentry-dotnet\sentry-dotnet\src\Sentry.Serilog\Sentry.Serilog.csproj" (39:18) on node 3 (_GenerateProjectRestoreGraph target(s)).
22:59:19.078 59:47>Target "_GetProjectJsonPath: (TargetId:731)" in file "C:\Program Files\dotnet\sdk\8.0.404\NuGet.targets" from project "D:\a\sentry-dotnet\sentry-dotnet\test\Sentry.Testing\Sentry.Testing.csproj" (target "_GetRestoreProjectStyle" depends on it):
22:59:19.078 59:47>Task "GetRestoreProjectJsonPathTask" skipped, due to false condition; ( '$(RestoreProjectStyle)' == 'ProjectJson' OR '$(RestoreProjectStyle)' == '' ) was evaluated as ( 'PackageReference' == 'ProjectJson' OR 'PackageReference' == '' ).
22:59:19.078 59:47>Done building target "_GetProjectJsonPath" in project "Sentry.Testing.csproj".: (TargetId:731)
Target "_CheckForMissingWorkload" skipped, due to false condition; ('@(MissingWorkloadPack)' != '' And '$(DesignTimeBuild)' != 'true') was evaluated as ('' != '' And '' != 'true').
22:59:19.038 27:24>ProcessFrameworkReferences: (TargetId:286)
Task Parameter:
FrameworkReferences=
Microsoft.NETCore.App
IsImplicitlyDefined=true
Pack=false
PrivateAssets=All
Microsoft.AspNetCore.App (TaskId:182)
22:59:19.049 41:54>_ComputeToolPackInputsToProcessFrameworkReferences: (TargetId:475)
Added Item(s):
_TargetFrameworkToSilenceEnableSingleFileAnalyzerUnsupportedWarning=
net6.0
SupportedByMinNonEolTargetFrameworkForAot=True
SupportedByMinNonEolTargetFrameworkForSingleFile=True
SupportedByMinNonEolTargetFrameworkForTrimming=True
SupportsAot=False
SupportsSingleFile=True
SupportsTrimming=True
22:59:19.078 59:47>Target "_CheckForUnsupportedTargetPlatformIdentifier: (TargetId:732)" in file "C:\Program Files\dotnet\sdk\8.0.404\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets" from project "D:\a\sentry-dotnet\sentry-dotnet\test\Sentry.Testing\Sentry.Testing.csproj" (target "CollectPackageReferences" depends on it):
22:59:19.078 59:47>Using "NETSdkError" task from assembly "C:\Program Files\dotnet\sdk\8.0.404\Sdks\Microsoft.NET.Sdk\targets\..\tools\net8.0\Microsoft.NET.Build.Tasks.dll".
Task "NETSdkError" (TaskId:618)
Task Parameter:FormatArguments=android (TaskId:618)
Task Parameter:ResourceName=UnsupportedTargetPlatformIdentifier (TaskId:618)
22:59:19.038 27:24>ProcessFrameworkReferences: (TargetId:286)
Task Parameter:MoreInformationLink=https://aka.ms/sdkimplicitrefs (TaskId:182)
22:59:19.079 59:47>C:\Program Files\dotnet\sdk\8.0.404\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(117,5): error NETSDK1139: The target platform identifier android was not recognized. [D:\a\sentry-dotnet\sentry-dotnet\test\Sentry.Testing\Sentry.Testing.csproj::TargetFramework=net8.0-android]
22:59:19.079 59:47>Done executing task "NETSdkError" -- FAILED. (TaskId:618)
I suspect but haven't confirmed that this issue actually relates to the net7.0 targets.
We're not seeing this issue on our version-5.0.0 branch where we've already dropped net7.0.
Rather than trying to do root cause analysis on whatever was broken in the latest windows-2022 image runner version then, we've decided to close this issue and expedite the v5.0.0 release.
Resolve https://github.com/getsentry/sentry-dotnet/issues/3759
Currently investigating.
We don't consistently get this error for the same commit. For example in this build run you can see that in Attempt 1,
dotnet restore
succeeded. Howeverdotnet restore
failed a second attempt on exactly the same commit.Although both runs use a windows-2022 runner, they are using different image versions:
There is no way to force github to use a specific runner image so it looks like the only solution is to determine what the relevant differences are between these two images and see if we can work around the issue in our build scripts 😢
Potentially relevant image differences
These are some of differences that seem like they might be relevant with respect to the specific error we're encountering:
Tracking issue
As this appears to be an issue with the runner rather than our repository, I've opened this issue in the actions/runner repository on github:
skip-changelog