Skip to content

Conversation

@sbomer
Copy link
Member

@sbomer sbomer commented Jun 5, 2023

The ILLink "runtime pack" is required for any of the ILLink analyzers (trimming, single-file, aot compatibility), as well as for trimming. This message is also only produced when those settings are enabled for an unsupported target framework. Hopefully this makes the error more clear.

Together with #32045, this should address dotnet/linker#3175 by providing an understandable error when someone tries to use the analyzer for netstandard library projects.

@sbomer sbomer requested review from agocke and vitek-karas June 5, 2023 16:53
@ghost ghost added Area-ILLink untriaged Request triage from a team member labels Jun 5, 2023
</data>
<data name="ILLinkNoValidRuntimePackageError" xml:space="preserve">
<value>NETSDK1195: Unable to optimize assemblies for size: a valid runtime package was not found. Either set the PublishTrimmed property to false, or use a supported target framework when publishing.</value>
<value>NETSDK1195: Trimming, or code compatibility analysis for trimming, single-file deployment, or ahead-of-time compilation is not supported for the target framework.</value>
Copy link
Member

Choose a reason for hiding this comment

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

Definitely much better than before. But it's not actionable - it doesn't tell me what to do to "fix" this. Can we at least link to some doc (maybe just the trimming doc for now).

Copy link
Member Author

Choose a reason for hiding this comment

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

The action item is really to do one of the following:

  • Target a supported TFM
  • Unset IsTrimmable
  • Unset PublishTrimmed
  • Unset IsAotCompatible
  • Unset PublishAot
  • Unset PublishSingleFile
  • Unset EnableTrimAnalyzer
  • Unset EnableAotAnalyzer
  • Unset EnableSingleFileAnalyzer

The trimming doc probably shouldn't explain all of those. Maybe we can link to https://learn.microsoft.com/en-us/dotnet/core/deploying/ and add sections to that which mention trimming and AOT deployment? I think that'd be good enough even if it doesn't explicitly list properties like Enable*Analyzer.

Another option is to produce separate errors depending on which of those properties was set. I think this would be the best option if we want to really commit to actionable errors. Let me know what you think!

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm adding a dedicated doc page for NETSDK1195 in dotnet/docs#35655 and linking to it here.

@sbomer sbomer requested a review from eerhardt June 5, 2023 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-ILLink untriaged Request triage from a team member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants