285 references to Create
Aspire.Hosting.Analyzers (1)
AppHostAnalyzer.DetectInvalidModelNames.cs (1)
32context.ReportDiagnostic(Diagnostic.Create(Diagnostics.s_modelNameMustBeValid, token.GetLocation(), validationMessage));
Aspire.Hosting.Integration.Analyzers (11)
AspireExportAnalyzer.cs (11)
165context.ReportDiagnostic(Diagnostic.Create( 175context.ReportDiagnostic(Diagnostic.Create( 184context.ReportDiagnostic(Diagnostic.Create( 196context.ReportDiagnostic(Diagnostic.Create( 256context.ReportDiagnostic(Diagnostic.Create( 322context.ReportDiagnostic(Diagnostic.Create( 357context.ReportDiagnostic(Diagnostic.Create( 719context.ReportDiagnostic(Diagnostic.Create( 737context.ReportDiagnostic(Diagnostic.Create( 750context.ReportDiagnostic(Diagnostic.Create( 772context.ReportDiagnostic(Diagnostic.Create(
ConfigurationSchemaGenerator (1)
RuntimeSource\SourceGenerators\DiagnosticInfo.cs (1)
38=> Diagnostic.Create(Descriptor, Location, MessageArgs);
EventSourceGenerator (2)
EventSourceGenerator.Parser.cs (2)
57var diagnostic = Diagnostic.Create( 86var diagnostic = Diagnostic.Create(
GenerateDocumentationAndConfigFiles (1)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (1)
149return Diagnostic.Create(rule, null, args);
ILLink.RoslynAnalyzer (16)
COMAnalyzer.cs (1)
58operationContext.ReportDiagnostic(Diagnostic.Create(s_correctnessOfCOMCannotBeGuaranteed,
DynamicallyAccessedMembersAnalyzer.cs (9)
127Diagnostic.Create(DiagnosticDescriptors.GetDiagnosticDescriptor( 185context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.GetDiagnosticDescriptor(DiagnosticId.DynamicallyAccessedMembersOnFieldCanOnlyApplyToTypesOrStrings), location, member.GetDisplayName())); 189context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.GetDiagnosticDescriptor(DiagnosticId.DynamicallyAccessedMembersOnMethodReturnValueCanOnlyApplyToTypesOrStrings), location, member.GetDisplayName())); 191context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.GetDiagnosticDescriptor(DiagnosticId.DynamicallyAccessedMembersIsNotAllowedOnMethods), location)); 195context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.GetDiagnosticDescriptor(DiagnosticId.DynamicallyAccessedMembersOnMethodParameterCanOnlyApplyToTypesOrStrings), location, parameter.GetDisplayName(), member.GetDisplayName())); 201context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.GetDiagnosticDescriptor(DiagnosticId.DynamicallyAccessedMembersOnPropertyCanOnlyApplyToTypesOrStrings), location, member.GetDisplayName())); 203context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.GetDiagnosticDescriptor(DiagnosticId.DynamicallyAccessedMembersIsNotAllowedOnExtensionProperties), location, member.GetDisplayName())); 300context.ReportDiagnostic(Diagnostic.Create( 347context.ReportDiagnostic(Diagnostic.Create(
RequiresAnalyzerBase.cs (4)
280symbolAnalysisContext.ReportDiagnostic(Diagnostic.Create( 288symbolAnalysisContext.ReportDiagnostic(Diagnostic.Create( 298symbolAnalysisContext.ReportDiagnostic(Diagnostic.Create( 440var diag = Diagnostic.Create(diagnosticDescriptor, Location.None, refAssembly.Name);
TrimAnalysis\DiagnosticContext.cs (1)
27return Diagnostic.Create(DiagnosticDescriptors.GetDiagnosticDescriptor(id), Location, args);
UnsafeMethodMissingRequiresUnsafeAnalyzer.cs (1)
55context.ReportDiagnostic(Diagnostic.Create(s_rule, location, method.GetDisplayName()));
Microsoft.Analyzers.Extra (16)
AsyncCallInsideUsingBlockAnalyzer.cs (1)
123Diagnostic.Create(DiagDescriptors.AsyncCallInsideUsingBlock, invocation.Syntax.GetLocation());
AsyncMethodWithoutCancellation.cs (1)
110Diagnostic.Create(DiagDescriptors.AsyncMethodWithoutCancellation, analysisContext.Node.GetLocation());
CallAnalysis\Arrays.cs (1)
128var diagnostic = Diagnostic.Create(DiagDescriptors.Arrays, loc, valueType.ToDisplayString(), type.ToDisplayString());
CallAnalysis\LegacyCollection.cs (1)
33var diagnostic = Diagnostic.Create(DiagDescriptors.LegacyCollection, op.Syntax.GetLocation());
CallAnalysis\LegacyLogging.cs (1)
38var diagnostic = Diagnostic.Create(DiagDescriptors.LegacyLogging, op.Syntax.GetLocation());
CallAnalysis\Split.cs (1)
28var diagnostic = Diagnostic.Create(DiagDescriptors.Split, op.Syntax.GetLocation());
CallAnalysis\StartsEndsWith.cs (1)
59var diagnostic = Diagnostic.Create(DiagDescriptors.StartsEndsWith, op.Syntax.GetLocation(), op.TargetMethod.Name);
CallAnalysis\StaticTime.cs (2)
52var diagnostic = Diagnostic.Create(DiagDescriptors.StaticTime, op.Syntax.GetLocation()); 58var diagnostic = Diagnostic.Create(DiagDescriptors.StaticTime, op.Syntax.GetLocation());
CallAnalysis\ValueTuple.cs (2)
42var diagnostic = Diagnostic.Create(DiagDescriptors.ValueTuple, op.Syntax.GetLocation()); 48var diagnostic = Diagnostic.Create(DiagDescriptors.ValueTuple, op.Syntax.GetLocation());
CoalesceAnalyzer.cs (2)
52var diagnostic = Diagnostic.Create(DiagDescriptors.CoalesceAssignment, op.Syntax.GetLocation()); 79var diagnostic = Diagnostic.Create(DiagDescriptors.Coalesce, op.Syntax.GetLocation());
ConditionalAccessAnalyzer.cs (1)
111var diagnostic = Diagnostic.Create(DiagDescriptors.ConditionalAccess, op.Syntax.GetLocation());
MakeExeTypesInternalAnalyzer.cs (1)
134var diagnostic = Diagnostic.Create(DiagDescriptors.MakeExeTypesInternal, type.Locations[0], type.Name);
UsingToStringInLoggersAnalyzer.cs (1)
69yield return Diagnostic.Create(DiagDescriptors.UsingToStringInLoggers, arg.Syntax.GetLocation());
Microsoft.Analyzers.Local (15)
ApiLifecycle\ApiLifecycleAnalyzer.cs (11)
74context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.NewSymbolsMustBeMarkedExperimental, symbol.Locations.FirstOrDefault(), symbol)); 82context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.PublishedSymbolsCantBeDeleted, null, type.ModifiersAndName)); 87context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.PublishedSymbolsCantBeDeleted, null, method.Member)); 92context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.PublishedSymbolsCantBeDeleted, null, prop.Member)); 97context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.PublishedSymbolsCantBeDeleted, null, field.Member)); 111context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.ExperimentalSymbolsCantBeMarkedObsolete, symbol.Locations.FirstOrDefault(), symbol)); 118context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.PublishedSymbolsCantBeMarkedExperimental, symbol.Locations.FirstOrDefault(), symbol)); 125context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.PublishedSymbolsCantChange, symbol.Locations.FirstOrDefault(), symbol)); 133context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.PublishedSymbolsCantChange, symbol.Locations.FirstOrDefault(), symbol)); 154context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.NewSymbolsMustBeMarkedExperimental, type.Locations.FirstOrDefault(), type)); 158context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.ExperimentalSymbolsCantBeMarkedObsolete, type.Locations.FirstOrDefault(), type));
CallAnalysis\Throws.cs (2)
37var diagnostic = Diagnostic.Create( 51var diagnostic = Diagnostic.Create(
CallAnalysis\ToInvariantString.cs (1)
51var diagnostic = Diagnostic.Create(DiagDescriptors.ToInvariantString, op.Syntax.GetLocation());
InternalReferencedInPublicDocAnalyzer.cs (1)
154var diagnostic = Diagnostic.Create(DiagDescriptors.InternalReferencedInPublicDoc, crefNode.Cref.GetLocation(), referencedName);
Microsoft.AspNetCore.Analyzers (4)
BuildServiceProviderAnalyzer.cs (1)
31context.ReportDiagnostic(Diagnostic.Create(
UseAuthorizationAnalyzer.cs (2)
49context.ReportDiagnostic(Diagnostic.Create( 69context.ReportDiagnostic(Diagnostic.Create(
UseMvcAnalyzer.cs (1)
43context.ReportDiagnostic(Diagnostic.Create(
Microsoft.AspNetCore.App.Analyzers (19)
Authorization\AddAuthorizationBuilderAnalyzer.cs (1)
230context.ReportDiagnostic(Diagnostic.Create(
Http\HeaderDictionaryAddAnalyzer.cs (1)
74context.ReportDiagnostic(Diagnostic.Create(
Http\RequestDelegateReturnTypeAnalyzer.cs (1)
78context.ReportDiagnostic(Diagnostic.Create(
Kestrel\ListenOnIPv6AnyAnalyzer.cs (2)
69context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.KestrelShouldListenOnIPv6AnyInsteadOfIpAny, ipAddressArgumentSyntax.GetLocation())); 94context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.KestrelShouldListenOnIPv6AnyInsteadOfIpAny, ipAddressArgumentSyntax.GetLocation()));
Mvc\DetectAmbiguousActionRoutes.cs (1)
42context.ReportDiagnostic(Diagnostic.Create(
Mvc\DetectOverriddenAuthorizeAttribute.cs (1)
216context.ReportDiagnostic(Diagnostic.Create(
RenderTreeBuilder\RenderTreeBuilderAnalyzer.cs (1)
45context.ReportDiagnostic(Diagnostic.Create(
RouteHandlers\AtMostOneFromBodyAttribute.cs (1)
54context.ReportDiagnostic(Diagnostic.Create(
RouteHandlers\DetectAmbiguousRoutes.cs (1)
40context.ReportDiagnostic(Diagnostic.Create(
RouteHandlers\DetectMismatchedParameterOptionality.cs (1)
36context.ReportDiagnostic(Diagnostic.Create(
RouteHandlers\DetectMisplacedLambdaAttribute.cs (1)
47context.ReportDiagnostic(Diagnostic.Create(
RouteHandlers\DisallowMvcBindArgumentsOnParameters.cs (1)
38context.ReportDiagnostic(Diagnostic.Create(
RouteHandlers\DisallowNonParsableComplexTypesOnParameters.cs (2)
74context.ReportDiagnostic(Diagnostic.Create( 103context.ReportDiagnostic(Diagnostic.Create(
RouteHandlers\DisallowReturningActionResultFromMapMethods.cs (2)
47context.ReportDiagnostic(Diagnostic.Create( 81context.ReportDiagnostic(Diagnostic.Create(
WebApplicationBuilder\PublicPartialProgramClassAnalyzer.cs (1)
27context.ReportDiagnostic(Diagnostic.Create(
WebApplicationBuilder\WebApplicationBuilderAnalyzer.cs (1)
304return Diagnostic.Create(descriptor, location, methodName);
Microsoft.AspNetCore.Components.Analyzers (14)
ComponentParameterAnalyzer.cs (5)
84context.ReportDiagnostic(Diagnostic.Create( 91context.ReportDiagnostic(Diagnostic.Create( 105context.ReportDiagnostic(Diagnostic.Create( 115context.ReportDiagnostic(Diagnostic.Create( 126context.ReportDiagnostic(Diagnostic.Create(
ComponentParameterUsageAnalyzer.cs (1)
105context.ReportDiagnostic(Diagnostic.Create(
InternalUsageAnalyzer.cs (4)
137context.ReportDiagnostic(Diagnostic.Create( 147context.ReportDiagnostic(Diagnostic.Create( 166context.ReportDiagnostic(Diagnostic.Create( 176context.ReportDiagnostic(Diagnostic.Create(
InvokeAsyncOfObjectAnalyzer.cs (1)
80operationContext.ReportDiagnostic(Diagnostic.Create(
PersistentStateAnalyzer.cs (1)
76context.ReportDiagnostic(Diagnostic.Create(
SupplyParameterFromFormAnalyzer.cs (1)
76context.ReportDiagnostic(Diagnostic.Create(
VirtualizeItemComparerAnalyzer.cs (1)
124endContext.ReportDiagnostic(Diagnostic.Create(
Microsoft.AspNetCore.Components.SdkAnalyzers (9)
ComponentParameterAnalyzer.cs (4)
78context.ReportDiagnostic(Diagnostic.Create( 85context.ReportDiagnostic(Diagnostic.Create( 99context.ReportDiagnostic(Diagnostic.Create( 113context.ReportDiagnostic(Diagnostic.Create(
ComponentParameterUsageAnalyzer.cs (1)
105context.ReportDiagnostic(Diagnostic.Create(
InternalUsageAnalyzer.cs (4)
137context.ReportDiagnostic(Diagnostic.Create( 147context.ReportDiagnostic(Diagnostic.Create( 166context.ReportDiagnostic(Diagnostic.Create( 176context.ReportDiagnostic(Diagnostic.Create(
Microsoft.AspNetCore.Mvc.Analyzers (7)
AttributesShouldNotBeAppliedToPageModelAnalyzer.cs (3)
89context.ReportDiagnostic(Diagnostic.Create( 103context.ReportDiagnostic(Diagnostic.Create( 117context.ReportDiagnostic(Diagnostic.Create(
AvoidHtmlPartialAnalyzer.cs (2)
31context.ReportDiagnostic(Diagnostic.Create( 38context.ReportDiagnostic(Diagnostic.Create(
TagHelpersInCodeBlocksAnalyzer.cs (1)
97Diagnostic.Create(DiagnosticDescriptors.MVC1006_FunctionsContainingTagHelpersMustBeAsyncAndReturnTask, location));
TopLevelParameterNameAnalyzer.cs (1)
74Diagnostic.Create(
Microsoft.AspNetCore.Mvc.Api.Analyzers (3)
ApiConventionAnalyzer.cs (3)
60context.ReportDiagnostic(Diagnostic.Create( 66context.ReportDiagnostic(Diagnostic.Create( 86context.ReportDiagnostic(Diagnostic.Create(
Microsoft.CodeAnalysis (7)
CommandLine\AnalyzerConfigSet.cs (3)
432diagnosticBuilder.Add(Diagnostic.Create( 503diagnostics.Add(Diagnostic.Create( 528diagnostics.Add(Diagnostic.Create(
Diagnostic\DiagnosticDescriptor.cs (1)
244var effectiveDiagnostic = compilationOptions.FilterDiagnostic(Diagnostic.Create(this, Location.None), CancellationToken.None);
DiagnosticAnalyzer\AnalyzerExecutor.cs (2)
1408return Diagnostic.Create(descriptor, Location.None, messageArguments); 1455return Diagnostic.Create(descriptor, Location.None, messageArguments);
SourceGeneration\GeneratorDriver.cs (1)
441return Diagnostic.Create(descriptor, Location.None, generator.GetGeneratorType().Name, e.GetType().Name, e.Message, e.CreateDiagnosticDescription());
Microsoft.CodeAnalysis.Analyzers (14)
MetaAnalyzers\CompilerExtensionStrictApiAnalyzer.cs (1)
153context.ReportDiagnostic(Diagnostic.Create(descriptor, Location.Create(applicationSyntaxReference.SyntaxTree, applicationSyntaxReference.Span)));
MetaAnalyzers\CompilerExtensionTargetFrameworkAnalyzer.cs (1)
102context.ReportDiagnostic(Diagnostic.Create(
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer.cs (2)
443context.ReportDiagnostic(Diagnostic.Create(AddCompilationEndCustomTagRule, field.Locations[0], field.Name)); 480var diagnostic = Diagnostic.Create(UseUniqueDiagnosticIdRule, location, ruleId, skippedAnalyzerName);
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer_IdRangeAndCategoryValidation.cs (1)
340var diagnostic = Diagnostic.Create(AnalyzerCategoryAndIdRangeFileInvalidRule, location, arg1, arg2);
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer_ReleaseTracking.cs (4)
206var diagnostic = Diagnostic.Create(RemoveDuplicateEntriesForAnalyzerReleaseRule, location, arg1, arg2, arg3); 238var diagnostic = Diagnostic.Create(rule, location, arg1, arg2); 451var diagnostic = Diagnostic.Create(RemoveDuplicateEntriesBetweenAnalyzerReleasesRule, location, arg1, arg2, arg3); 471var diagnostic = Diagnostic.Create(InvalidRemovedOrChangedWithoutPriorNewEntryInAnalyzerReleasesFileRule, location, arg1, arg2, arg3);
MetaAnalyzers\DoNotUseFileTypesForAnalyzersOrGenerators.cs (1)
64var diagnostic = Diagnostic.Create(Rule, namedTypeSymbol.Locations[0], namedTypeSymbol.Name);
MetaAnalyzers\RegisterActionAnalyzer.cs (3)
412Diagnostic diagnostic = Diagnostic.Create(InvalidSyntaxKindTypeArgumentRule, location, typeArgument.Name, DiagnosticWellKnownNames.TLanguageKindEnumName, method.Name); 573diagnostic = Diagnostic.Create(StartActionWithNoRegisteredActionsRule, location, parameterName, parentRegisterMethodName); 577diagnostic = Diagnostic.Create(StartActionWithOnlyEndActionRule, location, parameterName, endActionName, statelessActionName, parentRegisterMethodName);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (1)
149return Diagnostic.Create(rule, null, args);
Microsoft.CodeAnalysis.AnalyzerUtilities (1)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (1)
149return Diagnostic.Create(rule, null, args);
Microsoft.CodeAnalysis.CodeStyle (9)
src\roslyn\src\Analyzers\Core\Analyzers\ConvertTypeofToNameof\AbstractConvertTypeOfToNameOfDiagnosticAnalyzer.cs (1)
42context.ReportDiagnostic(Diagnostic.Create(Descriptor, location));
src\roslyn\src\Analyzers\Core\Analyzers\FileHeaders\AbstractFileHeaderDiagnosticAnalyzer.cs (2)
71context.ReportDiagnostic(Diagnostic.Create(s_missingHeaderDescriptor, fileHeader.GetLocation(tree))); 78context.ReportDiagnostic(Diagnostic.Create(s_invalidHeaderDescriptor, fileHeader.GetLocation(tree)));
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (3)
142context.ReportDiagnostic(Diagnostic.Create(s_enableGenerateDocumentationFileIdDescriptor, Location.None)); 209yield return Diagnostic.Create(descriptor, tree.GetLocation(span)); 222yield return Diagnostic.Create(s_fixableIdDescriptor, tree.GetLocation(span));
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.cs (2)
82reportDiagnostic(Diagnostic.Create(s_invalidScopeDescriptor, attributeSyntax.GetLocation())); 89reportDiagnostic(Diagnostic.Create(s_invalidOrMissingTargetDescriptor, attributeSyntax.GetLocation()));
src\roslyn\src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (1)
357var diagnostic = Diagnostic.Create(
Microsoft.CodeAnalysis.CSharp.CodeStyle (7)
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeAnonymousFunctionStatic\MakeAnonymousFunctionStaticDiagnosticAnalyzer.cs (1)
52Diagnostic.Create(
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (1)
112var diagnostic = Diagnostic.Create(
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryAsyncModifier\CSharpMakeMethodSynchronousDiagnosticAnalyzer.cs (1)
128context.ReportDiagnostic(Diagnostic.Create(
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationDiagnosticAnalyzer.cs (1)
95context.ReportDiagnostic(Diagnostic.Create(
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveRedundantNullableDirectiveDiagnosticAnalyzer.cs (1)
101context.ReportDiagnostic(Diagnostic.Create(Descriptor, directive.GetLocation()));
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (2)
121diagnostics.Add(Diagnostic.Create(Descriptor, currentOptionsDirective.GetLocation())); 153diagnostics.Add(Diagnostic.Create(Descriptor, currentOptionsDirective.GetLocation()));
Microsoft.CodeAnalysis.CSharp.Features (10)
Copilot\CSharpImplementNotImplementedExceptionDiagnosticAnalyzer.cs (2)
63context.ReportDiagnostic(Diagnostic.Create( 76context.ReportDiagnostic(Diagnostic.Create(
Diagnostics\Analyzers\FileBasedPrograms\FileLevelDirectiveDiagnosticAnalyzer.cs (1)
61context.ReportDiagnostic(Diagnostic.Create(
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeAnonymousFunctionStatic\MakeAnonymousFunctionStaticDiagnosticAnalyzer.cs (1)
52Diagnostic.Create(
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (1)
112var diagnostic = Diagnostic.Create(
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryAsyncModifier\CSharpMakeMethodSynchronousDiagnosticAnalyzer.cs (1)
128context.ReportDiagnostic(Diagnostic.Create(
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationDiagnosticAnalyzer.cs (1)
95context.ReportDiagnostic(Diagnostic.Create(
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveRedundantNullableDirectiveDiagnosticAnalyzer.cs (1)
101context.ReportDiagnostic(Diagnostic.Create(Descriptor, directive.GetLocation()));
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (2)
121diagnostics.Add(Diagnostic.Create(Descriptor, currentOptionsDirective.GetLocation())); 153diagnostics.Add(Diagnostic.Create(Descriptor, currentOptionsDirective.GetLocation()));
Microsoft.CodeAnalysis.Features (24)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Pragma.cs (1)
212var dummyDiagnosticWithLocationToCheck = Diagnostic.Create(_diagnostic.Descriptor, locationToCheck);
Diagnostics\Analyzers\UnboundIdentifiersDiagnosticAnalyzerBase.cs (1)
80context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptor, typeName.GetLocation(), typeName.ToString()));
Diagnostics\Service\DocumentAnalysisExecutor_Helpers.cs (1)
44return Diagnostic.Create(descriptor, Location.None, analyzerName, e.GetType(), e.Message);
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (1)
829=> Diagnostic.Create(
EditAndContinue\DebuggingSession.cs (2)
297return (Mvid: Guid.Empty, Error: Diagnostic.Create(descriptor, Location.None, [outputs.AssemblyDisplayPath, e.Message])); 427diagnostics.Add(Diagnostic.Create(descriptor, Location.None, [fileBeingRead, e.Message]));
EditAndContinue\EditSession.cs (7)
144return Diagnostic.Create(descriptor, Location.None); 168diagnostics.Add(Diagnostic.Create(descriptor, location, messageArgs)); 634diagnostics.Add(Diagnostic.Create(descriptor, Location.Create(newDocument.FilePath!, textSpan: default, lineSpan: default), [newDocument.FilePath])); 682diagnostics.Add(Diagnostic.Create( 771projectDiagnostics.Add(Diagnostic.Create( 781projectDiagnostics.Add(Diagnostic.Create( 1530var diagnostic = Diagnostic.Create(
EditAndContinue\EmitSolutionUpdateResults.cs (1)
87var diagnostic = Diagnostic.Create(
EditAndContinue\RudeEditDiagnostic.cs (1)
44return Diagnostic.Create(descriptor, tree?.GetLocation(Span) ?? Location.None, Arguments);
src\roslyn\src\Analyzers\Core\Analyzers\ConvertTypeofToNameof\AbstractConvertTypeOfToNameOfDiagnosticAnalyzer.cs (1)
42context.ReportDiagnostic(Diagnostic.Create(Descriptor, location));
src\roslyn\src\Analyzers\Core\Analyzers\FileHeaders\AbstractFileHeaderDiagnosticAnalyzer.cs (2)
71context.ReportDiagnostic(Diagnostic.Create(s_missingHeaderDescriptor, fileHeader.GetLocation(tree))); 78context.ReportDiagnostic(Diagnostic.Create(s_invalidHeaderDescriptor, fileHeader.GetLocation(tree)));
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (3)
142context.ReportDiagnostic(Diagnostic.Create(s_enableGenerateDocumentationFileIdDescriptor, Location.None)); 209yield return Diagnostic.Create(descriptor, tree.GetLocation(span)); 222yield return Diagnostic.Create(s_fixableIdDescriptor, tree.GetLocation(span));
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.cs (2)
82reportDiagnostic(Diagnostic.Create(s_invalidScopeDescriptor, attributeSyntax.GetLocation())); 89reportDiagnostic(Diagnostic.Create(s_invalidOrMissingTargetDescriptor, attributeSyntax.GetLocation()));
src\roslyn\src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (1)
357var diagnostic = Diagnostic.Create(
Microsoft.CodeAnalysis.Razor.Compiler (4)
SourceGenerators\Diagnostics\RazorDiagnostics.cs (1)
127return Diagnostic.Create(descriptor, location);
SourceGenerators\RazorSourceGenerator.RazorProviders.cs (3)
70diagnostics.Add(Diagnostic.Create( 101diagnostics.Add(Diagnostic.Create( 139var diagnostic = Diagnostic.Create(
Microsoft.CodeAnalysis.ResxSourceGenerator (1)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (1)
149return Diagnostic.Create(rule, null, args);
Microsoft.CodeAnalysis.Workspaces (1)
Diagnostics\FileContentLoadAnalyzer.cs (1)
42return [Diagnostic.Create(
Microsoft.DotNet.CodeAnalysis (7)
Analyzers\AppContextDefaultsAnalyzer.cs (4)
76context.ReportDiagnostic(Diagnostic.Create(s_appContextDefaultNotInitializedToTrueDiagnostic, args.GetLocation(), call)); 83context.ReportDiagnostic(Diagnostic.Create(s_appContextDefaultValueDefinedOutsideIfConditionDiagnostic, args.GetLocation(), call)); 91context.ReportDiagnostic(Diagnostic.Create(s_appContextDefaultValueDefinedOutsideIfConditionDiagnostic, args.GetLocation(), call)); 98context.ReportDiagnostic(Diagnostic.Create(s_appContextDefaultUsedUnexpectedIfStatementDiagnostic, containingIfStatement.GetLocation()));
Analyzers\MembersMustExistAnalyzer.cs (1)
39context.ReportDiagnostic(Diagnostic.Create(s_memberMustExistDiagnostic, Location.None, missingAPI));
Analyzers\PinvokeAnalyzer.cs (1)
163context.ReportDiagnostic(Diagnostic.Create(InvalidPinvokeCall, synref.GetSyntax().GetLocation(), data.ModuleName + "!" + (data.EntryPointName ?? methodSymbol.Name), altMsg));
Analyzers\ResourceUsageAnalyzer.cs (1)
53context.ReportDiagnostic(Diagnostic.Create(InvalidSRFormatCall, invokeExpr.GetLocation(), invokeExpr.GetText()));
Microsoft.Extensions.Logging.Generators (2)
LoggerMessageGenerator.Parser.cs (1)
814Diagnostic diagnostic = Diagnostic.Create(desc, location, messageArgs);
LoggerMessageGenerator.Roslyn4.0.cs (1)
69var diagnostics = ImmutableArray.Create(Diagnostic.Create(DiagnosticDescriptors.MissingRequiredType, null, new object?[] { "System.Exception" }));
Microsoft.Extensions.Options.SourceGeneration (2)
Parser.cs (2)
866_reportDiagnostic(Diagnostic.Create(desc, location, Array.Empty<object?>())); 869_reportDiagnostic(Diagnostic.Create(desc, location, messageArgs));
Microsoft.Gen.ComplianceReports (1)
ComplianceReportsGenerator.cs (1)
101context.ReportDiagnostic(Diagnostic.Create(diagnostic, location: null));
Microsoft.Gen.ContextualOptions (4)
Parser.cs (4)
32.Select(modifier => Diagnostic.Create(DiagDescriptors.ContextCannotBeStatic, modifier.GetLocation(), type.Name))); 46.Select(modifier => Diagnostic.Create(DiagDescriptors.ContextCannotBeRefLike, modifier.GetLocation(), type.Name))); 57type.Definitions.Select(def => Diagnostic.Create(DiagDescriptors.ContextMustBePartial, def.Identifier.GetLocation(), type.Name))); 68type.Definitions.Select(def => Diagnostic.Create(DiagDescriptors.ContextDoesNotHaveValidProperties, def.Identifier.GetLocation(), type.Name)));
Microsoft.Gen.Logging (1)
Parsing\Parser.cs (1)
746var d = Diagnostic.Create(desc, location, messageArgs);
Microsoft.Gen.MetadataExtractor (5)
MetadataReportsGenerator.cs (1)
90context.ReportDiagnostic(Diagnostic.Create(diagnostic, location: null));
src\Generators\Microsoft.Gen.ComplianceReports\ComplianceReportsGenerator.cs (1)
101context.ReportDiagnostic(Diagnostic.Create(diagnostic, location: null));
src\Generators\Microsoft.Gen.Metrics\Parser.cs (2)
603_reportDiagnostic(Diagnostic.Create(desc, location, Array.Empty<object?>())); 608_reportDiagnostic(Diagnostic.Create(desc, location, messageArgs));
src\Generators\Microsoft.Gen.MetricsReports\MetricsReportsGenerator.cs (1)
64context.ReportDiagnostic(Diagnostic.Create(diagnostic, location: null));
Microsoft.Gen.Metrics (2)
Parser.cs (2)
603_reportDiagnostic(Diagnostic.Create(desc, location, Array.Empty<object?>())); 608_reportDiagnostic(Diagnostic.Create(desc, location, messageArgs));
Microsoft.Gen.MetricsReports (3)
MetricsReportsGenerator.cs (1)
64context.ReportDiagnostic(Diagnostic.Create(diagnostic, location: null));
src\Generators\Microsoft.Gen.Metrics\Parser.cs (2)
603_reportDiagnostic(Diagnostic.Create(desc, location, Array.Empty<object?>())); 608_reportDiagnostic(Diagnostic.Create(desc, location, messageArgs));
Microsoft.Interop.ComInterfaceGenerator (7)
Analyzers\ComClassGeneratorDiagnosticsAnalyzer.cs (3)
70yield return Diagnostic.Create(GeneratorDiagnostics.RequiresAllowUnsafeBlocks, location); 78yield return Diagnostic.Create( 101yield return Diagnostic.Create(
Analyzers\RuntimeComApiUsageWithSourceGeneratedComAnalyzer.cs (4)
120Diagnostic.Create( 161Diagnostic.Create( 181Diagnostic.Create( 191Diagnostic.Create(
Microsoft.Interop.SourceGeneration (1)
DiagnosticExtensions.cs (1)
97return Diagnostic.Create(
Microsoft.Maui.Controls.BindingSourceGen (1)
BindingSourceGenerator.cs (1)
28 spc.ReportDiagnostic(Diagnostic.Create(diagnostic.Descriptor, diagnostic.Location?.ToLocation()));
Microsoft.Maui.Controls.SourceGen (1)
CodeBehindGenerator.cs (1)
272 context.ReportDiagnostic(Diagnostic.Create(Descriptors.XamlParserError, location, xamlItem.Exception.Message));
Microsoft.ML.CodeAnalyzer.Tests (1)
Code\RelaxTestNamingTest.cs (1)
133context.ReportDiagnostic(Diagnostic.Create(Rule, method.Locations[0]));
Microsoft.ML.InternalCodeAnalyzer (11)
BaseTestClassAnalyzer.cs (1)
78context.ReportDiagnostic(Diagnostic.Create(Rule, namedType.Locations[0], namedType));
BestFriendAnalyzer.cs (1)
110var diagnostic = Diagnostic.Create(Rule, node.GetLocation(), symbol.Name);
BestFriendOnPublicDeclarationsAnalyzer.cs (1)
66var diagnostic = Diagnostic.Create(Rule, attribute.ApplicationSyntaxReference.GetSyntax().GetLocation(), context.Symbol.Name);
ContractsCheckAnalyzer.cs (4)
211context.ReportDiagnostic(Diagnostic.Create( 231context.ReportDiagnostic(Diagnostic.Create( 238context.ReportDiagnostic(Diagnostic.Create( 243context.ReportDiagnostic(Diagnostic.Create(
InstanceInitializerAnalyzer.cs (2)
59var diagnostic = Diagnostic.Create(Rule, symbol.Locations[0], symbol.Name, "field"); 75var diagnostic = Diagnostic.Create(Rule, symbol.Locations[0], symbol.Name, "property");
NameAnalyzer.cs (1)
172var diagnostic = Diagnostic.Create(PrivateFieldName.Rule, identifier.GetLocation(), name);
SingleVariableDeclarationAnalyzer.cs (1)
47var diagnostic = Diagnostic.Create(Rule, context.Node.GetLocation(), jointVariableNames);
Roslyn.Diagnostics.Analyzers (3)
IRemoteJsonServiceParameterAnalyzer.cs (1)
80var diagnostic = Diagnostic.Create(
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (1)
149return Diagnostic.Create(rule, null, args);
SymbolDeclaredEventMustBeGeneratedForSourceSymbols.cs (1)
186Diagnostic diagnostic = Diagnostic.Create(SymbolDeclaredEventRule, sourceSymbol.Locations[0], sourceSymbol.Name, _compilationType.Name, SymbolDeclaredEventName);
Roslyn.Diagnostics.CSharp.Analyzers (1)
CSharpDoNotCapturePrimaryContructorParameters.cs (1)
60context.ReportDiagnostic(Diagnostic.Create(Rule, operation.Syntax.GetLocation(), operation.Parameter.Name));
System.Private.CoreLib.Generators (9)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (9)
332context.ReportDiagnostic(Diagnostic.Create(RuleCantParse, expressionToDecompose.GetLocation())); 343context.ReportDiagnostic(Diagnostic.Create(RuleCantParse, expressionToDecompose.GetLocation())); 356context.ReportDiagnostic(Diagnostic.Create(RuleCantParse, expressionToDecompose.GetLocation())); 365context.ReportDiagnostic(Diagnostic.Create(RuleCantParse, expressionToDecompose.GetLocation())); 373context.ReportDiagnostic(Diagnostic.Create(RuleCantParse, expressionToDecompose.GetLocation())); 546context.ReportDiagnostic(Diagnostic.Create(RuleAttributeNotSpecificEnough, operation.Syntax.GetLocation(), attributeExplicitlyAllowsRelatedSymbol.ToDisplayString())); 613context.ReportDiagnostic(Diagnostic.Create(RuleCantParse, operation.Syntax.GetLocation())); 686context.ReportDiagnostic(Diagnostic.Create(Rule, operation.Syntax.GetLocation(), symbol.ContainingSymbol.ToDisplayString())); 688context.ReportDiagnostic(Diagnostic.Create(RuleHelper, operation.Syntax.GetLocation(), symbol.ToDisplayString()));
System.Text.Json.SourceGeneration (1)
JsonSourceGenerator.Parser.cs (1)
72Diagnostics.Add(Diagnostic.Create(descriptor, location, messageArgs));
System.Text.RegularExpressions.Generator (15)
RegexGenerator.cs (2)
91return (object)(regexMethod, reason, Diagnostic.Create(DiagnosticDescriptors.LimitedSourceGeneration, method.DiagnosticLocation), regexMethod.CompilationData); 98return Diagnostic.Create(DiagnosticDescriptors.InvalidRegexArguments, method.DiagnosticLocation, e.Message);
RegexGenerator.Parser.cs (12)
35return Diagnostic.Create(DiagnosticDescriptors.RegexMemberMustHaveValidSignature, context.TargetNode.GetLocation()); 65return Diagnostic.Create(DiagnosticDescriptors.MultipleGeneratedRegexAttributes, memberSyntax.GetLocation()); 71return Diagnostic.Create(DiagnosticDescriptors.InvalidGeneratedRegexAttribute, memberSyntax.GetLocation()); 77return Diagnostic.Create(DiagnosticDescriptors.InvalidGeneratedRegexAttribute, memberSyntax.GetLocation()); 109return Diagnostic.Create(DiagnosticDescriptors.InvalidRegexArguments, memberSyntax.GetLocation(), "(null)"); 121return Diagnostic.Create(DiagnosticDescriptors.RegexMemberMustHaveValidSignature, memberSyntax.GetLocation()); 135return Diagnostic.Create(DiagnosticDescriptors.RegexMemberMustHaveValidSignature, memberSyntax.GetLocation()); 157return Diagnostic.Create(DiagnosticDescriptors.InvalidRegexArguments, memberSyntax.GetLocation(), e.Message); 165return Diagnostic.Create(DiagnosticDescriptors.InvalidRegexArguments, memberSyntax.GetLocation(), "cultureName"); 174return Diagnostic.Create(DiagnosticDescriptors.InvalidRegexArguments, memberSyntax.GetLocation(), "cultureName"); 193return Diagnostic.Create(DiagnosticDescriptors.InvalidRegexArguments, memberSyntax.GetLocation(), "options"); 199return Diagnostic.Create(DiagnosticDescriptors.InvalidRegexArguments, memberSyntax.GetLocation(), "matchTimeout");
UpgradeToGeneratedRegexAnalyzer.cs (1)
80context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.UseRegexSourceGeneration, location));
System.Windows.Forms.Analyzers (2)
System\Windows\Forms\Analyzers\AppManifestAnalyzer.cs (2)
66context.ReportDiagnostic(Diagnostic.Create(SharedDiagnosticDescriptors.s_cSharpMigrateHighDpiSettings, 73context.ReportDiagnostic(Diagnostic.Create(SharedDiagnosticDescriptors.s_visualBasicMigrateHighDpiSettings,
System.Windows.Forms.Analyzers.CSharp (7)
System\Windows\Forms\CSharp\Analyzers\AvoidPassingTaskWithoutCancellationToken\AvoidPassingTaskWithoutCancellationTokenAnalyzer.cs (1)
89Diagnostic diagnostic = Diagnostic.Create(
System\Windows\Forms\CSharp\Analyzers\ImplementITypedDataObject\ImplementITypedDataObjectAnalyzer.cs (1)
68var diagnostic = Diagnostic.Create(
System\Windows\Forms\CSharp\Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationAnalyzer.cs (1)
98var diagnostic = Diagnostic.Create(
System\Windows\Forms\CSharp\Generators\ApplicationConfiguration\ApplicationConfigurationGenerator.cs (1)
43context.ReportDiagnostic(Diagnostic.Create(
System\Windows\Forms\CSharp\Generators\ApplicationConfiguration\ProjectFileReader.cs (3)
53diagnostic = Diagnostic.Create(CSharpDiagnosticDescriptors.s_propertyCantBeSetToValue, 89diagnostic = Diagnostic.Create(CSharpDiagnosticDescriptors.s_propertyCantBeSetToValueWithReason, 114diagnostic = Diagnostic.Create(CSharpDiagnosticDescriptors.s_propertyCantBeSetToValue,
System.Windows.Forms.Analyzers.VisualBasic (1)
Analyzers\ImplementITypedDataObject\ImplementITypedDataObjectInAdditionToIDataObjectAnalyzer.vb (1)
67Dim diagnostic As Diagnostic = Diagnostic.Create(