@@ -122,7 +122,7 @@ public override void Initialize(AnalysisContext context)
122
122
ISymbol ? aooreThrowIfNegative = aoore . GetMembers ( "ThrowIfNegative" ) . FirstOrDefault ( ) ;
123
123
ISymbol ? aooreThrowIfNegativeOrZero = aoore . GetMembers ( "ThrowIfNegativeOrZero" ) . FirstOrDefault ( ) ;
124
124
ISymbol ? aooreThrowIfGreaterThan = aoore . GetMembers ( "ThrowIfGreaterThan" ) . FirstOrDefault ( ) ;
125
- ISymbol ? aooreThrowIfGreaterThanOrEqual = aoore . GetMembers ( "aooreThrowIfGreaterThanOrEqual " ) . FirstOrDefault ( ) ;
125
+ ISymbol ? aooreThrowIfGreaterThanOrEqual = aoore . GetMembers ( "ThrowIfGreaterThanOrEqual " ) . FirstOrDefault ( ) ;
126
126
ISymbol ? aooreThrowIfLessThan = aoore . GetMembers ( "ThrowIfLessThan" ) . FirstOrDefault ( ) ;
127
127
ISymbol ? aooreThrowIfLessThanOrEqual = aoore . GetMembers ( "ThrowIfLessThanOrEqual" ) . FirstOrDefault ( ) ;
128
128
ISymbol ? aooreThrowIfEqual = aoore . GetMembers ( "ThrowIfEqual" ) . FirstOrDefault ( ) ;
@@ -244,11 +244,24 @@ aooreThrowIfLessThan is not null || aooreThrowIfLessThanOrEqual is not null ||
244
244
245
245
if ( additionalLocations . Length != 0 && ! AvoidComparing ( aooreParameter ! ) )
246
246
{
247
- context . ReportDiagnostic ( condition . CreateDiagnostic (
248
- UseArgumentOutOfRangeExceptionThrowIfRule ,
249
- additionalLocations ,
250
- properties : ImmutableDictionary < string , string ? > . Empty . Add ( MethodNamePropertyKey , methodName ) ,
251
- args : new object [ ] { nameof ( ArgumentOutOfRangeException ) , methodName ! } ) ) ;
247
+ switch ( methodName )
248
+ {
249
+ case "ThrowIfZero" when aooreThrowIfZero is not null :
250
+ case "ThrowIfNegative" when aooreThrowIfNegative is not null :
251
+ case "ThrowIfNegativeOrZero" when aooreThrowIfNegativeOrZero is not null :
252
+ case "ThrowIfGreaterThan" when aooreThrowIfGreaterThan is not null :
253
+ case "ThrowIfGreaterThanOrEqual" when aooreThrowIfGreaterThanOrEqual is not null :
254
+ case "ThrowIfLessThan" when aooreThrowIfLessThan is not null :
255
+ case "ThrowIfLessThanOrEqual" when aooreThrowIfLessThanOrEqual is not null :
256
+ case "ThrowIfEqual" when aooreThrowIfEqual is not null :
257
+ case "ThrowIfNotEqual" when aooreThrowIfNotEqual is not null :
258
+ context . ReportDiagnostic ( condition . CreateDiagnostic (
259
+ UseArgumentOutOfRangeExceptionThrowIfRule ,
260
+ additionalLocations ,
261
+ properties : ImmutableDictionary < string , string ? > . Empty . Add ( MethodNamePropertyKey , methodName ) ,
262
+ args : new object [ ] { nameof ( ArgumentOutOfRangeException ) , methodName ! } ) ) ;
263
+ break ;
264
+ }
252
265
}
253
266
254
267
static bool AvoidComparing ( IParameterReferenceOperation p ) =>
0 commit comments