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

Disable analyzers only when building in VS #34848

Merged
merged 10 commits into from
Jul 30, 2021
Merged

Conversation

captainsafia
Copy link
Member

This check was causing analyzers not to run when building on the CLI. Updating to only apply for VS builds.

@BrennanConroy
Copy link
Member

Caught one!

src/Servers/Kestrel/Core/src/MinDataRate.cs(47,32): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'ToString' is not part of the declared API.

Copy link
Member

@halter73 halter73 left a comment

Choose a reason for hiding this comment

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

I think we just add MinDataRate.ToString() to the PublicApi.Unshipped so we don't have to revert #34680. @davidfowl

I guess we can mark this PR api-ready-for-review and look at it after it's merged. I can't imagine there being any pushback.

Copy link
Contributor

@JunTaoLuo JunTaoLuo left a 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 get this in asap so we don't continue to "accidentally modify APIs"

@dougbu
Copy link
Member

dougbu commented Jul 29, 2021

I think we should get this in asap so we don't continue to "accidentally modify APIs"

Agreed. Fix the missing ToString() method in VS (16.x, not 17.x 😺) and be done w/ it. Use admin privs to shorten the window for busted stuff

@captainsafia captainsafia enabled auto-merge (squash) July 29, 2021 22:06
@captainsafia captainsafia requested a review from a team as a code owner July 29, 2021 23:34
@@ -15,7 15,7 @@
<AnalysisMode>Default</AnalysisMode>
</PropertyGroup>

<PropertyGroup Condition=" '$(VisualStudioVersion)' == '17.0' ">
<PropertyGroup Condition=" '$(BuildingInsideVisualStudio)' == 'true' AND '$(VisualStudioVersion)' == '17.0' ">
Copy link
Contributor

Choose a reason for hiding this comment

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

Could someone remind me why we did this? Is this because of all of the failures to load the analyzer dll?

Copy link
Member

Choose a reason for hiding this comment

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

Yes. #34664 And I didn't verify the analyzers still ran on builds outside of VS 😞

Copy link
Member

Choose a reason for hiding this comment

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

nit: Remembered users could run desktop msbuild in our projects even if we don't recommend it.

Suggested change
<PropertyGroup Condition=" '$(BuildingInsideVisualStudio)' == 'true' AND '$(VisualStudioVersion)' == '17.0' ">
<PropertyGroup Condition=" '$(MSBuildRuntimeType)' != 'Core' AND '$(VisualStudioVersion)' == '17.0' ">

Copy link
Member

@dougbu dougbu left a comment

Choose a reason for hiding this comment

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

@dotnet/aspnet-build please double-check this then merge w/o waiting for CI. This should stop the bleeding in subsequent PRs though we need to be careful w/ PRs already marked as successful.

@dougbu
Copy link
Member

dougbu commented Jul 30, 2021

@dotnet/aspnet-build never mind on the admin squash. Build failures are real and look like additional API changes as well as a new non-MIT header. ☹️

And I didn't verify the analyzers still ran on builds outside of VS 😞

@halter73 counter-intuitively, $(VisualStudioVersion) is 17.0 when building in dotnet msbuild with the current SDK. No way you could have predicted that.

@dsplaisted @rainersigwald @wli3 is that property setting coming from the SDK itself❔ If not, where❔ I expected no property setting outside desktop msbuild.


@captainsafia @BrennanConroy @JunTaoLuo and others playing in this PR: Have a look at other Conditions using $(VisualStudioVersion), especially the one in eng/targets/CSharp.Common.targets. Ignore the *.vcxproj files and src/Servers/IIS/build/Build.Settings because they're used only in native builds whether inside VS or not.

@dougbu
Copy link
Member

dougbu commented Jul 30, 2021

/fyi @davidfowl one non-MIT header (in WebApplicationServiceCollection.cs) comes from d434b1c.

/fyi @javiercn and @JunTaoLuo the other non-MIT header (in ManifestStaticWebAssetsFileProviderTests.cs) comes from 014df77. Downside of the CI not enforcing comments on the PR…

@captainsafia
Copy link
Member Author

Have a look at other Conditions using $(VisualStudioVersion), especially the one in eng/targets/CSharp.Common.targets

Since this is part of the same workaround to disable loading analyzers in certain versions of VS, I think it's fine to make this conditional on the build happening in VS too. Not sure if it'll actually cause any tangible warnings in the CI but we'll see.

@captainsafia captainsafia requested a review from a team as a code owner July 30, 2021 00:28
@captainsafia
Copy link
Member Author

@dotnet/aspnet-build Ooooook. Looks like the build legs are starting to go green. I think this is good to merge at your discretion.

Copy link
Member

@dougbu dougbu left a comment

Choose a reason for hiding this comment

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

Let's hope this beats other API changes and file additions 😀

@@ -15,7 15,7 @@
<AnalysisMode>Default</AnalysisMode>
</PropertyGroup>

<PropertyGroup Condition=" '$(VisualStudioVersion)' == '17.0' ">
<PropertyGroup Condition=" '$(BuildingInsideVisualStudio)' == 'true' AND '$(VisualStudioVersion)' == '17.0' ">
Copy link
Member

Choose a reason for hiding this comment

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

nit: Remembered users could run desktop msbuild in our projects even if we don't recommend it.

Suggested change
<PropertyGroup Condition=" '$(BuildingInsideVisualStudio)' == 'true' AND '$(VisualStudioVersion)' == '17.0' ">
<PropertyGroup Condition=" '$(MSBuildRuntimeType)' != 'Core' AND '$(VisualStudioVersion)' == '17.0' ">

@@ -36,7 36,7 @@

<!-- Enable .NET code style analysis during build for src projects. -->
<!-- Workaround bug where turning this on produces warnings in VS -->
<EnforceCodeStyleInBuild Condition="'$(VisualStudioVersion)' &lt; '17.0'">false</EnforceCodeStyleInBuild>
<EnforceCodeStyleInBuild Condition="'$(BuildingInsideVisualStudio)' == 'true' AND '$(VisualStudioVersion)' &lt; '17.0'">false</EnforceCodeStyleInBuild>
Copy link
Member

Choose a reason for hiding this comment

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

same nit:

Suggested change
<EnforceCodeStyleInBuild Condition="'$(BuildingInsideVisualStudio)' == 'true' AND '$(VisualStudioVersion)' &lt; '17.0'">false</EnforceCodeStyleInBuild>
<EnforceCodeStyleInBuild Condition=" '$(MSBuildRuntimeType)' != 'Core' AND '$(VisualStudioVersion)' &lt; '17.0' ">false</EnforceCodeStyleInBuild>

Separately have we confirmed < works with strings that look like floating-point numbers❔ @rainersigwald

Copy link
Member

Choose a reason for hiding this comment

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

it does but consider using the newish version comparison property functions

@dougbu
Copy link
Member

dougbu commented Jul 30, 2021

Ick Components.E2ETest has not been reliable recently ☹️ /fyi @JunTaoLuo if you're still wrapping up blops

@dougbu
Copy link
Member

dougbu commented Jul 30, 2021

@captainsafia please get this in w/ your admin privs if the test failure is all that goes wrong in this build. No need to wait for Helix jobs for example and don't bother retrying the failed 'Test: Windows Server 2016 x64' job.

@captainsafia
Copy link
Member Author

I think this is safe to merge. There's a few build legs that are still queued to run (macOS arm64, Linux arm64) but I think it is safe to merge.

I'll follow up to feedback and any potential fallout as part of my build-ops rotation.

@captainsafia captainsafia merged commit 08c8b41 into main Jul 30, 2021
@captainsafia captainsafia deleted the safia/fix-analyzer-patch branch July 30, 2021 02:38
@ghost ghost added this to the 6.0-rc1 milestone Jul 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants