134 references to Diagnostic
Microsoft.CodeAnalysis.Analyzers.UnitTests (19)
ImplementationIsObsoleteAnalyzerTests.cs (2)
80VerifyCS.Diagnostic().WithSpan(2, 7, 2, 16).WithArguments("SomeClass", "IMyInterface", "https://example.com"), 82VerifyCS.Diagnostic().WithSpan(4, 7, 4, 21).WithArguments("SomeOtherClass", "IMyInterface", "https://example.com"),
InternalImplementationOnlyTests.cs (6)
83VerifyCS.Diagnostic().WithSpan(2, 7, 2, 16).WithArguments("SomeClass", "IMyInterface"), 85VerifyCS.Diagnostic().WithSpan(4, 7, 4, 21).WithArguments("SomeOtherClass", "IMyInterface"), 154VerifyCS.Diagnostic().WithSpan(3, 7, 3, 16).WithArguments("SomeClass", "ISymbol"), 222VerifyCS.Diagnostic().WithSpan(4, 7, 4, 21).WithArguments("SomeOtherClass", "ISymbol"), 336VerifyCS.Diagnostic().WithSpan(3, 7, 3, 16).WithArguments("SomeClass", "IOperation"), 360VerifyCS.Diagnostic().WithSpan(4, 7, 4, 21).WithArguments("SomeOtherClass", "IOperation"),
MetaAnalyzers\ClassIsNotDiagnosticAnalyzerTests.cs (2)
34VerifyCS.Diagnostic().WithLocation(7, 20).WithArguments("NotAnAnalyzer")); 68VerifyCS.Diagnostic().WithLocation(7, 27).WithArguments("NotAnAnalyzer"));
MetaAnalyzers\CompilerExtensionTargetFrameworkAnalyzerTests.cs (1)
115VerifyCS.Diagnostic().WithLocation(0).WithArguments(GetDisplayName(framework)),
MetaAnalyzers\DoNotStorePerCompilationDataOntoFieldsRuleTests.cs (1)
600VerifyCS.Diagnostic()
MetaAnalyzers\DoNotUseCompilationGetSemanticModelTests.cs (1)
215VerifyCS.Diagnostic().WithLocation(line, column);
MetaAnalyzers\DoNotUseFileLocalTypesForAnalyzersOrGeneratorsTests.cs (4)
38VerifyCS.Diagnostic().WithSpan(5, 12, 5, 16).WithArguments("Type"), 61VerifyCS.Diagnostic().WithSpan(4, 12, 4, 16).WithArguments("Type"), 82VerifyCS.Diagnostic().WithSpan(2, 12, 2, 16).WithArguments("Type"), 102VerifyCS.Diagnostic().WithSpan(2, 12, 2, 16).WithArguments("Type"),
MetaAnalyzers\InvalidReportDiagnosticRuleTests.cs (1)
263VerifyCS.Diagnostic()
UseReturnValueFromImmutableObjectMethodTests.cs (1)
206VerifyCS.Diagnostic().WithLocation(markupKey).WithArguments(objectName, methodName);
Microsoft.CodeAnalysis.BannedApiAnalyzers.UnitTests (1)
RestrictedInternalsVisibleToAnalyzerTests.cs (1)
23VerifyCS.Diagnostic()
Microsoft.CodeAnalysis.NetAnalyzers.UnitTests (101)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\AvoidEmptyInterfacesTests.cs (2)
308csTest.ExpectedDiagnostics.Add(VerifyCS.Diagnostic().WithSpan(@"/folder1/Test0.cs", 1, 26, 1, 27).WithSpan(@"/folder2/Test1.cs", 1, 26, 1, 27)); 344=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\AvoidExcessiveParametersOnGenericTypesTests.cs (1)
21VerifyCS.Diagnostic().WithSpan(2, 14, 2, 15).WithArguments("C", AvoidExcessiveParametersOnGenericTypes.MaximumNumberOfTypeParameters));
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\CancellationTokenParametersMustComeLastTests.cs (8)
38var expected = VerifyCS.Diagnostic().WithLocation(5, 10).WithArguments("T.M(System.Threading.CancellationToken, int)"); 55var expected = VerifyCS.Diagnostic().WithLocation(5, 10).WithArguments("T.M(System.Threading.CancellationToken, int, System.Threading.CancellationToken)"); 162var expected = VerifyCS.Diagnostic().WithLocation(5, 28).WithArguments("B.M(System.Threading.CancellationToken, int)"); 184var expected = VerifyCS.Diagnostic().WithLocation(5, 10).WithArguments("I.M(System.Threading.CancellationToken, int)"); 206var expected = VerifyCS.Diagnostic().WithLocation(5, 10).WithArguments("I.M(System.Threading.CancellationToken, int)"); 254var expected = VerifyCS.Diagnostic().WithLocation(5, 24).WithArguments("C1.M1(object, System.Threading.CancellationToken, object)"); 303VerifyCS.Diagnostic().WithLocation(8, 17) 339VerifyCS.Diagnostic().WithLocation(8, 17)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\CollectionPropertiesShouldBeReadOnlyTests.cs (1)
27=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\DoNotDeclareStaticMembersOnGenericTypesTests.cs (1)
455=> VerifyCS.Diagnostic().WithLocation(line, column);
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\DoNotDeclareVisibleInstanceFieldsTests.cs (1)
433=> VerifyCS.Diagnostic().WithLocation(line, column);
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\DoNotDirectlyAwaitATaskTests.cs (1)
702csharpTest.ExpectedDiagnostics.Add(VerifyCS.Diagnostic().WithLocation(0));
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\DoNotExposeGenericListsTests.cs (1)
366=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\DoNotHideBaseClassMethodsTests.cs (1)
479=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\DoNotNameEnumValuesReservedTests.cs (1)
117=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\DoNotOverloadOperatorEqualsOnReferenceTypesTests.cs (1)
25VerifyCS.Diagnostic().WithSpan(4, 33, 4, 35).WithArguments("C"));
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\DoNotPassTypesByReferenceTests.cs (2)
26VerifyCS.Diagnostic().WithSpan(4, 36, 4, 37).WithArguments("s"), 27VerifyCS.Diagnostic().WithSpan(4, 50, 4, 51).WithArguments("o"));
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\DoNotPrefixEnumValuesWithTypeNameTests.cs (1)
385=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\IdentifiersShouldDifferByMoreThanCaseTests.cs (3)
442=> VerifyCS.Diagnostic() 448=> VerifyCS.Diagnostic() 455var diagnosticResult = VerifyCS.Diagnostic().WithArguments(typeName, objectName);
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\IdentifiersShouldNotContainTypeNamesTests.cs (1)
481=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\ImplementStandardExceptionConstructorsTests.cs (1)
340=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\InterfaceMethodsShouldBeCallableByChildTypesTests.cs (1)
21=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\MarkAttributesWithAttributeUsageTests.cs (1)
141=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\MovePInvokesToNativeMethodsClassTests.cs (1)
21=> VerifyCS.Diagnostic().WithLocation(line, column);
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\NonConstantFieldsShouldNotBeVisibleTests.cs (1)
150=> VerifyCS.Diagnostic().WithLocation(line, column);
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\OperatorsShouldHaveSymmetricalOverloadsTests.cs (1)
158=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\OverloadOperatorEqualsOnOverridingValueTypeEqualsTests.cs (1)
301=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\ParameterNamesShouldMatchBaseDeclarationTests.cs (1)
677=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\PassSystemUriObjectsInsteadOfStringsTests.cs (1)
495=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\PropertiesShouldNotReturnArraysTests.cs (1)
143=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\PropertyNamesShouldNotMatchGetMethodsTests.cs (1)
765=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\ProvideObsoleteAttributeMessageTests.cs (1)
191=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\StaticHolderTypeTests.cs (1)
22=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\TypesThatOwnDisposableFieldsShouldBeDisposableTests.cs (3)
733VerifyCS.Diagnostic().WithLocation(0).WithArguments("NoDisposeClass", "_fs1"), @" 807VerifyCS.Diagnostic().WithLocation(0).WithArguments("NoDisposeClass", "_fs1', '_fs2', '_fs3', '_fs4"), @" 896ExpectedDiagnostics = { VerifyCS.Diagnostic().WithLocation(0).WithArguments("SomeClass", args), },
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\UriParametersShouldNotBeStringsTests.cs (1)
294=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\UriPropertiesShouldNotBeStringsTests.cs (1)
233=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\UriReturnValuesShouldNotBeStringsTests.cs (1)
197=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\UseEventsWhereAppropriateTests.cs (1)
622=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\UseIntegralOrStringArgumentForIndexersTests.cs (1)
265=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\UsePropertiesWhereAppropriateTests.cs (1)
577=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\Documentation\AvoidUsingCrefTagsWithAPrefixTests.cs (1)
85=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\Maintainability\AvoidUninstantiatedInternalClassesTests.cs (1)
1703=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\Maintainability\AvoidUnusedPrivateFieldsTests.cs (1)
437=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\QualityGuidelines\AssigningSymbolAndItsMemberInSameStatementTests.cs (1)
345=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\QualityGuidelines\AvoidPropertySelfAssignmentTests.cs (1)
405=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\QualityGuidelines\DoNotCallOverridableMethodsInConstructorsTests.cs (1)
535=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\QualityGuidelines\DoNotDeclareEventFieldsAsVirtualTests.cs (1)
23VerifyCS.Diagnostic().WithLocation(5, 39).WithArguments("ThresholdReached"));
Microsoft.CodeQuality.Analyzers\QualityGuidelines\DoNotPassDisposablesIntoUnawaitedTasksTests.cs (1)
206VerifyCS.Diagnostic().WithSpan(10, 27, 10, 29)
Microsoft.CodeQuality.Analyzers\QualityGuidelines\DoNotRaiseExceptionsInExceptionClausesTests.cs (1)
144=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\QualityGuidelines\MarkMembersAsStaticTests.cs (17)
62VerifyCS.Diagnostic().WithLocation(0).WithArguments("Method1"), 63VerifyCS.Diagnostic().WithLocation(1).WithArguments("Method2"), 64VerifyCS.Diagnostic().WithLocation(2).WithArguments("Method3"), 65VerifyCS.Diagnostic().WithLocation(3).WithArguments("Method4"), 66VerifyCS.Diagnostic().WithLocation(4).WithArguments("Property"), 67VerifyCS.Diagnostic().WithLocation(5).WithArguments("Property2"), 68VerifyCS.Diagnostic().WithLocation(6).WithArguments("MyProperty"), 69VerifyCS.Diagnostic().WithLocation(7).WithArguments("CustomEvent")); 203VerifyCS.Diagnostic().WithLocation(0).WithArguments("Method1"), 204VerifyCS.Diagnostic().WithLocation(1).WithArguments("Method3"), 205VerifyCS.Diagnostic().WithLocation(2).WithArguments("Method4"), 206VerifyCS.Diagnostic().WithLocation(3).WithArguments("Property"), 207VerifyCS.Diagnostic().WithLocation(4).WithArguments("Property2"), 208VerifyCS.Diagnostic().WithLocation(5).WithArguments("MyProperty"), 209VerifyCS.Diagnostic().WithLocation(6).WithArguments("CustomEvent")); 707VerifyCS.Diagnostic().WithLocation(0).WithArguments("N"), 760VerifyCS.Diagnostic().WithLocation(0).WithArguments("M"));
Microsoft.CodeQuality.Analyzers\QualityGuidelines\RemoveEmptyFinalizersTests.cs (1)
596=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\QualityGuidelines\RethrowToPreserveStackDetailsTests.Fixer.cs (1)
42}", VerifyCS.Diagnostic().WithLocation(14, 13),
Microsoft.CodeQuality.Analyzers\QualityGuidelines\SealMethodsThatSatisfyPrivateInterfacesTests.cs (1)
512=> VerifyCS.Diagnostic()
Microsoft.CodeQuality.Analyzers\QualityGuidelines\ValidateArgumentsOfPublicMethodsTests.cs (1)
27=> VerifyCS.Diagnostic()
Microsoft.NetCore.Analyzers\Resources\MarkAssembliesWithNeutralResourcesLanguageTests.cs (3)
60await VerifyCSharpWithDependenciesAsync(@"class C {}", VerifyCS.Diagnostic()); 74await VerifyCSharpWithDependenciesAsync(@"[assembly: System.Resources.NeutralResourcesLanguage("""")]", VerifyCS.Diagnostic().WithLocation(1, 12)); 82await VerifyCSharpWithDependenciesAsync(@"[assembly: System.Resources.NeutralResourcesLanguage(null)]", VerifyCS.Diagnostic().WithLocation(1, 12));
Microsoft.NetCore.Analyzers\Runtime\AvoidUnsealedAttributesTests.cs (1)
133=> VerifyCS.Diagnostic()
Microsoft.NetCore.Analyzers\Runtime\DisposableFieldsShouldBeDisposedTests.cs (1)
24=> VerifyCS.Diagnostic()
Microsoft.NetCore.Analyzers\Runtime\DisposableTypesShouldDeclareFinalizerTests.cs (1)
498VerifyCS.Diagnostic().WithLocation(line, column);
Microsoft.NetCore.Analyzers\Runtime\DisposeMethodsShouldCallBaseClassDisposeTests.cs (1)
20=> VerifyCS.Diagnostic()
Microsoft.NetCore.Analyzers\Runtime\DoNotLockOnObjectsWithWeakIdentityTests.cs (1)
377=> VerifyCS.Diagnostic()
Microsoft.NetCore.Analyzers\Runtime\DoNotPassLiteralsAsLocalizedParametersTests.cs (1)
1928=> VerifyCS.Diagnostic()
Microsoft.NetCore.Analyzers\Runtime\NormalizeStringsToUppercaseTests.cs (1)
249=> VerifyCS.Diagnostic()
Microsoft.NetCore.Analyzers\Runtime\SpecifyCultureInfoTests.cs (1)
776VerifyCS.Diagnostic()
Microsoft.NetCore.Analyzers\Runtime\TestForEmptyStringsUsingStringLengthTests.cs (1)
19=> VerifyCS.Diagnostic()
Microsoft.NetCore.Analyzers\Runtime\TestForNaNCorrectlyTests.cs (1)
609=> VerifyCS.Diagnostic()
Microsoft.NetCore.Analyzers\Runtime\UseOrdinalStringComparisonTests.cs (1)
21=> VerifyCS.Diagnostic()
Microsoft.NetFramework.Analyzers\DoNotCatchCorruptedStateExceptionsTests.cs (1)
1535=> VerifyCS.Diagnostic().WithLocation(line, column).WithArguments(signature, typeName);
Microsoft.NetFramework.Analyzers\TypesShouldNotExtendCertainBaseTypesTests.cs (8)
349return VerifyCS.Diagnostic().WithLocation(line, column).WithArguments(message); 365return VerifyCS.Diagnostic().WithLocation(line, column).WithArguments(message); 381return VerifyCS.Diagnostic().WithLocation(line, column).WithArguments(message); 397return VerifyCS.Diagnostic().WithLocation(line, column).WithArguments(message); 413return VerifyCS.Diagnostic().WithLocation(line, column).WithArguments(message); 429return VerifyCS.Diagnostic().WithLocation(line, column).WithArguments(message); 445return VerifyCS.Diagnostic().WithLocation(line, column).WithArguments(message); 461return VerifyCS.Diagnostic().WithLocation(line, column).WithArguments(message);
Roslyn.Diagnostics.Analyzers.UnitTests (13)
CSharpDoNotCapturePrimaryConstructorParametersTests.cs (1)
96VerifyCS.Diagnostic().WithSpan(5, 13, 5, 14).WithArguments("i"),
DoNotMixAttributesFromDifferentVersionsOfMEFTests.cs (1)
636VerifyCS.Diagnostic()
ExportedPartsShouldHaveImportingConstructorTests.cs (9)
179ExpectedDiagnostics = { VerifyCS.Diagnostic().WithSpan(4, 2, 4, 17).WithArguments("D") }, 441ExpectedDiagnostics = { VerifyCS.Diagnostic().WithSpan(3, 2, 3, 8).WithArguments("C") }, 515ExpectedDiagnostics = { VerifyCS.Diagnostic().WithSpan(1, 2, 1, mefNamespace.Length + 9).WithArguments("C") }, 597ExpectedDiagnostics = { VerifyCS.Diagnostic().WithSpan(3, 2, 3, 8).WithArguments("C") }, 688ExpectedDiagnostics = { VerifyCS.Diagnostic().WithSpan(5, 5, 5, 19).WithArguments("C") }, 764ExpectedDiagnostics = { VerifyCS.Diagnostic().WithSpan(3, 5, 3, 19).WithArguments("C") }, 841ExpectedDiagnostics = { VerifyCS.Diagnostic().WithSpan(5, 6, 5, 26).WithArguments("C") }, 918VerifyCS.Diagnostic().WithSpan(8, 5, 8, 29).WithArguments("C"), 919VerifyCS.Diagnostic().WithSpan(10, 5, 10, 25).WithArguments("C"),
TestExportsShouldNotBeDiscoverableTests.cs (2)
44ExpectedDiagnostics = { VerifyCS.Diagnostic().WithSpan(3, 2, 3, 8).WithArguments("C") }, 76ExpectedDiagnostics = { VerifyCS.Diagnostic().WithSpan(1, 2, 1, mefNamespace.Length + 9).WithArguments("C") },