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

IDE0036 errors when building with Preview 6 SDK #11493

Closed
NikolaMilosavljevic opened this issue Jun 5, 2024 · 10 comments · Fixed by #11571
Closed

IDE0036 errors when building with Preview 6 SDK #11493

NikolaMilosavljevic opened this issue Jun 5, 2024 · 10 comments · Fixed by #11571
Labels
area-System.Drawing System.Drawing issues

Comments

@NikolaMilosavljevic
Copy link
Member

When building with .NET 9 Preview 6 SDK (i.e. 9.0.100-preview.6.24303.27), there are 3 IDE0036 errors:

    D:\a\_work\1\vmr\src\winforms\src\System.Drawing.Common\src\System\Drawing\ImageConverter.cs(42,5): error IDE0036: Modifiers are not ordered (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0036) [D:\a\_work\1\vmr\src\winforms\src\System.Drawing.Common\src\System.Drawing.Common.csproj::TargetFramework=net8.0]
    D:\a\_work\1\vmr\src\winforms\src\System.Drawing.Common\src\System\Drawing\ImageConverter.cs(42,5): error IDE0036: Modifiers are not ordered (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0036) [D:\a\_work\1\vmr\src\winforms\src\System.Drawing.Common\src\System.Drawing.Common.csproj::TargetFramework=net9.0]
    D:\a\_work\1\vmr\src\winforms\src\System.Drawing.Common\src\System\Drawing\Imaging\Effects\Effect.cs(11,1): error IDE0036: Modifiers are not ordered (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0036) [D:\a\_work\1\vmr\src\winforms\src\System.Drawing.Common\src\System.Drawing.Common.csproj::TargetFramework=net9.0]

From: dotnet/sdk#41417 (comment)

@elachlan
Copy link
Contributor

elachlan commented Jun 5, 2024

We have it set to a warning in the CodeAnalysis globalconfig. Maybe it isn't getting applied to System.Drawing.Common?

# IDE0036: Order modifiers
dotnet_diagnostic.IDE0036.severity = warning

@elachlan elachlan added the area-System.Drawing System.Drawing issues label Jun 5, 2024
@NikolaMilosavljevic
Copy link
Member Author

Source-build and unified-build use /p:TreatWarningsAsErrors=true so all warnings will become errors.

There are more errors, of the same type: dotnet/sdk#41417 (comment)

@elachlan
Copy link
Contributor

elachlan commented Jun 6, 2024

We have TreatWarningsAsErrors=true in our CI builds. I also locally set the analyzer to error instead of warning and didn't get any hits. Its like the analyzer isn't getting run.

@elachlan
Copy link
Contributor

elachlan commented Jun 6, 2024

@sharwell IDE0036 seems to not be working here, could you point us in the right direction?

@akoeplinger
Copy link
Member

Maybe caused by dotnet/roslyn#73339? i.e. it was silently ignored before that fix

@ViktorHofer
Copy link
Member

Any update on this? We still have a patch for it in the VMR: https://github.com/dotnet/sdk/blob/main/src/SourceBuild/patches/winforms/0001-Suppress-IDE0036-errors.patch

@elachlan
Copy link
Contributor

@ViktorHofer we think it's a Roslyn bug? The analyzer isn't firing for us.

@akoeplinger
Copy link
Member

@elachlan I hacked the System.Drawing.Common build so it still built with the 8.0.100 SDK and it does show the same analyzer errors there so I'm almost certain that it was just silently ignored on 8.0.200+ until the fix in dotnet/roslyn#73339

So these look like genuine findings. You can bump the SDK version to e.g. 9.0.100-preview.6.24303.27 in global.json locally and run build.cmd, it will show the errors.

akoeplinger added a commit to akoeplinger/winforms that referenced this issue Jun 21, 2024
@akoeplinger
Copy link
Member

Opened a PR: #11571

@alandryz83
Copy link

alandryz83 commented Jul 2, 2024 via email

@github-actions github-actions bot locked and limited conversation to collaborators Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Drawing System.Drawing issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants