Skip to content

Commit a9326fa

Browse files
committed
Produce warning on duplicate analyzer references
1 parent 1c3cdb0 commit a9326fa

41 files changed

Lines changed: 334 additions & 17 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/Compilers/CSharp/Portable/CSharpResources.resx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6781,63 +6781,54 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
67816781
<data name="ERR_RefFieldInNonRefStruct" xml:space="preserve">
67826782
<value>A ref field can only be declared in a ref struct.</value>
67836783
</data>
6784-
67856784
<data name="WRN_UseDefViolationPropertySupportedVersion" xml:space="preserve">
67866785
<value>Auto-implemented property '{0}' is read before being explicitly assigned, causing a preceding implicit assignment of 'default'.</value>
67876786
</data>
67886787
<data name="WRN_UseDefViolationPropertySupportedVersion_Title" xml:space="preserve">
67896788
<value>Auto-implemented property is read before being explicitly assigned, causing a preceding implicit assignment of 'default'.</value>
67906789
</data>
6791-
67926790
<data name="WRN_UseDefViolationFieldSupportedVersion" xml:space="preserve">
67936791
<value>Field '{0}' is read before being explicitly assigned, causing a preceding implicit assignment of 'default'.</value>
67946792
</data>
67956793
<data name="WRN_UseDefViolationFieldSupportedVersion_Title" xml:space="preserve">
67966794
<value>Field is read before being explicitly assigned, causing a preceding implicit assignment of 'default'.</value>
67976795
</data>
6798-
67996796
<data name="WRN_UseDefViolationThisSupportedVersion" xml:space="preserve">
68006797
<value>The 'this' object is read before all of its fields have been assigned, causing preceding implicit assignments of 'default' to non-explicitly assigned fields.</value>
68016798
</data>
68026799
<data name="WRN_UseDefViolationThisSupportedVersion_Title" xml:space="preserve">
68036800
<value>The 'this' object is read before all of its fields have been assigned, causing preceding implicit assignments of 'default' to non-explicitly assigned fields.</value>
68046801
</data>
6805-
68066802
<data name="WRN_UnassignedThisAutoPropertySupportedVersion" xml:space="preserve">
68076803
<value>Control is returned to caller before auto-implemented property '{0}' is explicitly assigned, causing a preceding implicit assignment of 'default'.</value>
68086804
</data>
68096805
<data name="WRN_UnassignedThisAutoPropertySupportedVersion_Title" xml:space="preserve">
68106806
<value>Control is returned to caller before auto-implemented property is explicitly assigned, causing a preceding implicit assignment of 'default'.</value>
68116807
</data>
6812-
68136808
<data name="WRN_UnassignedThisSupportedVersion" xml:space="preserve">
68146809
<value>Control is returned to caller before field '{0}' is explicitly assigned, causing a preceding implicit assignment of 'default'.</value>
68156810
</data>
68166811
<data name="WRN_UnassignedThisSupportedVersion_Title" xml:space="preserve">
68176812
<value>Control is returned to caller before field is explicitly assigned, causing a preceding implicit assignment of 'default'.</value>
68186813
</data>
6819-
68206814
<data name="ERR_UseDefViolationFieldUnsupportedVersion" xml:space="preserve">
68216815
<value>Use of possibly unassigned field '{0}'. Consider updating to language version '{1}' to auto-default the field.</value>
68226816
</data>
68236817
<data name="ERR_UseDefViolationPropertyUnsupportedVersion" xml:space="preserve">
68246818
<value>Use of possibly unassigned auto-implemented property '{0}'. Consider updating to language version '{1}' to auto-default the property.</value>
68256819
</data>
6826-
68276820
<data name="WRN_UseDefViolationFieldUnsupportedVersion" xml:space="preserve">
68286821
<value>Use of possibly unassigned field '{0}'. Consider updating to language version '{1}' to auto-default the field.</value>
68296822
</data>
68306823
<data name="WRN_UseDefViolationFieldUnsupportedVersion_Title" xml:space="preserve">
68316824
<value>Use of possibly unassigned field. Consider updating the language version to auto-default the field.</value>
68326825
</data>
6833-
68346826
<data name="WRN_UseDefViolationPropertyUnsupportedVersion" xml:space="preserve">
68356827
<value>Use of possibly unassigned auto-implemented property '{0}'. Consider updating to language version '{1}' to auto-default the property.</value>
68366828
</data>
68376829
<data name="WRN_UseDefViolationPropertyUnsupportedVersion_Title" xml:space="preserve">
68386830
<value>Use of possibly unassigned auto-implemented property. Consider updating the language version to auto-default the property.</value>
68396831
</data>
6840-
68416832
<data name="ERR_UnsupportedTypeForSlicePattern" xml:space="preserve">
68426833
<value>Slice patterns may not be used for a value of type '{0}'.</value>
68436834
</data>
@@ -7211,4 +7202,10 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
72117202
<data name="ERR_RuntimeDoesNotSupportRefFields" xml:space="preserve">
72127203
<value>Target runtime doesn't support ref fields.</value>
72137204
</data>
7214-
</root>
7205+
<data name="WRN_DuplicateAnalyzerReference" xml:space="preserve">
7206+
<value>Analyzer reference '{0}' specified multiple times</value>
7207+
</data>
7208+
<data name="WRN_DuplicateAnalyzerReference_Title" xml:space="preserve">
7209+
<value>Analyzer reference specified multiple times</value>
7210+
</data>
7211+
</root>

src/Compilers/CSharp/Portable/Errors/ErrorCode.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2113,6 +2113,7 @@ internal enum ErrorCode
21132113
ERR_ScopedTypeNameDisallowed = 9062,
21142114
ERR_UnscopedRefAttributeUnsupportedTarget = 9063,
21152115
ERR_RuntimeDoesNotSupportRefFields = 9064,
2116+
WRN_DuplicateAnalyzerReference = 9065,
21162117

21172118
#endregion
21182119

src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ internal static int GetWarningLevel(ErrorCode code)
501501
case ErrorCode.WRN_UnassignedThisSupportedVersion:
502502
case ErrorCode.WRN_ObsoleteMembersShouldNotBeRequired:
503503
case ErrorCode.WRN_AnalyzerReferencesNewerCompiler:
504+
case ErrorCode.WRN_DuplicateAnalyzerReference:
504505
return 1;
505506
default:
506507
return 0;
@@ -2214,6 +2215,7 @@ internal static bool IsBuildOnlyDiagnostic(ErrorCode code)
22142215
case ErrorCode.ERR_ScopedTypeNameDisallowed:
22152216
case ErrorCode.ERR_UnscopedRefAttributeUnsupportedTarget:
22162217
case ErrorCode.ERR_RuntimeDoesNotSupportRefFields:
2218+
case ErrorCode.WRN_DuplicateAnalyzerReference:
22172219
return false;
22182220
default:
22192221
// NOTE: All error codes must be explicitly handled in this switch statement

src/Compilers/CSharp/Portable/Errors/MessageProvider.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ internal override bool ShouldAssertExpectedMessageArgumentsLength(int errorCode)
179179
public override int WRN_UnableToLoadAnalyzer => (int)ErrorCode.WRN_UnableToLoadAnalyzer;
180180
public override int WRN_AnalyzerReferencesFramework => (int)ErrorCode.WRN_AnalyzerReferencesFramework;
181181
public override int WRN_AnalyzerReferencesNewerCompiler => (int)ErrorCode.WRN_AnalyzerReferencesNewerCompiler;
182+
public override int WRN_DuplicateAnalyzerReference => (int)ErrorCode.WRN_DuplicateAnalyzerReference;
182183
public override int INF_UnableToLoadSomeTypesInAnalyzer => (int)ErrorCode.INF_UnableToLoadSomeTypesInAnalyzer;
183184
public override int ERR_CantReadRulesetFile => (int)ErrorCode.ERR_CantReadRulesetFile;
184185
public override int ERR_CompileCancelled => (int)ErrorCode.ERR_CompileCancelled;

src/Compilers/CSharp/Portable/Generated/ErrorFacts.Generated.cs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)