-
Notifications
You must be signed in to change notification settings - Fork 126
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
Support --warn <version_int> #1359
Comments
Warning versions proposalRoslyn behavior It sounds like some of those details are subject to change (see for example dotnet/roslyn#45941). Proposed mapping
Based on previous discussions, our command-line default will be all warnings (effectively Open questions |
I said the same in the internal Roslyn design doc, but |
About the data type: How will this work in the future? When .NET 6 comes around we will add the value Even though I agree that using double as the data type for this is wrong - I think we should follow whatever Roslyn does in .NET 5 in the end - consistency beats everything else here. As for the proposal above: I guess what I'm saying - warning version should not take into account default experiences - and even more so default experiences for one specific application type. |
I guess the question here is what behavior we want to enable. If we want to allow command line strings to be portable back to older versions of the linker, that seems like a very big compat burden, and I'm not sure of the benefit. If we only want to allow warning versions to be compatible backwards, that's more doable, but it seems like it would have even less value. If we want people to have a flag to enable "the most possible" warnings in their project file, I would suggest a specific warning version, like
I strongly agree that consistency is the most important, but since this would be an internal data type representation (all the command options are inherently strings), what's the value in matching internal implementation details with Roslyn? The value of using an enum internally seems to be type safety, and I don't think that value is diminished, even if Roslyn doesn't decide to adopt it.
This seems like a good design principle. We might even say: warnversion is orthogonal to the other feature switches. If we have a special classification of warnings, we might require a specific feature switch turned on. The warnversion would be orthogonal to that feature switch in the sense that if you turn it on, you get those warnings and the warnversion doesn't affect it. Then, if we decide to add more warnings to the feature switches in the new version, we can do so by using the warnversion. A user who still wants the feature switch on, but the warnings from the previous version can downgrade the warnversion as appropriate. This is a coarse, but effective method of filtering. More fine-grained control is available through |
I don't think of it as a default for just a specific app type - I thought we were going to disable them for all .NET5 apps. Blazor was just the primary test scenario we used to evaluate the readiness of the warnings on this version of the framework. Preventing some set of warnings from showing up for a target framework version seems like what the versions were designed to do. What's the reasoning for separating the .NET5 defaults from the version Whatever the mechanism (versions or |
If nothing else it sets a bad precedent. Yes - it might end up working the same way in .NET 5, but that doesn't mean that if we have new feature in .NET 6 we should hide it behind warning version. And also see the counter example at the end of #1030 (comment) - that nicely describes why I think we should have properties which capture the intent, not the underlying mechanics. |
I agree with this (maybe avoid "feature switches" since that has an established meaning - perhaps "analysis kinds" or "categories"?). We've had some discussion (ongoing in #1030) about the categories and where they should be defined (SDK vs illink.dll vs task). |
I've opened a new issue to discuss the category - let's continue that part of the discussion at #1367. The new proposal for the version number to warning mapping is:
|
Reflecting dotnet/roslyn#46148, the command-line option is planned to be |
We would like to turn on all of the new warnings by default from the command-line (without requiring
--verbose
). The current plan is to then disable them from MSBuild for .NET5, by settingNoWarn
to contain the trim analysis warnings. For backward compatibility, ideally none of the new warnings would be emitted when targetingnetcoreapp3.0
.We can do this via
NoWarn
, or we can use versioned warnings, passing a--warnversion
flag to the linker, like Roslyn is doing. Back-compat may not be as essential in this release (since in 3.0 the trimmer was experimental, and tended to silently break apps), but we will have similar problems as we introduce new warnings in future releases.dotnet/roslyn#45701 is a pretty thorough summary of the Roslyn plan, which we would likely follow. The biggest open question is:
This is more relevant for the linker because we are introducing disabled "future" warnings even in .NET5 (since the trim analysis warnings will be available, but off). Should we have three "versions" (no warnings, all but trim analysis, and all warnings)? Or do we want to keep the "experimental" trim analysis warnings under a flag of its own? It feels a bit strange to give them a version number if we are not confident that they're ready to be on by default in a specific release.
The text was updated successfully, but these errors were encountered: