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

.NET 7 RC 1 how to show a warning from a linker step? #2982

Closed
jonathanpeppers opened this issue Aug 18, 2022 · 1 comment · Fixed by #3003
Closed

.NET 7 RC 1 how to show a warning from a linker step? #2982

jonathanpeppers opened this issue Aug 18, 2022 · 1 comment · Fixed by #3003
Assignees
Milestone

Comments

@jonathanpeppers
Copy link
Member

We were originally doing this:

https://github.com/xamarin/xamarin-android/blob/4873dfafa6e72a5d898307df759c22da494fc692/src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/FixAbstractMethodsStep.cs#L59

And I believe this change made our warning disappear in projects by default: 82c6dc6

You can probably enable this warning with $(SuppressTrimAnalysisWarnings) set to false, but is there a way to make a warning always appear? Maybe we lost a way to do that?

@sbomer
Copy link
Member

sbomer commented Aug 18, 2022

The assumption behind that change was that we could treat all warnings produced by the linker as belonging to the "trim analysis" category - but maybe we need a different concept to handle this if the Xamarin warnings should be shown even with SuppressTrimAnalysisWarnings. Do you think users would expect that warning to show up if they specified <SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>?

In the meantime, if you need a workaround, you could try the following:

  • when SuppressTrimAnalysisWarnings is true:
    • set ILLinkWarningLevel to 4
      this will still prevent the built-in warnings from showing since they all have a version 5
  • where you produce the custom warnings, pass in (WarnVersion) 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants