-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add warning for ref to netstandard >= 1.5 from netfx without built-in support #2330
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
Conversation
@dsplaisted Only "Warning can be suppressed" is pending. Could you have a look if the test matrix is enough? |
@terrajobst @weshaggard @AlexGhiondea can you provide the link to the page with the known issues for .NET Standard 2.0 (and 1.5+) on .NET Framework before 4.7.2? We want to point the aka.ms link in this warning at that page for now. |
<comment>{StrBegin="NETSDK1068: "}</comment> | ||
</data> | ||
<data name="NETFrameworkToNonBuiltInNETStandard" xml:space="preserve"> | ||
<value>NETSDK1069: This project uses a library that targets .NET Standard 1.5 or higher and targets a version of .NET Framework that doesn't have built-in support for that version of .NET Standard. Visit https://aka.ms/net-standard-known-issues for a set of known issues. Consider retargeting to .NET Framework 4.7.2.</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading this message again it's not clear that "and targets a version of .NET Framework" refers to the project and not the library. So how about this:
This project uses a library that targets .NET Standard 1.5 or higher, and the project targets a version of .NET Framework that doesn't have built in support for that version of .NET Standard. Visit https://aka.ms/net-standard-known-issues for a set of known issues. Consider retargeting to .NET Framework 4.7.2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, changed to it
public void It_generate_warning_depends_on_framework_and_library_netstandard_version(string framework, string libraryNetstandard, bool shouldHaveWarning, bool isSdk, string description) | ||
{ | ||
var testAsset = _testAssetsManager | ||
.CopyTestAsset(GetTemplateName(isSdk), identifier: isSdk.ToString()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The identifier should be unique for each test case within a theory. So here I think you'd want to combine isSdk
with description
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, although description is not unique. I will use framework + libraryNetstandard + isSdk.ToString() + description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
{ | ||
project.Root.Element(ns + "PropertyGroup") | ||
.Element(ns + "TargetFramework") | ||
.Value = parsedFramework.GetShortFolderName(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicking here, but I think in this case you can just use framework
directly, instead of parsing it into a NuGet framework and then getting the short version of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
public AndConstraint<CommandResultAssertions> HaveStdOutContaining(Func<string, bool> predicate, string description = "") | ||
{ | ||
Execute.Assertion.ForCondition(predicate(_commandResult.StdOut)) | ||
.FailWith(AppendDiagnosticsTo($"The command output did not contain expected result: {predicate.Method.Name} {description} {Environment.NewLine}")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should not use predicate.Method.Name
here. It's not generally expected behavior to use the method name of a func you pass into a function, and if you use a lambda or anonymous delegate (perfectly reasonable to do), then this would be a compiler-generated method name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, changed to just explicitly pass the description.
FYI @Pilchie @tmeschter |
Thanks @wli3 @nguerrera @livarcocc ! |
I'm seeing this warning in VS 15.8.0 Preview 4, but the link (https://aka.ms/net-standard-known-issues) doesn't appear to be live - I just get redirected to the Microsoft homepage. Is it meant to point to dotnet/standard#567, and if so, isn't this only a problem for .NET 4.6.1 projects running on .NET 4.7.1? All our full framework projects already target .NET 4.7.1, so is this warning still valid? |
Hey @Quppa -- you are correct, the link is not yet live. We are still working on publishing the document and will update the link once it is ready. We are continuing to work on the experience for when we should show the warning. The issue you are referring to contains a few of the problems you might run into when using .NET Standard on .NET Framework 4.7.1. We are working on a document that puts all that information in a single place to make it easier to view the issues and their possible resolution -- this is where the link will point to. |
This adds a lot of needless warning noise to our libraries. How do you disable this warning? We are using APIs that are supported by .NET 4.7.2 just landed on Windows Update literally yesterday. Targeting it for a library is extremely unreasonable for most people at this point in time. This should not be a warning. Warnings should be actionable things. Even if it only warns on executables, requiring everyone to have .NET 4.7.2 to run a test suite is equally unreasonable. |
From @nguerrera, here's how to disable this for anyone else ending up here before Preview 5: <MSBuildWarningsAsMessages>NETSDK1069</MSBuildWarningsAsMessages> |
@NickCraver Yes, in #2390 we've backed out this warning. It won't be present in the next Preview release of VS 15.8. We plan to bring it back (and add documentation explaining known issues in more detail) after .NET 4.7.2 is more widely deployed. |
See dotnet/sdk#2330 for details.
Where does this go in the project file?
|
In an PropertyGroup with no conditions. You probably already have one of those that you can add it to. <PropertyGroup>
<MSBuildWarningsAsMessages>NETSDK1069</MSBuildWarningsAsMessages>
</PropertyGroup> |
Still TODO:
Use aka.ms link which owned by us. We could change the destination later. It is pointing to microsoft.com