Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NETSDK1094 errors in tests when using .NET 8 RC1 SDK #3591

Closed
mthalman opened this issue Aug 11, 2023 · 6 comments
Closed

NETSDK1094 errors in tests when using .NET 8 RC1 SDK #3591

mthalman opened this issue Aug 11, 2023 · 6 comments
Assignees
Labels
area-testing Improvements in CI and testing

Comments

@mthalman
Copy link
Member

mthalman commented Aug 11, 2023

The following error occurs, for all languages, when running the source-build smoke tests with a .NET 8 RC1 source-built SDK:

Error Message:

System.InvalidOperationException : Failed to execute /vmr/test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/Release/net8.0/.dotnet/dotnet publish --self-contained true -r linux-x64 /p:PublishTrimmed=true /p:PublishReadyToRun=true /bl:/vmr/test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/Release/net8.0/logs/BasicScenarioTests_Console_CSharp-publish-self-contained-linux-x64-trimmed-R2R.binlog -o /vmr/test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/Release/net8.0/projects-202308111856352233/BasicScenarioTests_Console_CSharp/bin/publish
Exit code: 1
MSBuild version 17.8.0-preview-23409-01+a998492eb for .NET
  Determining projects to restore...
/vmr/test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/Release/net8.0/.dotnet/sdk/8.0.100-rc.1.23411.1/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(90,5): error NETSDK1094: Unable to optimize assemblies for performance: a valid runtime package was not found. Either set the PublishReadyToRun property to false, or use a supported runtime identifier when publishing. When targeting .NET 6 or higher, make sure to restore packages with the PublishReadyToRun property set to true. [/vmr/test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/Release/net8.0/projects-202308111856352233/BasicScenarioTests_Console_CSharp/BasicScenarioTests_Console_CSharp.csproj]

Stack Trace:

Microsoft.DotNet.SourceBuild.SmokeTests.ExecuteHelper.ValidateExitCode(ValueTuple`3 result, Int32 expectedExitCode)
Microsoft.DotNet.SourceBuild.SmokeTests.DotNetHelper.ExecuteCmd(String args, String workingDirectory, Action`1 processConfigCallback, Nullable`1 expectedExitCode, Int32 millisecondTimeout)
Microsoft.DotNet.SourceBuild.SmokeTests.DotNetHelper.ExecutePublish(String projectName, DotNetTemplate template, Nullable`1 selfContained, String rid, Boolean trimmed, Boolean readyToRun)
Microsoft.DotNet.SourceBuild.SmokeTests.TestScenario.Execute(DotNetHelper dotNetHelper)
Microsoft.DotNet.SourceBuild.SmokeTests.BasicScenarioTests.VerifyScenario(TestScenario scenario)
InvokeStub_BasicScenarioTests.VerifyScenario(Object, Span`1)
System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

This seems related to the changes in dotnet/sdk#34429.

@sbomer - Can you provide some info on this? What's wrong with the way the test is invoking this? It's specifying a valid RID (linux-x64).

@mthalman
Copy link
Member Author

Actually, it seems more likely that this is caused by dotnet/sdk#34430.

@Thefrank, @jkotas - The scenario here is that we're building the SDK from source with a non-portable RID: centos.8-x64. We then use that SDK to publish a .NET project with ready-to-run, targeting a RID of linux-x64. That fails with: error NETSDK1094: Unable to optimize assemblies for performance: a valid runtime package was not found. Either set the PublishReadyToRun property to false, or use a supported runtime identifier when publishing. When targeting .NET 6 or higher, make sure to restore packages with the PublishReadyToRun property set to true.

Is this a bug or is it intentional that this no longer works?

This originally repro'd in dotnet/installer#17118. I had to work around it by disabling the tests at https://github.com/dotnet/installer/pull/17118/files#diff-aa29a7c9a653ceed0c4a6c62a2fa3ebd9b854c48ce58bd489b49bfab183ef72aL37-R38. That change would need to be reverted to repro.

@jkotas
Copy link
Member

jkotas commented Aug 14, 2023

Actually, it seems more likely that this is caused by dotnet/sdk#34430.

This changed was coded very defensively to avoid changing any behaviors for non-portable RIDs. I think it is very unlikely that it introduced this issue.

The scenario here is that we're building the SDK from source with a non-portable RID: centos.8-x64. We then use that SDK to publish a .NET project with ready-to-run, targeting a RID of linux-x64.

Can this be related to dotnet/sdk#34279? After this change, there is no association between linux-x64 RID and non-portable RIDs like centos.8-x64 by default. Do the distro builds include any overrides for this default?

@mthalman
Copy link
Member Author

Can this be related to dotnet/sdk#34279? After this change, there is no association between linux-x64 RID and non-portable RIDs like centos.8-x64 by default. Do the distro builds include any overrides for this default?

Good find. Yes, that looks to be the cause. Looks like there's some changes that are necessary for source-build.

@lewing
Copy link
Member

lewing commented Aug 14, 2023

so #3584

@MichaelSimons MichaelSimons moved this from Backlog to In Progress in .NET Source Build Aug 17, 2023
@MichaelSimons MichaelSimons moved this from In Progress to Blocked in .NET Source Build Aug 17, 2023
@MichaelSimons
Copy link
Member

@mthalman - Has this issue been resolved now?

@mthalman
Copy link
Member Author

@mthalman - Has this issue been resolved now?

Yep. This was essentially a duplicate of #3584.

@github-project-automation github-project-automation bot moved this from Blocked to Done in .NET Source Build Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-testing Improvements in CI and testing
Projects
Archived in project
Development

No branches or pull requests

4 participants