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

Enable CA1069 for ErrorCode and MessageID #54695

Merged
merged 7 commits into from
Jul 22, 2021

Conversation

RikkiGibson
Copy link
Contributor

@RikkiGibson RikkiGibson commented Jul 8, 2021

CA1069: Enums should not have duplicate values

Including an .editorconfig under the Errors path lets us add this check specifically for ErrorCode, MessageId and XmlParseErrorCode, all of which we expect to not use any duplicate IDs. Thanks @jmarolf for the suggestion.

We already have this enforcement for ErrorCode and possibly for MessageID, but the quality of the error message from this analyzer is a lot better than what we get in DiagnosticTest.NoDuplicates.

Opened #54696 to demonstrate the error experience in CI.

Compare the NoDuplicates error message:

Microsoft.CodeAnalysis.CSharp.UnitTests.DiagnosticTest.NoDuplicates:
    Outcome: Failed
    Error Message:
    Assert.True() Failure
Expected: True
Actual:   False
    Stack Trace:
       at Microsoft.CodeAnalysis.CSharp.UnitTests.DiagnosticTest.NoDuplicates() in c:\Users\rikki\src\roslyn\src\Compilers\CSharp\Test\Syntax\Diagnostics\DiagnosticTest.cs:line 58

with the analyzer warning:
> dotnet build .\src\Compilers\CSharp\Portable /p:RunAnalyzersDuringBuild=true
...
src\Compilers\CSharp\Portable\Errors\ErrorCode.cs(1959,9): warning CA1069: The enum member 'ERR_CantConvAnonMethReturnType' has the same constant value '8933' as member 'HDN_DuplicateWithGlobalUsing' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]

@RikkiGibson RikkiGibson marked this pull request as ready for review July 8, 2021 22:46
@RikkiGibson RikkiGibson requested a review from a team as a code owner July 8, 2021 22:46
333fred
333fred previously approved these changes Jul 8, 2021
@Youssef1313
Copy link
Member

Youssef1313 commented Jul 9, 2021

fwiw, the analyzer seems to have known flakiness due to a concurrency issue. dotnet/roslyn-analyzers#5170 dotnet/roslyn-analyzers#3871

@333fred 333fred dismissed their stale review July 9, 2021 06:40

Given the concurrency issue, I think we should wait until that is resolved to merge this. I have no idea how flaky the analyzer is, but any amount is more than I'm willing to accept for something we already have enforcement on. It's not as nicely formatted, true, but our CI doesn't need any more sources of flakiness.

@jcouv jcouv marked this pull request as draft July 14, 2021 18:44
@RikkiGibson RikkiGibson marked this pull request as ready for review July 19, 2021 17:57
@RikkiGibson RikkiGibson requested review from a team as code owners July 19, 2021 17:57
@RikkiGibson
Copy link
Contributor Author

I updated the roslyn-analyzers version to one which includes the concurrency fix in dotnet/roslyn-analyzers#5243. I think our roslyn-analyzers dependency is non-shipping so it should be fine to update to an "rc1" labeled version now instead of waiting for us to start publishing to an rc1 DARC feed for example.

There were a few new warnings to fix in fe010a5. @sharwell @CyrusNajmabadi if you could please take a glance at those.

@jmarolf
Copy link
Contributor

jmarolf commented Jul 19, 2021

I think our roslyn-analyzers dependency is non-shipping so it should be fine to update to an "rc1" labeled version now instead of waiting for us to start publishing to an rc1 DARC feed for example.

this is correct.

Copy link
Member

@333fred 333fred left a comment

Choose a reason for hiding this comment

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

LGTM with the concurrency fixes.

@RikkiGibson
Copy link
Contributor Author

@dotnet/roslyn-compiler for a second review.

@@ -0,0 +1,4 @@
# CSharp code style settings:
Copy link
Member

Choose a reason for hiding this comment

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

😕 Why are we adding a new file here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We want to run the analyzer specifically on the enums in this file. We're not interested in having the warning on the rest of the enums in the compiler at this time.

# CSharp code style settings:
[*.cs]
# CA1069: Enums should not have duplicate values
dotnet_diagnostic.CA1069.severity = warning
Copy link
Member

Choose a reason for hiding this comment

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

💡 These lines should appear in .globalconfig instead of .editorconfig for performance and consistent application

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The compiler team doesn't currently desire consistent application of this warning. Is there a change that we should make here to improve performance which doesn't affect which files are subject to the new warning?

Copy link
Member

Choose a reason for hiding this comment

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

For intentional conditional application, .editorconfig is fine.

@@ -14,7 +13,6 @@ namespace Microsoft.CodeAnalysis.Interactive
{
internal static class InteractiveHostEntryPoint
{
[SupportedOSPlatform("windows")]
Copy link
Member

Choose a reason for hiding this comment

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

😕 I'm not sure what this has to do with "Enums should not have duplicate values"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to update the roslyn-analyzers version in this PR which introduced new warnings. This looked to me like the most straightforward way to resolve the warning in this file. I speculate that the new analyzer infers a "default" SupportedOSPlatform based on the target framework of the project.

Copy link
Member

Choose a reason for hiding this comment

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

Could you clarify why removing SupportedOSPlatform is the solution?

Just to recap, the diagnostic was "src\Interactive\HostProcess\InteractiveHostEntryPoint.cs(23,113): error CA1416: (NETCORE_ENGINEERING_TELEMETRY=Build) This call site is reachable on: 'windows' all versions. 'InteractiveHostEntryPoint.ErrorMode.SEM_NOGPFAULTERRORBOX' is only supported on: 'Windows' 7.0 and later."

Looking at the doc on CA1416, it's not clear why removing the SupportedOSPlatform would even fix this diagnostic.
I would have expected that we needed to specify a minimum version of windows instead. Something like [SupportedOSPlatform("windows10.0.1903")] (with some proper version where the SEM_NOGPFAULTERRORBOX was added).

Copy link
Contributor Author

@RikkiGibson RikkiGibson Jul 22, 2021

Choose a reason for hiding this comment

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

Basically an analyzer thinks it's not OK to use an enum in one of these methods because the enum (which was also declared in this project) has a "supported os platform" value that is more restrictive than the caller's value. The enum's value is being inferred as "windows7" from the project while the caller's was explicitly set to "windows". So deleting these attributes causes a consistently restrictive "supported os platform" value to be associated with all the symbols in the project.

Copy link
Member

Choose a reason for hiding this comment

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

Got it. So removing the attribute is functionally equivalent to changing it [SupportedOSPlatform("windows7")] then (inferred from APIs used in that method)?

Should we revert other parts of commit c756744 too then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That seems reasonable to me. Thanks

Comment on lines +67 to +68
var disposable = await _progressTracker.AddSingleItemAsync(cancellationToken).ConfigureAwait(false);
await using var _ = disposable.ConfigureAwait(false);
Copy link
Member

Choose a reason for hiding this comment

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

💡 The separate form is typically for cases where disposable needs to be used. For this code, I would typically combine these into a single line (it's a long line, but that's acceptable).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I chatted with @CyrusNajmabadi offline about this and he expressed a preference to factor it this way rather than as a single line.

@RikkiGibson
Copy link
Contributor Author

I did find the output from running this analyzer on Microsoft.CodeAnalysis and Microsoft.CSharp.CodeAnalysis to be interesting, but some of them I do not think we would want to fix by explicitly initializing with a previous field.

94 new warnings
src\Compilers\Core\Portable\Symbols\MethodKind.cs(21,9): warning CA1069: The enum member 'LambdaMethod' has the same constant value '0' as member 'AnonymousFunction' [src\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj]
src\Compilers\Core\Portable\Symbols\MethodKind.cs(95,9): warning CA1069: The enum member 'SharedConstructor' has the same constant value '14' as member 'StaticConstructor' [src\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj]
src\Compilers\Core\Portable\Symbols\TypeKind.cs(70,9): warning CA1069: The enum member 'Structure' has the same constant value '10' as member 'Struct' [src\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj]
src\Compilers\Core\Portable\Symbols\RefKind.cs(38,9): warning CA1069: The enum member 'RefReadOnly' has the same constant value '3' as member 'In' [src\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj]
src\Compilers\Core\Portable\Symbols\MethodKind.cs(21,9): warning CA1069: The enum member 'LambdaMethod' has the same constant value '0' as member 'AnonymousFunction' [src\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj]
src\Compilers\Core\Portable\Symbols\MethodKind.cs(95,9): warning CA1069: The enum member 'SharedConstructor' has the same constant value '14' as member 'StaticConstructor' [src\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj]
src\Compilers\Core\Portable\Symbols\RefKind.cs(38,9): warning CA1069: The enum member 'RefReadOnly' has the same constant value '3' as member 'In' [src\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj]
src\Compilers\Core\Portable\Symbols\TypeKind.cs(70,9): warning CA1069: The enum member 'Structure' has the same constant value '10' as member 'Struct' [src\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(17,13): warning CA1069: The enum member 'ConstructorBodyOrInitializer' has the same constant value '1' as member 'MethodTypeParameters' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(18,13): warning CA1069: The enum member 'AccessorBody' has the same constant value '1' as member 'MethodTypeParameters' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(19,13): warning CA1069: The enum member 'OperatorBody' has the same constant value '1' as member 'MethodTypeParameters' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(24,13): warning CA1069: The enum member 'NamespaceBody' has the same constant value '1' as member 'MethodTypeParameters' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(27,13): warning CA1069: The enum member 'CompilationUnitUsings' has the same constant value '1' as member 'MethodTypeParameters' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(31,13): warning CA1069: The enum member 'DocumentationCommentParameter' has the same constant value '1' as member 'MethodTypeParameters' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(35,13): warning CA1069: The enum member 'CrefParameterOrReturnType' has the same constant value '1' as member 'MethodTypeParameters' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(21,13): warning CA1069: The enum member 'NamedTypeBodyOrTypeParameters' has the same constant value '2' as member 'MethodBody' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(25,13): warning CA1069: The enum member 'NamespaceUsings' has the same constant value '2' as member 'MethodBody' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(28,13): warning CA1069: The enum member 'CompilationUnitScript' has the same constant value '2' as member 'MethodBody' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(32,13): warning CA1069: The enum member 'DocumentationCommentTypeParameter' has the same constant value '2' as member 'MethodBody' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(29,13): warning CA1069: The enum member 'CompilationUnitScriptUsings' has the same constant value '4' as member 'NamedTypeBaseListOrParameterList' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(33,13): warning CA1069: The enum member 'DocumentationCommentTypeParameterReference' has the same constant value '4' as member 'NamedTypeBaseListOrParameterList' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(63,9): warning CA1069: The enum member 'StartValidatingImports' has the same constant value '16' as member 'StartBaseType' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(94,9): warning CA1069: The enum member 'StartPropertyEnsureSignature' has the same constant value '16' as member 'StartBaseType' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(104,9): warning CA1069: The enum member 'AliasTarget' has the same constant value '16' as member 'StartBaseType' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(107,9): warning CA1069: The enum member 'StartAttributeChecks' has the same constant value '16' as member 'StartBaseType' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(115,9): warning CA1069: The enum member 'StartValidatingReferencedAssemblies' has the same constant value '16' as member 'StartBaseType' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(64,9): warning CA1069: The enum member 'FinishValidatingImports' has the same constant value '32' as member 'FinishBaseType' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(95,9): warning CA1069: The enum member 'FinishPropertyEnsureSignature' has the same constant value '32' as member 'FinishBaseType' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(108,9): warning CA1069: The enum member 'FinishAttributeChecks' has the same constant value '32' as member 'FinishBaseType' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(116,9): warning CA1069: The enum member 'FinishValidatingReferencedAssemblies' has the same constant value '32' as member 'FinishBaseType' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(96,9): warning CA1069: The enum member 'StartPropertyParameters' has the same constant value '64' as member 'StartInterfaces' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(109,9): warning CA1069: The enum member 'Module' has the same constant value '64' as member 'StartInterfaces' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(80,9): warning CA1069: The enum member 'FinishMethodChecks' has the same constant value '16384' as member 'StartMemberChecks' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(99,9): warning CA1069: The enum member 'FinishPropertyType' has the same constant value '512' as member 'TypeArguments' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(111,9): warning CA1069: The enum member 'FinishValidatingAddedModules' has the same constant value '512' as member 'TypeArguments' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(79,9): warning CA1069: The enum member 'StartMethodChecks' has the same constant value '8192' as member 'SynthesizedExplicitImplementations' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(86,9): warning CA1069: The enum member 'EndDefaultSyntaxValueDiagnostics' has the same constant value '8192' as member 'SynthesizedExplicitImplementations' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(98,9): warning CA1069: The enum member 'StartPropertyType' has the same constant value '256' as member 'EnumUnderlyingType' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(110,9): warning CA1069: The enum member 'StartValidatingAddedModules' has the same constant value '256' as member 'EnumUnderlyingType' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(73,9): warning CA1069: The enum member 'ConstantValue' has the same constant value '4096' as member 'TypeMembers' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(78,9): warning CA1069: The enum member 'FinishAsyncMethodChecks' has the same constant value '4096' as member 'TypeMembers' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(85,9): warning CA1069: The enum member 'EndDefaultSyntaxValue' has the same constant value '4096' as member 'TypeMembers' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(97,9): warning CA1069: The enum member 'FinishPropertyParameters' has the same constant value '128' as member 'FinishInterfaces' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(68,9): warning CA1069: The enum member 'NameToMembersMap' has the same constant value '2048' as member 'Members' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(72,9): warning CA1069: The enum member 'FixedSize' has the same constant value '2048' as member 'Members' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(77,9): warning CA1069: The enum member 'StartAsyncMethodChecks' has the same constant value '2048' as member 'Members' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(84,9): warning CA1069: The enum member 'StartDefaultSyntaxValue' has the same constant value '2048' as member 'Members' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(90,9): warning CA1069: The enum member 'TypeParameterConstraints' has the same constant value '2048' as member 'Members' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Parser\Lexer.cs(48,9): warning CA1069: The enum member 'XmlDocCommentStyleSingleLine' has the same constant value '0' as member 'XmlDocCommentLocationStart' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Parser\Lexer.cs(52,9): warning CA1069: The enum member 'None' has the same constant value '0' as member 'XmlDocCommentLocationStart' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\Synthesized\GeneratedNameKind.cs(55,9): warning CA1069: The enum member 'Deprecated_InitializerLocal' has the same constant value '103' as member 'LocalFunction' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(17,13): warning CA1069: The enum member 'ConstructorBodyOrInitializer' has the same constant value '1' as member 'MethodTypeParameters' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(18,13): warning CA1069: The enum member 'AccessorBody' has the same constant value '1' as member 'MethodTypeParameters' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(19,13): warning CA1069: The enum member 'OperatorBody' has the same constant value '1' as member 'MethodTypeParameters' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(24,13): warning CA1069: The enum member 'NamespaceBody' has the same constant value '1' as member 'MethodTypeParameters' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(27,13): warning CA1069: The enum member 'CompilationUnitUsings' has the same constant value '1' as member 'MethodTypeParameters' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(31,13): warning CA1069: The enum member 'DocumentationCommentParameter' has the same constant value '1' as member 'MethodTypeParameters' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(35,13): warning CA1069: The enum member 'CrefParameterOrReturnType' has the same constant value '1' as member 'MethodTypeParameters' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(21,13): warning CA1069: The enum member 'NamedTypeBodyOrTypeParameters' has the same constant value '2' as member 'MethodBody' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(25,13): warning CA1069: The enum member 'NamespaceUsings' has the same constant value '2' as member 'MethodBody' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(28,13): warning CA1069: The enum member 'CompilationUnitScript' has the same constant value '2' as member 'MethodBody' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(32,13): warning CA1069: The enum member 'DocumentationCommentTypeParameter' has the same constant value '2' as member 'MethodBody' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(29,13): warning CA1069: The enum member 'CompilationUnitScriptUsings' has the same constant value '4' as member 'NamedTypeBaseListOrParameterList' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Binder\BinderFactory.NodeUsage.cs(33,13): warning CA1069: The enum member 'DocumentationCommentTypeParameterReference' has the same constant value '4' as member 'NamedTypeBaseListOrParameterList' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(63,9): warning CA1069: The enum member 'StartValidatingImports' has the same constant value '16' as member 'StartBaseType' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(94,9): warning CA1069: The enum member 'StartPropertyEnsureSignature' has the same constant value '16' as member 'StartBaseType' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(104,9): warning CA1069: The enum member 'AliasTarget' has the same constant value '16' as member 'StartBaseType' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(107,9): warning CA1069: The enum member 'StartAttributeChecks' has the same constant value '16' as member 'StartBaseType' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(115,9): warning CA1069: The enum member 'StartValidatingReferencedAssemblies' has the same constant value '16' as member 'StartBaseType' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(64,9): warning CA1069: The enum member 'FinishValidatingImports' has the same constant value '32' as member 'FinishBaseType' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(95,9): warning CA1069: The enum member 'FinishPropertyEnsureSignature' has the same constant value '32' as member 'FinishBaseType' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(108,9): warning CA1069: The enum member 'FinishAttributeChecks' has the same constant value '32' as member 'FinishBaseType' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(116,9): warning CA1069: The enum member 'FinishValidatingReferencedAssemblies' has the same constant value '32' as member 'FinishBaseType' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(96,9): warning CA1069: The enum member 'StartPropertyParameters' has the same constant value '64' as member 'StartInterfaces' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(109,9): warning CA1069: The enum member 'Module' has the same constant value '64' as member 'StartInterfaces' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(80,9): warning CA1069: The enum member 'FinishMethodChecks' has the same constant value '16384' as member 'StartMemberChecks' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(99,9): warning CA1069: The enum member 'FinishPropertyType' has the same constant value '512' as member 'TypeArguments' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(111,9): warning CA1069: The enum member 'FinishValidatingAddedModules' has the same constant value '512' as member 'TypeArguments' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(79,9): warning CA1069: The enum member 'StartMethodChecks' has the same constant value '8192' as member 'SynthesizedExplicitImplementations' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(86,9): warning CA1069: The enum member 'EndDefaultSyntaxValueDiagnostics' has the same constant value '8192' as member 'SynthesizedExplicitImplementations' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(98,9): warning CA1069: The enum member 'StartPropertyType' has the same constant value '256' as member 'EnumUnderlyingType' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(110,9): warning CA1069: The enum member 'StartValidatingAddedModules' has the same constant value '256' as member 'EnumUnderlyingType' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(73,9): warning CA1069: The enum member 'ConstantValue' has the same constant value '4096' as member 'TypeMembers' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(78,9): warning CA1069: The enum member 'FinishAsyncMethodChecks' has the same constant value '4096' as member 'TypeMembers' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(85,9): warning CA1069: The enum member 'EndDefaultSyntaxValue' has the same constant value '4096' as member 'TypeMembers' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(97,9): warning CA1069: The enum member 'FinishPropertyParameters' has the same constant value '128' as member 'FinishInterfaces' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(68,9): warning CA1069: The enum member 'NameToMembersMap' has the same constant value '2048' as member 'Members' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(72,9): warning CA1069: The enum member 'FixedSize' has the same constant value '2048' as member 'Members' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(77,9): warning CA1069: The enum member 'StartAsyncMethodChecks' has the same constant value '2048' as member 'Members' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(84,9): warning CA1069: The enum member 'StartDefaultSyntaxValue' has the same constant value '2048' as member 'Members' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\CompletionPart.cs(90,9): warning CA1069: The enum member 'TypeParameterConstraints' has the same constant value '2048' as member 'Members' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Parser\Lexer.cs(48,9): warning CA1069: The enum member 'XmlDocCommentStyleSingleLine' has the same constant value '0' as member 'XmlDocCommentLocationStart' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Parser\Lexer.cs(52,9): warning CA1069: The enum member 'None' has the same constant value '0' as member 'XmlDocCommentLocationStart' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
src\Compilers\CSharp\Portable\Symbols\Synthesized\GeneratedNameKind.cs(55,9): warning CA1069: The enum member 'Deprecated_InitializerLocal' has the same constant value '103' as member 'LocalFunction' [src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj]
    94 Warning(s)

Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

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

Done with review pass (iteration 5). Not sure about supported OS platform attribute change.

@jcouv
Copy link
Member

jcouv commented Jul 22, 2021

I did find the output from running this analyzer on Microsoft.CodeAnalysis and Microsoft.CSharp.CodeAnalysis to be interesting, ...

Thanks for providing that output. I was wondering about that. The only example I could think of was CompletionPart which I think we'd like to keep as-is.

@jcouv jcouv self-assigned this Jul 22, 2021
Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

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

LGTM Thanks (iteration 7)

@RikkiGibson RikkiGibson merged commit fae6a8f into dotnet:main Jul 22, 2021
@ghost ghost added this to the Next milestone Jul 22, 2021
@RikkiGibson RikkiGibson deleted the enable-ca1069 branch July 22, 2021 21:48
333fred added a commit to 333fred/roslyn that referenced this pull request Jul 23, 2021
* upstream/main: (249 commits)
  Switch back queue name to default (dotnet#55064)
  Fix 'code model' with file scoped namespaces
  Map documents to be reanalyzed back from compile-time to design-time documents (dotnet#55054)
  Update MSBuild Workspace test projects target framework
  Enable CA1069 for ErrorCode and MessageID (dotnet#54695)
  Dev16->17 updates
  Update global.json
  Record completion of "parameterless struct constructor" feature (dotnet#55049)
  Generalize rude edit messages to be applicable to both Hot Reload and EnC (dotnet#55012)
  Update azure-pipelines-official.yml
  Update azure-pipelines-integration.yml
  Merge pull request dotnet#54992 from jaredpar/so-big
  Parameterless struct constructors: Remaining work items (dotnet#54811)
  Update docs/wiki/Diagnosing-Project-System-Build-Errors.md
  update queue name
  Dev16->17 changes
  Fix test
  Fix 'move type' with file scoped namespaces
  Fix 'match folder and namespace' with file scoped namespaces
  Log NFW
  ...
@allisonchou allisonchou modified the milestones: Next, 17.0.P3 Jul 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants