4 instantiations of RazorDiagnostic
Microsoft.CodeAnalysis.Razor.Compiler (4)
Language\RazorDiagnostic.cs (4)
30=> new(descriptor, span: null, args: null); 33=> new(descriptor, span, args: null); 36=> new(descriptor, span: null, args); 39=> new(descriptor, span, args);
757 references to RazorDiagnostic
Microsoft.AspNetCore.Mvc.Razor.Extensions.UnitTests (13)
RazorPageDocumentClassifierPassTest.cs (4)
40var expectedDiagnostic = RazorExtensionsDiagnosticFactory.CreatePageDirective_CannotBeImported(sourceSpan); 55var diagnostic = Assert.Single(directive.Node.Diagnostics); 72var expectedDiagnostic = RazorExtensionsDiagnosticFactory.CreatePageDirective_MustExistAtTheTopOfFile(sourceSpan); 91var diagnostic = Assert.Single(directive.Node.Diagnostics);
ViewComponentTagHelperDescriptorFactoryTest.cs (9)
209var diagnostic = Assert.Single(descriptor.GetAllDiagnostics()); 226var diagnostic = Assert.Single(descriptor.GetAllDiagnostics()); 243var diagnostic = Assert.Single(descriptor.GetAllDiagnostics()); 292var diagnostic = Assert.Single(descriptor.GetAllDiagnostics()); 309var diagnostic = Assert.Single(descriptor.GetAllDiagnostics()); 326var diagnostic = Assert.Single(descriptor.GetAllDiagnostics()); 343var diagnostic = Assert.Single(descriptor.GetAllDiagnostics()); 360var diagnostic = Assert.Single(descriptor.GetAllDiagnostics()); 377var diagnostic = Assert.Single(descriptor.GetAllDiagnostics());
Microsoft.AspNetCore.Razor.Language.UnitTests (135)
CodeGeneration\CodeRenderingContextTest.cs (12)
21var diagnostic = RazorDiagnostic.Create(descriptor, SourceSpan.Undefined, "param"); 52var diagnostic = RazorDiagnostic.Create(descriptor, SourceSpan.Undefined, "param"); 79var alwaysOn = RazorDiagnostic.Create( 82var level11 = RazorDiagnostic.Create( 85var level12 = RazorDiagnostic.Create( 88var level13 = RazorDiagnostic.Create(
Components\ComponentDuplicateAttributeDiagnosticPassTest.cs (3)
85var diagnostic = Assert.Single(documentNode.GetAllDiagnostics()); 113var diagnostic = Assert.Single(documentNode.GetAllDiagnostics()); 149var diagnostic = diagnostics[i];
Components\ComponentMarkupBlockPassTest.cs (1)
407var diagnostic = Assert.Single(documentNode.GetAllDiagnostics());
DefaultRazorCSharpLoweringPhaseTest.cs (3)
71var expectedDiagnostic = RazorDiagnostic.Create( 83var diagnostic = Assert.Single(csharpDocument.Diagnostics);
DefaultRazorIntermediateNodeLoweringPhaseTest.cs (5)
184var expectedDiagnostic = RazorDiagnosticFactory.CreateDirective_BlockDirectiveCannotBeImported("custom"); 193var diagnostic = Assert.Single(documentNode.GetAllDiagnostics()); 217var expectedDiagnostic = RazorDiagnosticFactory.CreateDirective_BlockDirectiveCannotBeImported("custom"); 226var diagnostic = Assert.Single(documentNode.GetAllDiagnostics()); 273var diagnostic = Assert.Single(documentNode.Diagnostics);
DefaultRazorTagHelperBinderPhaseTest.cs (5)
476var initialError = RazorDiagnostic.Create( 479var expectedRewritingError = RazorDiagnosticFactory.CreateParsing_TagHelperFoundMalformedTagHelper( 495Assert.Equal<RazorDiagnostic>([initialError, expectedRewritingError], outputTree.Diagnostics); 979var diagnostic = Assert.Single(directiveChunkGenerator.Diagnostics);
DirectiveRemovalOptimizationPassTest.cs (3)
88var expectedDiagnostic = RazorDiagnostic.Create(new RazorDiagnosticDescriptor("RZ9999", "Some diagnostic message.", RazorDiagnosticSeverity.Error)); 102var diagnostic = Assert.Single(documentNode.Diagnostics);
Extensions\DefaultTagHelperTargetExtensionTest.cs (6)
409var expectedDiagnostic = RazorDiagnosticFactory.CreateTagHelper_CodeBlocksNotSupportedInAttributes(expectedLocation); 415var diagnostic = Assert.Single(context.GetDiagnostics()); 431var expectedDiagnostic = RazorDiagnosticFactory.CreateTagHelper_InlineMarkupBlocksNotSupportedInAttributes(expectedLocation, "System.Int32"); 437var diagnostic = Assert.Single(context.GetDiagnostics()); 453var expectedDiagnostic = RazorDiagnosticFactory.CreateTagHelper_InlineMarkupBlocksNotSupportedInAttributes( 461var diagnostic = Assert.Single(context.GetDiagnostics());
IntegrationTests\ComponentBindIntegrationTest.cs (3)
40var diagnostic = Assert.Single(result.RazorDiagnostics); 61var diagnostic = Assert.Single(generated.RazorDiagnostics); 76var diagnostic = Assert.Single(generated.RazorDiagnostics);
IntegrationTests\ComponentChildContentIntegrationTest.cs (8)
70var diagnostic = Assert.Single(generated.RazorDiagnostics); 90var diagnostic = Assert.Single(generated.RazorDiagnostics); 109var diagnostic = Assert.Single(generated.RazorDiagnostics); 195var diagnostic = Assert.Single(generated.RazorDiagnostics); 213var diagnostic = Assert.Single(generated.RazorDiagnostics); 235var diagnostic = Assert.Single(generated.RazorDiagnostics); 255var diagnostic = Assert.Single(generated.RazorDiagnostics); 276var diagnostic = Assert.Single(generated.RazorDiagnostics);
IntegrationTests\ComponentCodeGenerationTestBase.cs (17)
1112var diagnostics = Assert.Single(generated.RazorDiagnostics); 1571var diagnostics = Assert.Single(generated.RazorDiagnostics); 1691var diagnostics = Assert.Single(generated.RazorDiagnostics); 7410var diagnostic = Assert.Single(generated.RazorDiagnostics); 7690var diagnostic = Assert.Single(generated.RazorDiagnostics); 7871var diagnostic = Assert.Single(generated.RazorDiagnostics); 8019var diagnostic = Assert.Single(generated.RazorDiagnostics); 11208var diagnostic = Assert.Single(generated.RazorDiagnostics); 11228var diagnostic = Assert.Single(generated.RazorDiagnostics); 11274var diagnostic = Assert.Single(generated.RazorDiagnostics); 11298var diagnostic = Assert.Single(generated.RazorDiagnostics); 11322var diagnostic = Assert.Single(generated.RazorDiagnostics); 11351var diagnostic = Assert.Single(generated.RazorDiagnostics); 11411var diagnostic = Assert.Single(generated.RazorDiagnostics); 11446var diagnostic = Assert.Single(generated.RazorDiagnostics); 11481var diagnostic = Assert.Single(generated.RazorDiagnostics); 11516var diagnostic = Assert.Single(generated.RazorDiagnostics);
IntegrationTests\ComponentDiagnosticRazorIntegrationTest.cs (6)
43var diagnostic = Assert.Single(generated.RazorDiagnostics); 103var diagnostic = Assert.Single(generated.RazorDiagnostics); 121var diagnostic = Assert.Single(generated.RazorDiagnostics); 142var diagnostic = Assert.Single(generated.RazorDiagnostics); 162var diagnostic = Assert.Single(generated.RazorDiagnostics); 214var diagnostic = Assert.Single(generated.RazorDiagnostics);
IntegrationTests\ComponentGenericTypeIntegrationTest.cs (4)
95var diagnostic = Assert.Single(generated.RazorDiagnostics); 114var diagnostic = Assert.Single(generated.RazorDiagnostics); 371var diagnostic = generated.RazorDiagnostics.Single(); 435var ambiguityDiagnostic = generated.RazorDiagnostics.Single(d => d.Id == "RZ10012");
IntegrationTests\ComponentRenderModeAttributeIntegrationTests.cs (3)
28var diagnostic = Assert.Single(generated.RazorDiagnostics); 41var diag = Assert.Single(generated.RazorDiagnostics); 57var diagnostic = Assert.Single(generated.RazorDiagnostics);
IntegrationTests\ComponentRenderModeDirectiveIntegrationTests.cs (2)
169var diagnostic = Assert.Single(compilationResult.RazorDiagnostics); 184var diagnostic = Assert.Single(compilationResult.RazorDiagnostics);
IntegrationTests\ComponentTemplateIntegrationTest.cs (6)
25var diagnostic = Assert.Single(generated.RazorDiagnostics); 38var diagnostic = Assert.Single(generated.RazorDiagnostics); 87var diagnostic = Assert.Single(generated.RazorDiagnostics); 100var diagnostic = Assert.Single(generated.RazorDiagnostics); 114var diagnostic = Assert.Single(generated.RazorDiagnostics); 127var diagnostic = Assert.Single(generated.RazorDiagnostics);
Legacy\CSharpCodeParserTest.cs (11)
15public static TheoryData<string, SourceLocation, IEnumerable<RazorDiagnostic>> InvalidTagHelperPrefixData 21RazorDiagnostic InvalidPrefixError(int length, char character, string prefix) 27return new TheoryData<string, SourceLocation, IEnumerable<RazorDiagnostic>> 108IEnumerable<RazorDiagnostic> expectedErrors) 112var diagnostics = new List<RazorDiagnostic>(); 136var diagnostics = new List<RazorDiagnostic>(); 168var diagnostics = new List<RazorDiagnostic>(); 169var expectedError = RazorDiagnosticFactory.CreateParsing_InvalidTagHelperLookupText( 178var error = Assert.Single(diagnostics); 186var expectedDiagnostic = RazorDiagnosticFactory.CreateParsing_DuplicateDirective( 207var diagnostic = Assert.Single(chunkGenerator.Diagnostics);
Legacy\TokenizerLookaheadTest.cs (1)
194RazorDiagnostic[] errors)
RazorDiagnosticTest.cs (36)
20var diagnostic = RazorDiagnostic.Create(descriptor, span); 36var diagnostic = RazorDiagnostic.Create(descriptor, span, "Hello", "World"); 51var diagnostic = RazorDiagnostic.Create(descriptor, span, "error"); 67var diagnostic = RazorDiagnostic.Create(descriptor, span, 1.3m); 84var diagnostic = RazorDiagnostic.Create(descriptor, span); 100var diagnostic = RazorDiagnostic.Create(descriptor, span, 1.3m); 116var diagnostic1 = RazorDiagnostic.Create(descriptor, span); 117var diagnostic2 = RazorDiagnostic.Create(descriptor, span); 134var diagnostic1 = RazorDiagnostic.Create(descriptor, span1); 135var diagnostic2 = RazorDiagnostic.Create(descriptor, span2); 152var diagnostic1 = RazorDiagnostic.Create(descriptor1, span); 153var diagnostic2 = RazorDiagnostic.Create(descriptor2, span); 169var diagnostic1 = RazorDiagnostic.Create(descriptor, span); 170var diagnostic2 = RazorDiagnostic.Create(descriptor, span); 187var diagnostic1 = RazorDiagnostic.Create(descriptor, span1); 188var diagnostic2 = RazorDiagnostic.Create(descriptor, span2); 205var diagnostic1 = RazorDiagnostic.Create(descriptor1, span); 206var diagnostic2 = RazorDiagnostic.Create(descriptor2, span);
Microsoft.AspNetCore.Razor.Test.Common (10)
DiagnosticExtensions.cs (1)
15this IEnumerable<RazorDiagnostic> diagnostics,
Language\IntegrationTests\IntermediateNodeWriter.cs (1)
343foreach (var diagnostic in node.Diagnostics)
Language\IntegrationTests\RazorDiagnosticSerializer.cs (1)
10public static string Serialize(RazorDiagnostic diagnostic)
Language\IntegrationTests\RazorIntegrationTestBase.cs (1)
468public required IEnumerable<RazorDiagnostic> RazorDiagnostics { get; set; }
Language\Legacy\ParserTestBase.cs (1)
170protected static string SerializeDiagnostic(RazorDiagnostic diagnostic)
Language\TestBoundAttributeDescriptorBuilderExtensions.cs (1)
108public static BoundAttributeDescriptorBuilder AddDiagnostic(this BoundAttributeDescriptorBuilder builder, RazorDiagnostic diagnostic)
Language\TestRazorCSharpDocument.cs (1)
16ImmutableArray<RazorDiagnostic> diagnostics = default,
Language\TestRequiredAttributeDescriptorBuilderExtensions.cs (1)
59this RequiredAttributeDescriptorBuilder builder, RazorDiagnostic diagnostic)
Language\TestTagHelperDescriptorBuilderExtensions.cs (1)
139public static TagHelperDescriptorBuilder AddDiagnostic(this TagHelperDescriptorBuilder builder, RazorDiagnostic diagnostic)
Language\TestTagMatchingRuleDescriptorBuilderExtensions.cs (1)
48public static TagMatchingRuleDescriptorBuilder AddDiagnostic(this TagMatchingRuleDescriptorBuilder builder, RazorDiagnostic diagnostic)
Microsoft.AspNetCore.Razor.Test.Common.Tooling (2)
Language\IntegrationTests\RazorToolingIntegrationTestBase.cs (1)
342public IEnumerable<RazorDiagnostic> Diagnostics { get; set; }
Language\Legacy\ToolingParserTestBase.cs (1)
154protected static string SerializeDiagnostic(RazorDiagnostic diagnostic)
Microsoft.CodeAnalysis.Razor.Compiler (572)
CSharp\DefaultTagHelperDescriptorFactory.cs (3)
231var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidAttributeNameNullOrEmpty(containingType.GetFullName(), property.Name); 284var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidAttributePrefixNotNull(containingType.GetFullName(), property.Name); 295var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidAttributePrefixNull(containingType.GetFullName(), property.Name);
CSharp\RazorDiagnosticFactory.cs (16)
41public static RazorDiagnostic CreateTagHelper_InvalidAttributeNameNullOrEmpty(string tagHelperDisplayName, string propertyDisplayName) 42=> RazorDiagnostic.Create(TagHelper_InvalidAttributeNameNullOrEmpty, tagHelperDisplayName, propertyDisplayName, TagHelperTypes.HtmlAttributeNameAttribute, TagHelperTypes.HtmlAttributeName.Name); 49public static RazorDiagnostic CreateTagHelper_InvalidAttributePrefixNotNull(string tagHelperDisplayName, string propertyDisplayName) 50=> RazorDiagnostic.Create(TagHelper_InvalidAttributePrefixNotNull, tagHelperDisplayName, propertyDisplayName, TagHelperTypes.HtmlAttributeNameAttribute, TagHelperTypes.HtmlAttributeName.DictionaryAttributePrefix, "IDictionary<string, TValue>"); 57public static RazorDiagnostic CreateTagHelper_InvalidAttributePrefixNull(string tagHelperDisplayName, string propertyDisplayName) 58=> RazorDiagnostic.Create(TagHelper_InvalidAttributePrefixNull, tagHelperDisplayName, propertyDisplayName, TagHelperTypes.HtmlAttributeNameAttribute, TagHelperTypes.HtmlAttributeName.DictionaryAttributePrefix, "IDictionary<string, TValue>"); 65public static RazorDiagnostic CreateTagHelper_InvalidRequiredAttributeCharacter(char invalidCharacter, string requiredAttributes) 66=> RazorDiagnostic.Create(TagHelper_InvalidRequiredAttributeCharacter, invalidCharacter, requiredAttributes); 73public static RazorDiagnostic CreateTagHelper_PartialRequiredAttributeOperator(char partialOperator, string requiredAttributes) 74=> RazorDiagnostic.Create(TagHelper_PartialRequiredAttributeOperator, requiredAttributes, partialOperator); 81public static RazorDiagnostic CreateTagHelper_InvalidRequiredAttributeOperator(char invalidOperator, string requiredAttributes) 82=> RazorDiagnostic.Create(TagHelper_InvalidRequiredAttributeOperator, invalidOperator, requiredAttributes); 89public static RazorDiagnostic CreateTagHelper_InvalidRequiredAttributeMismatchedQuotes(char quote, string requiredAttributes) 90=> RazorDiagnostic.Create(TagHelper_InvalidRequiredAttributeMismatchedQuotes, requiredAttributes, quote); 97public static RazorDiagnostic CreateTagHelper_CouldNotFindMatchingEndBrace(string requiredAttributes) 98=> RazorDiagnostic.Create(TagHelper_CouldNotFindMatchingEndBrace, requiredAttributes);
CSharp\RequiredAttributeParser.cs (3)
66ImmutableArray<RazorDiagnostic> Diagnostics) 73ReadOnlySpan<RazorDiagnostic> diagnostics) 87private MemoryBuilder<RazorDiagnostic> _diagnostics = new();
Language\AllowedChildTagDescriptor.cs (1)
17internal AllowedChildTagDescriptor(string name, string displayName, ImmutableArray<RazorDiagnostic> diagnostics)
Language\AllowedChildTagDescriptorBuilder.cs (4)
28private protected override AllowedChildTagDescriptor BuildCore(ImmutableArray<RazorDiagnostic> diagnostics) 38private protected override void CollectDiagnostics(ref PooledHashSet<RazorDiagnostic> diagnostics) 42var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidRestrictedChildNullOrWhitespace(_parent.GetDisplayName()); 52var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidRestrictedChild(_parent.GetDisplayName(), Name, character);
Language\BoundAttributeDescriptor.cs (4)
62ImmutableArray<RazorDiagnostic> diagnostics) 116public IEnumerable<RazorDiagnostic> GetAllDiagnostics() 120foreach (var diagnostic in parameter.Diagnostics) 126foreach (var diagnostic in Diagnostics)
Language\BoundAttributeDescriptorBuilder.cs (10)
153private protected override BoundAttributeDescriptor BuildCore(ImmutableArray<RazorDiagnostic> diagnostics) 196private protected override void CollectDiagnostics(ref PooledHashSet<RazorDiagnostic> diagnostics) 207var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidBoundAttributeNullOrWhitespace( 218var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidBoundAttributeNameStartsWith( 233var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidBoundDirectiveAttributeName( 245var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidBoundAttributeName( 260var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidBoundAttributePrefixStartsWith( 269var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidBoundAttributeNullOrWhitespace( 284var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidBoundDirectiveAttributePrefix( 296var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidBoundAttributePrefix(
Language\BoundAttributeParameterDescriptor.cs (1)
39ImmutableArray<RazorDiagnostic> diagnostics)
Language\BoundAttributeParameterDescriptorBuilder.cs (4)
67private protected override BoundAttributeParameterDescriptor BuildCore(ImmutableArray<RazorDiagnostic> diagnostics) 85private protected override void CollectDiagnostics(ref PooledHashSet<RazorDiagnostic> diagnostics) 89var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidBoundAttributeParameterNullOrWhitespace(_parent.Name); 99var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidBoundAttributeParameterName(
Language\CodeGeneration\CodeRenderingContext.cs (8)
25private readonly ImmutableArray<RazorDiagnostic>.Builder _diagnostics; 53_diagnostics = ArrayBuilderPool<RazorDiagnostic>.Default.Get(); 55foreach (var diagnostic in _documentNode.GetAllDiagnostics()) 71ArrayBuilderPool<RazorDiagnostic>.Default.Return(_diagnostics); 89public void AddDiagnostic(RazorDiagnostic diagnostic) 94public ImmutableArray<RazorDiagnostic> GetDiagnostics() 100using var filtered = new PooledArrayBuilder<RazorDiagnostic>(capacity: _diagnostics.Count); 101foreach (var diagnostic in _diagnostics)
Language\Components\ComponentDiagnosticFactory.cs (86)
23public static RazorDiagnostic Create_UnsupportedTagHelperDirective(SourceSpan? source) 24=> RazorDiagnostic.Create(UnsupportedTagHelperDirective, source); 33public static RazorDiagnostic Create_CodeBlockInAttribute(SourceSpan? source, string expression) 34=> RazorDiagnostic.Create(CodeBlockInAttribute, source, expression); 41public static RazorDiagnostic Create_UnclosedTag(SourceSpan? span, string tagName) 42=> RazorDiagnostic.Create(UnclosedTag, span, tagName); 49public static RazorDiagnostic Create_UnexpectedClosingTag(SourceSpan? span, string tagName) 50=> RazorDiagnostic.Create(UnexpectedClosingTag, span, tagName); 57public static RazorDiagnostic Create_UnexpectedClosingTagForVoidElement(SourceSpan? span, string tagName) 58=> RazorDiagnostic.Create(UnexpectedClosingTagForVoidElement, span, tagName); 65public static RazorDiagnostic Create_InvalidHtmlContent(SourceSpan? span, string text) 66=> RazorDiagnostic.Create(InvalidHtmlContent, span, text); 73public static RazorDiagnostic Create_MultipleComponents(SourceSpan? span, string tagName, IEnumerable<TagHelperDescriptor> components) 76return RazorDiagnostic.Create(MultipleComponents, span, tagName, componentNames); 86public static RazorDiagnostic Create_AmbiguousComponentSelection(SourceSpan? span, string tagName, TagHelperDescriptor genericComponent, TagHelperDescriptor nonGenericComponent) 89return RazorDiagnostic.Create(AmbiguousComponentSelection, span, tagName, componentNames); 97public static RazorDiagnostic Create_UnsupportedComplexContent(IntermediateNode node, string attributeName) 100return RazorDiagnostic.Create(UnsupportedComplexContent, node.Source, attributeName, content); 108public static RazorDiagnostic CreatePageDirective_CannotBeImported(SourceSpan source) 112return RazorDiagnostic.Create(PageDirective_CannotBeImported, source, "page", fileName); 120public static RazorDiagnostic CreatePageDirective_MustSpecifyRoute(SourceSpan? source) 121=> RazorDiagnostic.Create(PageDirective_MustSpecifyRoute, source); 128public static RazorDiagnostic CreateBindAttribute_Duplicates( 130=> RazorDiagnostic.Create( 141public static RazorDiagnostic CreateEventHandler_Duplicates(SourceSpan? source, string attribute, TagHelperDirectiveAttributeIntermediateNode[] attributes) 142=> RazorDiagnostic.Create( 154public static RazorDiagnostic CreateBindAttribute_InvalidSyntax(SourceSpan? source, string attribute) 155=> RazorDiagnostic.Create(BindAttribute_InvalidSyntax, source, attribute); 164public static RazorDiagnostic Create_DisallowedScriptTag(SourceSpan? source) 165=> RazorDiagnostic.Create(DisallowedScriptTag, source); 172public static RazorDiagnostic Create_TemplateInvalidLocation(SourceSpan? source) 173=> RazorDiagnostic.Create(TemplateInvalidLocation, source); 180public static RazorDiagnostic Create_ChildContentSetByAttributeAndBody(SourceSpan? source, string attribute) 181=> RazorDiagnostic.Create(ChildContentSetByAttributeAndBody, source, attribute); 189public static RazorDiagnostic Create_ChildContentMixedWithExplicitChildContent(SourceSpan? source, ComponentIntermediateNode component) 193return RazorDiagnostic.Create(ChildContentMixedWithExplicitChildContent, source, component.TagName, supportedElements); 201public static RazorDiagnostic Create_ChildContentHasInvalidAttribute(SourceSpan? source, string attribute, string element) 202=> RazorDiagnostic.Create(ChildContentHasInvalidAttribute, source, attribute, element); 209public static RazorDiagnostic Create_ChildContentHasInvalidParameter(SourceSpan? source, string attribute, string element) 210=> RazorDiagnostic.Create(ChildContentHasInvalidParameter, source, attribute, element); 218public static RazorDiagnostic Create_ChildContentRepeatedParameterName( 229return RazorDiagnostic.Create( 244public static RazorDiagnostic Create_GenericComponentMissingTypeArgument( 252return RazorDiagnostic.Create(GenericComponentMissingTypeArgument, source, component.TagName, attributesText); 261public static RazorDiagnostic Create_GenericComponentTypeInferenceUnderspecified( 269return RazorDiagnostic.Create(GenericComponentTypeInferenceUnderspecified, source, component.TagName, attributesText); 277public static RazorDiagnostic Create_ChildContentHasInvalidParameterOnComponent(SourceSpan? source, string attribute, string element) 278=> RazorDiagnostic.Create(ChildContentHasInvalidParameterOnComponent, source, attribute, element); 285public static RazorDiagnostic Create_UnsupportedComponentImportContent(SourceSpan? source) 286=> RazorDiagnostic.Create(UnsupportedComponentImportContent, source); 293public static RazorDiagnostic CreateBindAttributeParameter_MissingBind(SourceSpan? source, string attribute) 294=> RazorDiagnostic.Create( 304public static RazorDiagnostic Create_DuplicateMarkupAttribute(string attributeName, SourceSpan? source = null) 305=> RazorDiagnostic.Create(DuplicateMarkupAttribute, source, attributeName); 313public static RazorDiagnostic Create_DuplicateMarkupAttributeDirective(string attributeName, string directiveAttributeName, SourceSpan? source = null) 314=> RazorDiagnostic.Create(DuplicateMarkupAttributeDirective, source, attributeName, directiveAttributeName); 321public static RazorDiagnostic Create_DuplicateComponentParameter(string attributeName, SourceSpan? source = null) 322=> RazorDiagnostic.Create(DuplicateComponentParameter, source, attributeName); 330public static RazorDiagnostic Create_DuplicateComponentParameterDirective(string attributeName, string directiveAttributeName, SourceSpan? source = null) 331=> RazorDiagnostic.Create(DuplicateComponentParameterDirective, source, attributeName, directiveAttributeName); 338public static RazorDiagnostic Create_ComponentNamesCannotStartWithLowerCase(string componentName, SourceSpan? source = null) 339=> RazorDiagnostic.Create(ComponentNamesCannotStartWithLowerCase, source, componentName); 346public static RazorDiagnostic Create_UnexpectedMarkupElement(string elementName, SourceSpan? source = null) 347=> RazorDiagnostic.Create(UnexpectedMarkupElement, source, elementName); 354public static RazorDiagnostic Create_InconsistentStartAndEndTagName(string startTagName, string endTagName, SourceSpan? source = null) 355=> RazorDiagnostic.Create(InconsistentStartAndEndTagName, source, startTagName, endTagName); 362public static RazorDiagnostic CreateEventHandlerParameter_Duplicates(SourceSpan? source, string attribute, TagHelperDirectiveAttributeParameterIntermediateNode[] attributes) 363=> RazorDiagnostic.Create( 374public static RazorDiagnostic CreateBindAttributeParameter_UseBindGet(SourceSpan? source, string attribute) 375=> RazorDiagnostic.Create(BindAttributeParameter_UseBindGet, source, attribute); 383public static RazorDiagnostic CreateBindAttributeParameter_MissingBindGet(SourceSpan? source, string attribute) 384=> RazorDiagnostic.Create(BindAttributeParameter_MissingBindGet, source, attribute); 391public static RazorDiagnostic CreateBindAttribute_MissingBindSet(SourceSpan? source, string attributeGet, string attributeSet) 392=> RazorDiagnostic.Create(BindAttribute_MissingBindSet, source, attributeGet, attributeSet); 399public static RazorDiagnostic CreateBindAttributeParameter_InvalidSyntaxBindAndBindGet(SourceSpan? source, string attribute) 400=> RazorDiagnostic.Create(BindAttributeParameter_InvalidSyntaxBindAndBindGet, source, attribute); 407public static RazorDiagnostic CreateBindAttributeParameter_InvalidSyntaxBindSetAfter(SourceSpan? source, string attribute) 408=> RazorDiagnostic.Create(BindAttributeParameter_InvalidSyntaxBindSetAfter, source, attribute); 415public static RazorDiagnostic CreateBindAttributeParameter_UnsupportedSyntaxBindGetSet(SourceSpan? source, string attribute) 416=> RazorDiagnostic.Create(BindAttributeParameter_UnsupportedSyntaxBindGetSet, source, attribute); 425public static RazorDiagnostic CreateFormName_NotAForm(SourceSpan? source) 426=> RazorDiagnostic.Create(FormName_NotAForm, source); 433public static RazorDiagnostic CreateAttribute_ValidOnlyOnComponent(SourceSpan? source, string attribute) 434=> RazorDiagnostic.Create(Attribute_ValidOnlyOnComponent, source, attribute); 441public static RazorDiagnostic CreateRenderModeAttribute_ComponentDeclaredRenderMode(SourceSpan? source, string component) 443return RazorDiagnostic.Create(RenderModeAttribute_ComponentDeclaredRenderMode, source, component);
Language\Components\ComponentLoweringPass.cs (1)
133foreach (var diagnostic in node.Diagnostics)
Language\DefaultDirectiveSyntaxTreePass.cs (2)
37private ImmutableArray<RazorDiagnostic>.Builder? _diagnostics; 85var error = RazorDiagnosticFactory.CreateParsing_SectionsCannotBeNested(new SourceSpan(directiveStart, errorLength));
Language\DefaultRazorIntermediateNodeLoweringPhase.cs (3)
140foreach (var diagnostic in syntaxTree.Diagnostics) 147foreach (var diagnostic in import.Diagnostics) 2226private static bool IsMalformed(IEnumerable<RazorDiagnostic> diagnostics)
Language\DefaultTagHelperResolutionPhase.cs (2)
76using var descriptorDiagnostics = new PooledArrayBuilder<RazorDiagnostic>(); 82foreach (var diagnostic in descriptorDiagnostics)
Language\Extensions\DefaultTagHelperTargetExtension.cs (2)
549var diagnostic = RazorDiagnosticFactory.CreateTagHelper_CodeBlocksNotSupportedInAttributes(span); 555var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InlineMarkupBlocksNotSupportedInAttributes(span, expectedTypeName);
Language\Intermediate\IntermediateNode.cs (6)
14private ImmutableArray<RazorDiagnostic>.Builder? _diagnosticsBuilder; 15private ImmutableArray<RazorDiagnostic>? _diagnostics; 17public ImmutableArray<RazorDiagnostic> Diagnostics 30public void AddDiagnostic(RazorDiagnostic diagnostic) 32_diagnosticsBuilder ??= ImmutableArray.CreateBuilder<RazorDiagnostic>(); 41_diagnosticsBuilder ??= ImmutableArray.CreateBuilder<RazorDiagnostic>();
Language\Intermediate\IntermediateNodeExtensions.cs (3)
11public static ImmutableArray<RazorDiagnostic> GetAllDiagnostics(this IntermediateNode node) 15var diagnostics = new PooledHashSet<RazorDiagnostic>(); 27static void CollectDiagnostics(IntermediateNode node, ref PooledHashSet<RazorDiagnostic> diagnostics)
Language\Legacy\AddTagHelperChunkGenerator.cs (2)
21List<RazorDiagnostic> diagnostics) 38public List<RazorDiagnostic> Diagnostics { get; }
Language\Legacy\CSharpCodeParser.cs (6)
353var diagnostic = RazorDiagnosticFactory.CreateParsing_HelperDirectiveNotAvailable( 1223RazorDiagnostic? duplicateDiagnostic = null; 1312Func<string, List<RazorDiagnostic>, SourceLocation, ISpanChunkGenerator> chunkGeneratorFactory) 1398List<RazorDiagnostic> errors) 1453internal static ParsedDirective ParseAddOrRemoveDirective(ParsedDirective directive, SourceLocation directiveLocation, List<RazorDiagnostic> errors) 1508List<RazorDiagnostic> diagnostics)
Language\Legacy\ErrorSink.cs (8)
11/// Used to manage <see cref="RazorDiagnostic">RazorDiagnostics</see> encountered during the Razor parsing phase. 15private ImmutableArray<RazorDiagnostic>.Builder? _errors; 23ArrayBuilderPool<RazorDiagnostic>.Default.Return(errors); 28public ImmutableArray<RazorDiagnostic> GetErrorsAndClear() 37ArrayBuilderPool<RazorDiagnostic>.Default.Return(errors); 46/// <param name="error">The <see cref="RazorDiagnostic"/> to track.</param> 47public void OnError(RazorDiagnostic error) 49var errors = _errors ??= ArrayBuilderPool<RazorDiagnostic>.Default.Get();
Language\Legacy\HtmlLanguageCharacteristics.cs (1)
119protected override SyntaxToken CreateToken(string content, SyntaxKind kind, RazorDiagnostic[] errors)
Language\Legacy\HtmlMarkupParser.cs (1)
106return SyntaxFactory.RazorDocument(markup, SyntaxFactory.Token(SyntaxKind.EndOfFile, "", Array.Empty<RazorDiagnostic>()));
Language\Legacy\HtmlTokenizer.cs (1)
48protected override SyntaxToken CreateToken(string content, SyntaxKind type, RazorDiagnostic[] errors)
Language\Legacy\LanguageCharacteristics.cs (2)
90var left = CreateToken(token.Content.Substring(0, splitAt), leftType, Array.Empty<RazorDiagnostic>()); 108protected abstract SyntaxToken CreateToken(string content, SyntaxKind type, RazorDiagnostic[] errors);
Language\Legacy\NativeCSharpLanguageCharacteristics.cs (1)
81protected override SyntaxToken CreateToken(string content, SyntaxKind kind, RazorDiagnostic[] errors)
Language\Legacy\NativeCSharpTokenizer.cs (1)
356protected override SyntaxToken CreateToken(string content, SyntaxKind kind, RazorDiagnostic[] errors)
Language\Legacy\RemoveTagHelperChunkGenerator.cs (2)
21List<RazorDiagnostic> diagnostics) 38public List<RazorDiagnostic> Diagnostics { get; }
Language\Legacy\RoslynCSharpLanguageCharacteristics.cs (1)
73protected override SyntaxToken CreateToken(string content, SyntaxKind kind, RazorDiagnostic[] errors)
Language\Legacy\RoslynCSharpTokenizer.cs (1)
212protected override SyntaxToken CreateToken(string content, SyntaxKind kind, RazorDiagnostic[] errors)
Language\Legacy\TagHelperBlockRewriter.cs (4)
114var diagnostic = RazorDiagnosticFactory.CreateParsing_TagHelpersCannotHaveCSharpInTagDeclaration(location, tagName); 127var diagnostic = RazorDiagnosticFactory.CreateParsing_TagHelperAttributeListMustBeWellFormed(location); 192var diagnostic = RazorDiagnosticFactory.CreateTagHelper_EmptyBoundAttribute(errorLocation, result.AttributeName, tagName, propertyTypeName); 201var diagnostic = RazorDiagnosticFactory.CreateParsing_TagHelperIndexerAttributeNameMustIncludeKey(errorLocation, result.AttributeName, tagName);
Language\Legacy\TagHelperParseTreeRewriter.cs (1)
39using var builder = new PooledArrayBuilder<RazorDiagnostic>(capacity: treeDiagnostics.Length + sinkDiagnostics.Length);
Language\Legacy\TagHelperPrefixDirectiveChunkGenerator.cs (2)
16public TagHelperPrefixDirectiveChunkGenerator(string prefix, string directiveText, List<RazorDiagnostic> diagnostics) 27public List<RazorDiagnostic> Diagnostics { get; }
Language\Legacy\Tokenizer.cs (5)
23CurrentErrors = new List<RazorDiagnostic>(); 27protected List<RazorDiagnostic> CurrentErrors { get; } 66protected abstract SyntaxToken CreateToken(string content, SyntaxKind type, RazorDiagnostic[] errors); 220var errors = CurrentErrors.Count == 0 ? Array.Empty<RazorDiagnostic>() : new RazorDiagnostic[CurrentErrors.Count];
Language\Legacy\TokenizerBackedParser.cs (3)
384var diagnostic = RazorDiagnosticFactory.CreateParsing_RazorCommentNotTerminated( 394var diagnostic = RazorDiagnosticFactory.CreateParsing_RazorCommentNotTerminated( 535foreach (var error in token.GetDiagnostics())
Language\RazorCSharpDocument.cs (2)
15public ImmutableArray<RazorDiagnostic> Diagnostics { get; } 23ImmutableArray<RazorDiagnostic> diagnostics,
Language\RazorDiagnostic.cs (8)
10public sealed class RazorDiagnostic : IEquatable<RazorDiagnostic>, IFormattable 29public static RazorDiagnostic Create(RazorDiagnosticDescriptor descriptor) 32public static RazorDiagnostic Create(RazorDiagnosticDescriptor descriptor, SourceSpan? span) 35public static RazorDiagnostic Create(RazorDiagnosticDescriptor descriptor, params object[] args) 38public static RazorDiagnostic Create(RazorDiagnosticDescriptor descriptor, SourceSpan? span, params object[] args) 95=> obj is RazorDiagnostic diagnostic && 98public bool Equals(RazorDiagnostic? other) 113private static string Format(RazorDiagnostic diagnostic, IFormatProvider? formatProvider)
Language\RazorDiagnosticFactory.cs (160)
22public static RazorDiagnostic CreateDirective_BlockDirectiveCannotBeImported(string directive) 23=> RazorDiagnostic.Create(Directive_BlockDirectiveCannotBeImported, directive); 36public static RazorDiagnostic CreateParsing_UnterminatedStringLiteral(SourceSpan location) 37=> RazorDiagnostic.Create(Parsing_UnterminatedStringLiteral, location); 44public static RazorDiagnostic CreateParsing_BlockCommentNotTerminated(SourceSpan location) 45=> RazorDiagnostic.Create(Parsing_BlockCommentNotTerminated, location); 52public static RazorDiagnostic CreateParsing_HelperDirectiveNotAvailable(SourceSpan location) 53=> RazorDiagnostic.Create(Parsing_HelperDirectiveNotAvailable, location, SyntaxConstants.CSharp.HelperKeyword); 60public static RazorDiagnostic CreateParsing_UnexpectedWhiteSpaceAtStartOfCodeBlock(SourceSpan location) 61=> RazorDiagnostic.Create(Parsing_UnexpectedWhiteSpaceAtStartOfCodeBlock, location); 68public static RazorDiagnostic CreateParsing_UnexpectedEndOfFileAtStartOfCodeBlock(SourceSpan location) 69=> RazorDiagnostic.Create(Parsing_UnexpectedEndOfFileAtStartOfCodeBlock, location); 76public static RazorDiagnostic CreateParsing_UnexpectedCharacterAtStartOfCodeBlock(SourceSpan location, string content) 77=> RazorDiagnostic.Create(Parsing_UnexpectedCharacterAtStartOfCodeBlock, location, content); 84public static RazorDiagnostic CreateParsing_ExpectedEndOfBlockBeforeEOF(SourceSpan location, string blockName, string closeBlock, string openBlock) 85=> RazorDiagnostic.Create(Parsing_ExpectedEndOfBlockBeforeEOF, location, blockName, closeBlock, openBlock); 92public static RazorDiagnostic CreateParsing_ReservedWord(SourceSpan location, string content) 93=> RazorDiagnostic.Create(Parsing_ReservedWord, location, content); 100public static RazorDiagnostic CreateParsing_SingleLineControlFlowStatementsCannotContainMarkup(SourceSpan location) 101=> RazorDiagnostic.Create(Parsing_SingleLineControlFlowStatementsNotAllowed, location); 108public static RazorDiagnostic CreateParsing_AtInCodeMustBeFollowedByColonParenOrIdentifierStart(SourceSpan location) 109=> RazorDiagnostic.Create(Parsing_AtInCodeMustBeFollowedByColonParenOrIdentifierStart, location); 116public static RazorDiagnostic CreateParsing_UnexpectedNestedCodeBlock(SourceSpan location) 117=> RazorDiagnostic.Create(Parsing_UnexpectedNestedCodeBlock, location); 124public static RazorDiagnostic CreateParsing_DirectiveTokensMustBeSeparatedByWhitespace(SourceSpan location, string directiveName) 125=> RazorDiagnostic.Create(Parsing_DirectiveTokensMustBeSeparatedByWhitespace, location, directiveName); 132public static RazorDiagnostic CreateParsing_UnexpectedEOFAfterDirective(SourceSpan location, string directiveName, string expectedToken) 133=> RazorDiagnostic.Create(Parsing_UnexpectedEOFAfterDirective, location, directiveName, expectedToken); 140public static RazorDiagnostic CreateParsing_DirectiveExpectsTypeName(SourceSpan location, string directiveName) 141=> RazorDiagnostic.Create(Parsing_DirectiveExpectsTypeName, location, directiveName); 148public static RazorDiagnostic CreateParsing_DirectiveExpectsNamespace(SourceSpan location, string directiveName) 149=> RazorDiagnostic.Create(Parsing_DirectiveExpectsNamespace, location, directiveName); 156public static RazorDiagnostic CreateParsing_DirectiveExpectsIdentifier(SourceSpan location, string directiveName) 157=> RazorDiagnostic.Create(Parsing_DirectiveExpectsIdentifier, location, directiveName); 164public static RazorDiagnostic CreateParsing_DirectiveExpectsQuotedStringLiteral(SourceSpan location, string directiveName) 165=> RazorDiagnostic.Create(Parsing_DirectiveExpectsQuotedStringLiteral, location, directiveName); 172public static RazorDiagnostic CreateParsing_UnexpectedDirectiveLiteral(SourceSpan location, string directiveName, string expected) 173=> RazorDiagnostic.Create(Parsing_UnexpectedDirectiveLiteral, location, directiveName, expected); 180public static RazorDiagnostic CreateParsing_DirectiveMustHaveValue(SourceSpan location, string directiveName) 181=> RazorDiagnostic.Create(Parsing_DirectiveMustHaveValue, location, directiveName); 188public static RazorDiagnostic CreateParsing_IncompleteQuotesAroundDirective(SourceSpan location, string directiveName) 189=> RazorDiagnostic.Create(Parsing_IncompleteQuotesAroundDirective, location, directiveName); 196public static RazorDiagnostic CreateParsing_InvalidTagHelperPrefixValue(SourceSpan location, string directiveName, char character, string prefix) 197=> RazorDiagnostic.Create(Parsing_InvalidTagHelperPrefixValue, location, directiveName, character, prefix); 204public static RazorDiagnostic CreateParsing_MarkupBlockMustStartWithTag(SourceSpan location) 205=> RazorDiagnostic.Create(Parsing_MarkupBlockMustStartWithTag, location); 212public static RazorDiagnostic CreateParsing_OuterTagMissingName(SourceSpan location) 213=> RazorDiagnostic.Create(Parsing_OuterTagMissingName, location); 220public static RazorDiagnostic CreateParsing_TextTagCannotContainAttributes(SourceSpan location) 221=> RazorDiagnostic.Create(Parsing_TextTagCannotContainAttributes, location); 228public static RazorDiagnostic CreateParsing_UnfinishedTag(SourceSpan location, string tagName) 229=> RazorDiagnostic.Create(Parsing_UnfinishedTag, location, tagName); 236public static RazorDiagnostic CreateParsing_MissingEndTag(SourceSpan location, string tagName) 237=> RazorDiagnostic.Create(Parsing_MissingEndTag, location, tagName); 244public static RazorDiagnostic CreateParsing_UnexpectedEndTag(SourceSpan location, string tagName) 245=> RazorDiagnostic.Create(Parsing_UnexpectedEndTag, location, tagName); 252public static RazorDiagnostic CreateParsing_ExpectedCloseBracketBeforeEOF(SourceSpan location, string openBrace, string closeBrace) 253=> RazorDiagnostic.Create(Parsing_ExpectedCloseBracketBeforeEOF, location, openBrace, closeBrace); 260public static RazorDiagnostic CreateParsing_RazorCommentNotTerminated(SourceSpan location) 261=> RazorDiagnostic.Create(Parsing_RazorCommentNotTerminated, location); 268public static RazorDiagnostic CreateParsing_TagHelperIndexerAttributeNameMustIncludeKey(SourceSpan location, string attributeName, string tagName) 269=> RazorDiagnostic.Create(Parsing_TagHelperIndexerAttributeNameMustIncludeKey, location, attributeName, tagName); 276public static RazorDiagnostic CreateParsing_TagHelperAttributeListMustBeWellFormed(SourceSpan location) 277=> RazorDiagnostic.Create(Parsing_TagHelperAttributeListMustBeWellFormed, location); 284public static RazorDiagnostic CreateParsing_TagHelpersCannotHaveCSharpInTagDeclaration(SourceSpan location, string tagName) 285=> RazorDiagnostic.Create(Parsing_TagHelpersCannotHaveCSharpInTagDeclaration, location, tagName); 292public static RazorDiagnostic CreateParsing_TagHelperAttributesMustHaveAName(SourceSpan location, string tagName) 293=> RazorDiagnostic.Create(Parsing_TagHelperAttributesMustHaveAName, location, tagName); 300public static RazorDiagnostic CreateParsing_TagHelperMustNotHaveAnEndTag(SourceSpan location, string tagName, string displayName, TagStructure tagStructure) 301=> RazorDiagnostic.Create(Parsing_TagHelperMustNotHaveAnEndTag, location, tagName, displayName, tagStructure); 308public static RazorDiagnostic CreateParsing_TagHelperFoundMalformedTagHelper(SourceSpan location, string tagName) 309=> RazorDiagnostic.Create(Parsing_TagHelperFoundMalformedTagHelper, location, tagName); 316public static RazorDiagnostic CreateParsing_TagHelperMissingCloseAngle(SourceSpan location, string tagName) 317=> RazorDiagnostic.Create(Parsing_TagHelperMissingCloseAngle, location, tagName); 324public static RazorDiagnostic CreateParsing_InvalidTagHelperLookupText(SourceSpan location, string lookupText) 325=> RazorDiagnostic.Create(Parsing_InvalidTagHelperLookupText, location, lookupText); 332public static RazorDiagnostic CreateParsing_DirectiveExpectsCSharpAttribute(SourceSpan location, string directiveName) 333=> RazorDiagnostic.Create(Parsing_DirectiveExpectsCSharpAttribute, location, directiveName); 340public static RazorDiagnostic CreateParsing_DirectiveExpectsBooleanLiteral(SourceSpan location, string directiveName) 341=> RazorDiagnostic.Create(Parsing_DirectiveExpectsBooleanLiteral, location, directiveName); 348public static RazorDiagnostic CreateParsing_GenericTypeParameterIdentifierMismatch(SourceSpan location, string directiveName, string constraintIdentifier, string originalMember) 349=> RazorDiagnostic.Create(Parsing_GenericTypeParameterIdentifierMismatch, location, directiveName, constraintIdentifier, originalMember); 356public static RazorDiagnostic CreateParsing_UnexpectedIdentifier(SourceSpan location, string content, params string[] options) 357=> RazorDiagnostic.Create(Parsing_UnexpectedIdentifier, location, content, string.Join(", ", options)); 364public static RazorDiagnostic CreateParsing_DirectiveExpectsIdentifierOrExpression(SourceSpan location, string directiveName) 365=> RazorDiagnostic.Create(Parsing_DirectiveExpectsIdentifierOrExpression, location, directiveName); 372public static RazorDiagnostic CreateParsing_VoidElement(SourceSpan location, string tagName) 373=> RazorDiagnostic.Create(Parsing_VoidElement, location, tagName); 380public static RazorDiagnostic CreateParsing_PreprocessorDirectivesMustBeAtTheStartOfLine(SourceSpan location) 381=> RazorDiagnostic.Create(Parsing_PreprocessorDirectivesMustBeAtTheStartOfLine, location); 388public static RazorDiagnostic CreateParsing_PossibleMisplacedPreprocessorDirective(SourceSpan location) 389=> RazorDiagnostic.Create(Parsing_PossibleMisplacedPreprocessorDirective, location); 396public static RazorDiagnostic CreateParsing_DefineAndUndefNotAllowed(SourceSpan location) 397=> RazorDiagnostic.Create(Parsing_DefineAndUndefNotAllowed, location); 410public static RazorDiagnostic CreateCodeTarget_UnsupportedExtension(string documentKind, Type extensionType) 411=> RazorDiagnostic.Create(CodeTarget_UnsupportedExtension, documentKind, extensionType.Name); 418public static RazorDiagnostic CreateParsing_DuplicateDirective(SourceSpan location, string directive) 419=> RazorDiagnostic.Create(Parsing_DuplicateDirective, location, directive); 426public static RazorDiagnostic CreateParsing_SectionsCannotBeNested(SourceSpan location) 427=> RazorDiagnostic.Create(Parsing_SectionsCannotBeNested, location, Resources.SectionExample); 434public static RazorDiagnostic CreateParsing_InlineMarkupBlocksCannotBeNested(SourceSpan location) 435=> RazorDiagnostic.Create(Parsing_InlineMarkupBlocksCannotBeNested, location); 442public static RazorDiagnostic CreateParsing_NamespaceImportAndTypeAliasCannotExistWithinCodeBlock(SourceSpan location) 443=> RazorDiagnostic.Create(Parsing_NamespaceImportAndTypeAliasCannotExistWithinCodeBlock, location); 450public static RazorDiagnostic CreateParsing_DirectiveMustAppearAtStartOfLine(SourceSpan location, string directiveName) 451=> RazorDiagnostic.Create(Parsing_DirectiveMustAppearAtStartOfLine, location, directiveName); 458public static RazorDiagnostic CreateTagHelper_CodeBlocksNotSupportedInAttributes(SourceSpan? location) 459=> RazorDiagnostic.Create(TagHelper_CodeBlocksNotSupportedInAttributes, location); 466public static RazorDiagnostic CreateTagHelper_InlineMarkupBlocksNotSupportedInAttributes(SourceSpan? location, string expectedTypeName) 467=> RazorDiagnostic.Create(TagHelper_InlineMarkupBlocksNotSupportedInAttributes, location, expectedTypeName); 474public static RazorDiagnostic CreateTagHelper_EmptyBoundAttribute(SourceSpan location, string attributeName, string tagName, string propertyTypeName) 475=> RazorDiagnostic.Create(TagHelper_EmptyBoundAttribute, location, attributeName, tagName, propertyTypeName); 482public static RazorDiagnostic CreateTagHelper_CannotHaveNonTagContent(SourceSpan location, string tagName, string allowedChildren) 483=> RazorDiagnostic.Create(TagHelper_CannotHaveNonTagContent, location, tagName, allowedChildren); 490public static RazorDiagnostic CreateTagHelper_InvalidNestedTag(SourceSpan location, string tagName, string parent, string allowedChildren) 491=> RazorDiagnostic.Create(TagHelper_InvalidNestedTag, location, tagName, parent, allowedChildren); 498public static RazorDiagnostic CreateTagHelper_InconsistentTagStructure(SourceSpan location, string firstDescriptor, string secondDescriptor, string tagName) 499=> RazorDiagnostic.Create( 512public static RazorDiagnostic CreateComponent_EditorRequiredParameterNotSpecified(SourceSpan? location, string tagName, string parameterName) 513=> RazorDiagnostic.Create(Component_EditorRequiredParameterNotSpecified, location, tagName, parameterName); 526public static RazorDiagnostic CreateTagHelper_InvalidRestrictedChildNullOrWhitespace(string tagHelperDisplayName) 527=> RazorDiagnostic.Create(TagHelper_InvalidRestrictedChildNullOrWhitespace, tagHelperDisplayName); 534public static RazorDiagnostic CreateTagHelper_InvalidRestrictedChild(string tagHelperDisplayName, string restrictedChild, char invalidCharacter) 535=> RazorDiagnostic.Create(TagHelper_InvalidRestrictedChild, tagHelperDisplayName, restrictedChild, invalidCharacter); 542public static RazorDiagnostic CreateTagHelper_InvalidBoundAttributeNullOrWhitespace(string tagHelperDisplayName, string propertyDisplayName) 543=> RazorDiagnostic.Create(TagHelper_InvalidBoundAttributeNullOrWhitespace, tagHelperDisplayName, propertyDisplayName); 550public static RazorDiagnostic CreateTagHelper_InvalidBoundAttributeName(string tagHelperDisplayName, string propertyDisplayName, string invalidName, char invalidCharacter) 551=> RazorDiagnostic.Create(TagHelper_InvalidBoundAttributeName, tagHelperDisplayName, propertyDisplayName, invalidName, invalidCharacter); 558public static RazorDiagnostic CreateTagHelper_InvalidBoundAttributeNameStartsWith(string tagHelperDisplayName, string propertyDisplayName, string invalidName) 559=> RazorDiagnostic.Create(TagHelper_InvalidBoundAttributeNameStartsWith, tagHelperDisplayName, propertyDisplayName, invalidName, "data-"); 566public static RazorDiagnostic CreateTagHelper_InvalidBoundAttributePrefix(string tagHelperDisplayName, string propertyDisplayName, string invalidName, char invalidCharacter) 567=> RazorDiagnostic.Create(TagHelper_InvalidBoundAttributePrefix, tagHelperDisplayName, propertyDisplayName, invalidName, invalidCharacter); 573public static RazorDiagnostic CreateTagHelper_InvalidBoundAttributePrefixStartsWith(string tagHelperDisplayName, string propertyDisplayName, string invalidName) 574=> RazorDiagnostic.Create(TagHelper_InvalidBoundAttributePrefixStartsWith, tagHelperDisplayName, propertyDisplayName, invalidName, "data-"); 581public static RazorDiagnostic CreateTagHelper_InvalidTargetedTagNameNullOrWhitespace() 582=> RazorDiagnostic.Create(TagHelper_InvalidTargetedTagNameNullOrWhitespace); 589public static RazorDiagnostic CreateTagHelper_InvalidTargetedTagName(string invalidTagName, char invalidCharacter) 590=> RazorDiagnostic.Create(TagHelper_InvalidTargetedTagName, invalidTagName, invalidCharacter); 597public static RazorDiagnostic CreateTagHelper_InvalidTargetedParentTagNameNullOrWhitespace() 598=> RazorDiagnostic.Create(TagHelper_InvalidTargetedParentTagNameNullOrWhitespace); 605public static RazorDiagnostic CreateTagHelper_InvalidTargetedParentTagName(string invalidTagName, char invalidCharacter) 606=> RazorDiagnostic.Create(TagHelper_InvalidTargetedParentTagName, invalidTagName, invalidCharacter); 613public static RazorDiagnostic CreateTagHelper_InvalidTargetedAttributeNameNullOrWhitespace() 614=> RazorDiagnostic.Create(TagHelper_InvalidTargetedAttributeNameNullOrWhitespace); 621public static RazorDiagnostic CreateTagHelper_InvalidTargetedAttributeName(string invalidAttributeName, char invalidCharacter) 622=> RazorDiagnostic.Create(TagHelper_InvalidTargetedAttributeName, invalidAttributeName, invalidCharacter); 629public static RazorDiagnostic CreateTagHelper_InvalidBoundAttributeParameterNullOrWhitespace(string attributeName) 630=> RazorDiagnostic.Create(TagHelper_InvalidBoundAttributeParameterNullOrWhitespace, attributeName); 637public static RazorDiagnostic CreateTagHelper_InvalidBoundAttributeParameterName(string attributeName, string invalidName, char invalidCharacter) 638=> RazorDiagnostic.Create(TagHelper_InvalidBoundAttributeParameterName, attributeName, invalidName, invalidCharacter); 645public static RazorDiagnostic CreateTagHelper_InvalidBoundDirectiveAttributeName(string tagHelperDisplayName, string propertyDisplayName, string invalidName) 646=> RazorDiagnostic.Create(TagHelper_InvalidBoundDirectiveAttributeName, tagHelperDisplayName, propertyDisplayName, invalidName); 653public static RazorDiagnostic CreateTagHelper_InvalidRequiredDirectiveAttributeName(string propertyDisplayName, string invalidName) 654=> RazorDiagnostic.Create(TagHelper_InvalidRequiredDirectiveAttributeName, propertyDisplayName, invalidName); 661public static RazorDiagnostic CreateTagHelper_InvalidBoundDirectiveAttributePrefix(string tagHelperDisplayName, string propertyDisplayName, string invalidName) 662=> RazorDiagnostic.Create(TagHelper_InvalidBoundDirectiveAttributePrefix, tagHelperDisplayName, propertyDisplayName, invalidName); 675public static RazorDiagnostic CreateRewriter_InsufficientStack(SourceSpan? location = null) 676=> RazorDiagnostic.Create(Rewriter_InsufficientStack, location); 689public static RazorDiagnostic CreateCssRewriting_ImportNotAllowed(SourceSpan location) 690=> RazorDiagnostic.Create(CssRewriting_ImportNotAllowed, location);
Language\RazorSyntaxTree.cs (10)
18private readonly ImmutableArray<RazorDiagnostic> _diagnostics; 19private ImmutableArray<RazorDiagnostic> _allDiagnostics; 24ImmutableArray<RazorDiagnostic> diagnostics, 37public ImmutableArray<RazorDiagnostic> Diagnostics 48static ImmutableArray<RazorDiagnostic> ComputeAllDiagnostics(ImmutableArray<RazorDiagnostic> treeDiagnostics, SyntaxNode root) 50using var pooledList = ListPool<RazorDiagnostic>.GetPooledObject(out var rootDiagnostics); 51using var diagnosticSet = new PooledHashSet<RazorDiagnostic>(); 53foreach (var diagnostic in treeDiagnostics) 62foreach (var diagnostic in rootDiagnostics)
Language\RequiredAttributeDescriptor.cs (1)
33ImmutableArray<RazorDiagnostic> diagnostics)
Language\RequiredAttributeDescriptorBuilder.cs (5)
40private protected override RequiredAttributeDescriptor BuildCore(ImmutableArray<RazorDiagnostic> diagnostics) 58private protected override void CollectDiagnostics(ref PooledHashSet<RazorDiagnostic> diagnostics) 64var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidTargetedAttributeNameNullOrWhitespace(); 81var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidRequiredDirectiveAttributeName( 92var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidTargetedAttributeName(name, ch);
Language\Syntax\Generated\Syntax.xml.Internal.Generated.cs (90)
11internal RazorBlockSyntax(SyntaxKind kind, RazorDiagnostic[] diagnostics) 29internal RazorDocumentSyntax(SyntaxKind kind, RazorBlockSyntax document, SyntaxToken endOfFile, RazorDiagnostic[] diagnostics) 79internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 91internal RazorCommentBlockSyntax(SyntaxKind kind, SyntaxToken startCommentTransition, SyntaxToken startCommentStar, SyntaxToken comment, SyntaxToken endCommentStar, SyntaxToken endCommentTransition, RazorDiagnostic[] diagnostics) 159internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 169internal RazorMetaCodeSyntax(SyntaxKind kind, GreenNode metaCode, ISpanChunkGenerator chunkGenerator, SpanEditHandler editHandler, RazorDiagnostic[] diagnostics) 221internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 229internal GenericBlockSyntax(SyntaxKind kind, GreenNode children, RazorDiagnostic[] diagnostics) 275internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 285internal UnclassifiedTextLiteralSyntax(SyntaxKind kind, GreenNode literalTokens, ISpanChunkGenerator chunkGenerator, SpanEditHandler editHandler, RazorDiagnostic[] diagnostics) 337internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 343internal MarkupSyntaxNode(SyntaxKind kind, RazorDiagnostic[] diagnostics) 358internal MarkupBlockSyntax(SyntaxKind kind, GreenNode children, RazorDiagnostic[] diagnostics) 404internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 414internal MarkupTransitionSyntax(SyntaxKind kind, GreenNode transitionTokens, ISpanChunkGenerator chunkGenerator, SpanEditHandler editHandler, RazorDiagnostic[] diagnostics) 466internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 476internal MarkupTextLiteralSyntax(SyntaxKind kind, GreenNode literalTokens, ISpanChunkGenerator chunkGenerator, SpanEditHandler editHandler, RazorDiagnostic[] diagnostics) 528internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 538internal MarkupEphemeralTextLiteralSyntax(SyntaxKind kind, GreenNode literalTokens, ISpanChunkGenerator chunkGenerator, SpanEditHandler editHandler, RazorDiagnostic[] diagnostics) 590internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 598internal MarkupCommentBlockSyntax(SyntaxKind kind, GreenNode children, RazorDiagnostic[] diagnostics) 644internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 653internal MarkupMinimizedAttributeBlockSyntax(SyntaxKind kind, MarkupTextLiteralSyntax namePrefix, MarkupTextLiteralSyntax name, RazorDiagnostic[] diagnostics) 709internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 723internal MarkupAttributeBlockSyntax(SyntaxKind kind, MarkupTextLiteralSyntax namePrefix, MarkupTextLiteralSyntax name, MarkupTextLiteralSyntax nameSuffix, SyntaxToken equalsToken, MarkupTextLiteralSyntax valuePrefix, RazorBlockSyntax value, MarkupTextLiteralSyntax valueSuffix, RazorDiagnostic[] diagnostics) 833internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 841internal MarkupMiscAttributeContentSyntax(SyntaxKind kind, GreenNode children, RazorDiagnostic[] diagnostics) 887internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 896internal MarkupLiteralAttributeValueSyntax(SyntaxKind kind, MarkupTextLiteralSyntax prefix, MarkupTextLiteralSyntax value, RazorDiagnostic[] diagnostics) 958internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 967internal MarkupDynamicAttributeValueSyntax(SyntaxKind kind, MarkupTextLiteralSyntax prefix, RazorBlockSyntax value, RazorDiagnostic[] diagnostics) 1023internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 1029internal BaseMarkupStartTagSyntax(SyntaxKind kind, RazorDiagnostic[] diagnostics) 1058internal BaseMarkupEndTagSyntax(SyntaxKind kind, RazorDiagnostic[] diagnostics) 1087internal BaseMarkupElementSyntax(SyntaxKind kind, RazorDiagnostic[] diagnostics) 1108internal MarkupElementSyntax(SyntaxKind kind, MarkupStartTagSyntax markupStartTag, GreenNode body, MarkupEndTagSyntax markupEndTag, RazorDiagnostic[] diagnostics) 1182internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 1198internal MarkupStartTagSyntax(SyntaxKind kind, SyntaxToken openAngle, SyntaxToken bang, SyntaxToken name, GreenNode attributes, SyntaxToken forwardSlash, SyntaxToken closeAngle, bool isMarkupTransition, ISpanChunkGenerator chunkGenerator, SpanEditHandler editHandler, RazorDiagnostic[] diagnostics) 1299internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 1315internal MarkupEndTagSyntax(SyntaxKind kind, SyntaxToken openAngle, SyntaxToken forwardSlash, SyntaxToken bang, SyntaxToken name, MarkupMiscAttributeContentSyntax miscAttributeContent, SyntaxToken closeAngle, bool isMarkupTransition, ISpanChunkGenerator chunkGenerator, SpanEditHandler editHandler, RazorDiagnostic[] diagnostics) 1410internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 1421internal MarkupTagHelperElementSyntax(SyntaxKind kind, MarkupTagHelperStartTagSyntax tagHelperStartTag, GreenNode body, MarkupTagHelperEndTagSyntax tagHelperEndTag, TagHelperInfo tagHelperInfo, RazorDiagnostic[] diagnostics) 1498internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 1513internal MarkupTagHelperStartTagSyntax(SyntaxKind kind, SyntaxToken openAngle, SyntaxToken bang, SyntaxToken name, GreenNode attributes, SyntaxToken forwardSlash, SyntaxToken closeAngle, ISpanChunkGenerator chunkGenerator, SpanEditHandler editHandler, RazorDiagnostic[] diagnostics) 1611internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 1626internal MarkupTagHelperEndTagSyntax(SyntaxKind kind, SyntaxToken openAngle, SyntaxToken forwardSlash, SyntaxToken bang, SyntaxToken name, MarkupMiscAttributeContentSyntax miscAttributeContent, SyntaxToken closeAngle, ISpanChunkGenerator chunkGenerator, SpanEditHandler editHandler, RazorDiagnostic[] diagnostics) 1718internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 1733internal MarkupTagHelperAttributeSyntax(SyntaxKind kind, MarkupTextLiteralSyntax namePrefix, MarkupTextLiteralSyntax name, MarkupTextLiteralSyntax nameSuffix, SyntaxToken equalsToken, MarkupTextLiteralSyntax valuePrefix, MarkupTagHelperAttributeValueSyntax value, MarkupTextLiteralSyntax valueSuffix, TagHelperAttributeInfo tagHelperAttributeInfo, RazorDiagnostic[] diagnostics) 1840internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 1850internal MarkupMinimizedTagHelperAttributeSyntax(SyntaxKind kind, MarkupTextLiteralSyntax namePrefix, MarkupTextLiteralSyntax name, TagHelperAttributeInfo tagHelperAttributeInfo, RazorDiagnostic[] diagnostics) 1909internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 1917internal MarkupTagHelperAttributeValueSyntax(SyntaxKind kind, GreenNode children, RazorDiagnostic[] diagnostics) 1963internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 1981internal MarkupTagHelperDirectiveAttributeSyntax(SyntaxKind kind, MarkupTextLiteralSyntax namePrefix, RazorMetaCodeSyntax transition, MarkupTextLiteralSyntax name, RazorMetaCodeSyntax colon, MarkupTextLiteralSyntax parameterName, MarkupTextLiteralSyntax nameSuffix, SyntaxToken equalsToken, MarkupTextLiteralSyntax valuePrefix, MarkupTagHelperAttributeValueSyntax value, MarkupTextLiteralSyntax valueSuffix, TagHelperAttributeInfo tagHelperAttributeInfo, RazorDiagnostic[] diagnostics) 2118internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 2131internal MarkupMinimizedTagHelperDirectiveAttributeSyntax(SyntaxKind kind, MarkupTextLiteralSyntax namePrefix, RazorMetaCodeSyntax transition, MarkupTextLiteralSyntax name, RazorMetaCodeSyntax colon, MarkupTextLiteralSyntax parameterName, TagHelperAttributeInfo tagHelperAttributeInfo, RazorDiagnostic[] diagnostics) 2220internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 2226internal CSharpSyntaxNode(SyntaxKind kind, RazorDiagnostic[] diagnostics) 2241internal CSharpCodeBlockSyntax(SyntaxKind kind, GreenNode children, RazorDiagnostic[] diagnostics) 2287internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 2297internal CSharpTransitionSyntax(SyntaxKind kind, SyntaxToken transition, ISpanChunkGenerator chunkGenerator, SpanEditHandler editHandler, RazorDiagnostic[] diagnostics) 2343internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 2353internal CSharpStatementLiteralSyntax(SyntaxKind kind, GreenNode literalTokens, ISpanChunkGenerator chunkGenerator, SpanEditHandler editHandler, RazorDiagnostic[] diagnostics) 2405internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 2415internal CSharpExpressionLiteralSyntax(SyntaxKind kind, GreenNode literalTokens, ISpanChunkGenerator chunkGenerator, SpanEditHandler editHandler, RazorDiagnostic[] diagnostics) 2467internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 2477internal CSharpEphemeralTextLiteralSyntax(SyntaxKind kind, GreenNode literalTokens, ISpanChunkGenerator chunkGenerator, SpanEditHandler editHandler, RazorDiagnostic[] diagnostics) 2529internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 2537internal CSharpTemplateBlockSyntax(SyntaxKind kind, GreenNode children, RazorDiagnostic[] diagnostics) 2583internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 2589internal CSharpRazorBlockSyntax(SyntaxKind kind, RazorDiagnostic[] diagnostics) 2609internal CSharpStatementSyntax(SyntaxKind kind, CSharpTransitionSyntax transition, CSharpSyntaxNode body, RazorDiagnostic[] diagnostics) 2659internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 2669internal CSharpStatementBodySyntax(SyntaxKind kind, RazorMetaCodeSyntax openBrace, CSharpCodeBlockSyntax csharpCode, RazorMetaCodeSyntax closeBrace, RazorDiagnostic[] diagnostics) 2725internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 2734internal CSharpExplicitExpressionSyntax(SyntaxKind kind, CSharpTransitionSyntax transition, CSharpSyntaxNode body, RazorDiagnostic[] diagnostics) 2784internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 2794internal CSharpExplicitExpressionBodySyntax(SyntaxKind kind, RazorMetaCodeSyntax openParen, CSharpCodeBlockSyntax csharpCode, RazorMetaCodeSyntax closeParen, RazorDiagnostic[] diagnostics) 2850internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 2859internal CSharpImplicitExpressionSyntax(SyntaxKind kind, CSharpTransitionSyntax transition, CSharpSyntaxNode body, RazorDiagnostic[] diagnostics) 2909internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 2917internal CSharpImplicitExpressionBodySyntax(SyntaxKind kind, CSharpCodeBlockSyntax csharpCode, RazorDiagnostic[] diagnostics) 2957internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 2963internal BaseRazorDirectiveSyntax(SyntaxKind kind, RazorDiagnostic[] diagnostics) 2980internal RazorDirectiveSyntax(SyntaxKind kind, CSharpTransitionSyntax transition, CSharpSyntaxNode body, DirectiveDescriptor directiveDescriptor, RazorDiagnostic[] diagnostics) 3033internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 3043internal RazorUsingDirectiveSyntax(SyntaxKind kind, CSharpTransitionSyntax transition, CSharpSyntaxNode body, DirectiveDescriptor directiveDescriptor, RazorDiagnostic[] diagnostics) 3096internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) 3105internal RazorDirectiveBodySyntax(SyntaxKind kind, RazorSyntaxNode keyword, CSharpCodeBlockSyntax csharpCode, RazorDiagnostic[] diagnostics) 3161internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics)
Language\Syntax\GreenNode.cs (6)
14private static readonly ConditionalWeakTable<GreenNode, RazorDiagnostic[]> s_diagnosticsTable = new(); 15private static readonly RazorDiagnostic[] s_emptyDiagnostics = []; 31protected GreenNode(SyntaxKind kind, RazorDiagnostic[]? diagnostics) 36protected GreenNode(SyntaxKind kind, int width, RazorDiagnostic[]? diagnostics) 161internal abstract GreenNode SetDiagnostics(RazorDiagnostic[]? diagnostics); 163internal RazorDiagnostic[] GetDiagnostics()
Language\Syntax\GreenNodeExtensions.cs (2)
25public static TNode WithDiagnosticsGreen<TNode>(this TNode node, RazorDiagnostic[] diagnostics) 31public static TNode WithDiagnosticsGreen<TNode>(this TNode node, params ImmutableArray<RazorDiagnostic> diagnostics)
Language\Syntax\InternalSyntax\RazorSyntaxNode.cs (2)
19protected RazorSyntaxNode(SyntaxKind kind, RazorDiagnostic[] diagnostics) 24protected RazorSyntaxNode(SyntaxKind kind, int width, RazorDiagnostic[] diagnostics)
Language\Syntax\InternalSyntax\SyntaxFactory.cs (2)
10internal static SyntaxToken Token(SyntaxKind kind, string content, params RazorDiagnostic[] diagnostics) 20internal static SyntaxToken MissingToken(SyntaxKind kind, params RazorDiagnostic[] diagnostics)
Language\Syntax\InternalSyntax\SyntaxList.cs (10)
18internal SyntaxList(RazorDiagnostic[] diagnostics) 187internal WithTwoChildren(GreenNode child0, GreenNode child1, RazorDiagnostic[] diagnostics) 221internal override GreenNode SetDiagnostics(RazorDiagnostic[] errors) 244internal WithThreeChildren(GreenNode child0, GreenNode child1, GreenNode child2, RazorDiagnostic[] diagnostics) 283internal override GreenNode SetDiagnostics(RazorDiagnostic[] errors) 299internal WithManyChildrenBase(ArrayElement<GreenNode>[] children, RazorDiagnostic[] diagnostics) 352internal WithManyChildren(ArrayElement<GreenNode>[] children, RazorDiagnostic[] diagnostics) 357internal override GreenNode SetDiagnostics(RazorDiagnostic[] errors) 373internal WithLotsOfChildren(ArrayElement<GreenNode>[] children, int[] childOffsets, RazorDiagnostic[] diagnostics) 412internal override GreenNode SetDiagnostics(RazorDiagnostic[] errors)
Language\Syntax\InternalSyntax\SyntaxToken.cs (4)
13RazorDiagnostic[]? diagnostics) 28internal override GreenNode SetDiagnostics(RazorDiagnostic[]? diagnostics) 70internal static SyntaxToken CreateMissing(SyntaxKind kind, params RazorDiagnostic[] diagnostics) 77internal MissingToken(SyntaxKind kind, RazorDiagnostic[] diagnostics)
Language\Syntax\InternalSyntax\SyntaxTokenCache.cs (1)
18public bool CanBeCached(SyntaxKind kind, params RazorDiagnostic[] diagnostics)
Language\Syntax\SyntaxFactory.cs (7)
12public static SyntaxToken Token(SyntaxKind kind, params RazorDiagnostic[] diagnostics) 15public static SyntaxToken Token(SyntaxKind kind, string content, params RazorDiagnostic[] diagnostics) 19SyntaxKind kind, SyntaxNode? parent, int position, params RazorDiagnostic[] diagnostics) 23SyntaxKind kind, string content, SyntaxNode? parent, int position, params RazorDiagnostic[] diagnostics) 27SyntaxKind kind, SyntaxNode? parent, int position, int index, params RazorDiagnostic[] diagnostics) 31SyntaxKind kind, string content, SyntaxNode? parent, int position, int index, params RazorDiagnostic[] diagnostics) 34internal static SyntaxToken MissingToken(SyntaxKind kind, params RazorDiagnostic[] diagnostics)
Language\Syntax\SyntaxNode.cs (1)
390public RazorDiagnostic[] GetDiagnostics()
Language\Syntax\SyntaxNodeExtensions.cs (7)
15public static TNode WithDiagnostics<TNode>(this TNode node, params RazorDiagnostic[] diagnostics) where TNode : SyntaxNode 20public static TNode AppendDiagnostic<TNode>(this TNode node, params ReadOnlySpan<RazorDiagnostic> diagnostics) where TNode : SyntaxNode 22RazorDiagnostic[] allDiagnostics = [ 35/// <returns>The list of <see cref="RazorDiagnostic">RazorDiagnostics</see>.</returns> 36public static void CollectAllDiagnostics<TNode>(this TNode node, List<RazorDiagnostic> list) 264private sealed class DiagnosticSyntaxWalker(List<RazorDiagnostic> diagnostics) : SyntaxWalker 266private readonly List<RazorDiagnostic> _diagnostics = diagnostics ?? [];
Language\Syntax\SyntaxNodeOrToken.cs (2)
258public IEnumerable<RazorDiagnostic> GetDiagnostics() 270return SpecializedCollections.EmptyEnumerable<RazorDiagnostic>();
Language\Syntax\SyntaxSerializer.cs (1)
163private static string GetDiagnosticsText(RazorDiagnostic[] diagnostics)
Language\Syntax\SyntaxToken.cs (3)
183public IEnumerable<RazorDiagnostic> GetDiagnostics() 187return SpecializedCollections.EmptyEnumerable<RazorDiagnostic>(); 193? SpecializedCollections.EmptyEnumerable<RazorDiagnostic>()
Language\TagHelperDescriptor.cs (5)
69ImmutableArray<RazorDiagnostic> diagnostics) 166public IEnumerable<RazorDiagnostic> GetAllDiagnostics() 168using var diagnostics = new PooledArrayBuilder<RazorDiagnostic>(); 172foreach (var diagnostic in diagnostics) 178internal void AppendAllDiagnostics(ref PooledArrayBuilder<RazorDiagnostic> diagnostics)
Language\TagHelperDescriptorBuilder.cs (1)
156private protected override TagHelperDescriptor BuildCore(ImmutableArray<RazorDiagnostic> diagnostics)
Language\TagHelperObject`1.cs (3)
16public ImmutableArray<RazorDiagnostic> Diagnostics { get; } 21private protected TagHelperObject(ImmutableArray<RazorDiagnostic> diagnostics) 36foreach (var diagnostic in Diagnostics)
Language\TagHelperObjectBuilder`1.cs (6)
13private ImmutableArray<RazorDiagnostic>.Builder? _diagnostics; 16public ImmutableArray<RazorDiagnostic>.Builder Diagnostics 17=> _diagnostics ??= ImmutableArray.CreateBuilder<RazorDiagnostic>(); 32var diagnostics = new PooledHashSet<RazorDiagnostic>(); 46private protected abstract T BuildCore(ImmutableArray<RazorDiagnostic> diagnostics); 48private protected virtual void CollectDiagnostics(ref PooledHashSet<RazorDiagnostic> diagnostics)
Language\TagMatchingRuleDescriptor.cs (4)
30ImmutableArray<RazorDiagnostic> diagnostics) 70public IEnumerable<RazorDiagnostic> GetAllDiagnostics() 74foreach (var diagnostic in attribute.Diagnostics) 80foreach (var diagnostic in Diagnostics)
Language\TagMatchingRuleDescriptorBuilder.cs (6)
46private protected override TagMatchingRuleDescriptor BuildCore(ImmutableArray<RazorDiagnostic> diagnostics) 57private protected override void CollectDiagnostics(ref PooledHashSet<RazorDiagnostic> diagnostics) 61var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidTargetedTagNameNullOrWhitespace(); 71var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidTargetedTagName(TagName, character); 82var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidTargetedParentTagNameNullOrWhitespace(); 92var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidTargetedParentTagName(ParentTag, character);
Mvc.Version1_X\ViewComponentTagHelperDescriptorFactory.cs (2)
69if (TryFindInvokeMethod(type, out var method, out var diagnostic)) 89private bool TryFindInvokeMethod(INamedTypeSymbol type, out IMethodSymbol method, out RazorDiagnostic diagnostic)
Mvc.Version2_X\ViewComponentTagHelperDescriptorFactory.cs (2)
69if (TryFindInvokeMethod(type, out var method, out var diagnostic)) 89private bool TryFindInvokeMethod(INamedTypeSymbol type, out IMethodSymbol method, out RazorDiagnostic diagnostic)
Mvc\RazorExtensionsDiagnosticFactory.cs (14)
19public static RazorDiagnostic CreateViewComponent_CannotFindMethod(string tagHelperType) 20=> RazorDiagnostic.Create( 32public static RazorDiagnostic CreateViewComponent_AmbiguousMethods(string tagHelperType) 33=> RazorDiagnostic.Create( 45public static RazorDiagnostic CreateViewComponent_AsyncMethod_ShouldReturnTask(string tagHelperType) 46=> RazorDiagnostic.Create( 58public static RazorDiagnostic CreateViewComponent_SyncMethod_ShouldReturnValue(string tagHelperType) 59=> RazorDiagnostic.Create( 70public static RazorDiagnostic CreateViewComponent_SyncMethod_CannotReturnTask(string tagHelperType) 71=> RazorDiagnostic.Create( 83public static RazorDiagnostic CreatePageDirective_CannotBeImported(SourceSpan source) 87return RazorDiagnostic.Create(PageDirective_CannotBeImported, source, PageDirective.Directive.Directive, fileName); 95public static RazorDiagnostic CreatePageDirective_MustExistAtTheTopOfFile(SourceSpan source) 96=> RazorDiagnostic.Create(PageDirective_MustExistAtTheTopOfFile, source, PageDirective.Directive.Directive);
Mvc\ViewComponentTagHelperDescriptorFactory.cs (2)
69if (TryFindInvokeMethod(type, out var method, out var diagnostic)) 89private bool TryFindInvokeMethod(INamedTypeSymbol type, out IMethodSymbol method, out RazorDiagnostic diagnostic)
SourceGenerators\Diagnostics\RazorDiagnostics.cs (1)
92public static Diagnostic AsDiagnostic(this RazorDiagnostic razorDiagnostic)
SourceGenerators\RazorSourceGenerator.cs (1)
332foreach (var razorDiagnostic in csharpDocument.Diagnostics)
Microsoft.CodeAnalysis.Razor.UnitTests (6)
DefaultTagHelperDescriptorFactoryTest.cs (6)
863var diagnostic = Assert.Single(attribute.Diagnostics); 1162public static TheoryData<string, ImmutableArray<BoundAttributeDescriptor>, ImmutableArray<RazorDiagnostic>> TagHelperWithPrefixData 1257static (string, ImmutableArray<BoundAttributeDescriptor>, ImmutableArray<RazorDiagnostic>) Combine( 1258(string name, ImmutableArray<BoundAttributeDescriptor> boundAttributes) pair, params ImmutableArray<RazorDiagnostic> diagnostics) 1283ImmutableArray<RazorDiagnostic> expectedDiagnostics) 1296Assert.Equal<RazorDiagnostic>(expectedDiagnostics, [.. descriptor.GetAllDiagnostics()]);
Microsoft.CodeAnalysis.Razor.Workspaces (13)
CodeActions\Razor\ComponentAccessibilityCodeActionProvider.cs (1)
318foreach (var diagnostic in context.CodeDocument.GetRequiredCSharpDocument().Diagnostics)
Diagnostics\RazorDiagnosticHelper.cs (3)
48internal static LspDiagnostic[] Convert(ImmutableArray<RazorDiagnostic> diagnostics, SourceText sourceText, IDocumentSnapshot documentSnapshot) 53foreach (var diagnostic in diagnostics) 87internal static VSDiagnostic ConvertToVSDiagnostic(RazorDiagnostic razorDiagnostic, SourceText sourceText, IDocumentSnapshot? documentSnapshot)
Formatting\Passes\FormattingDiagnosticValidationPass.cs (9)
55private static string GetLogMessage(ImmutableArray<RazorDiagnostic> originalDiagnostics, ImmutableArray<RazorDiagnostic> changedDiagnostics) 61foreach (var diagnostic in originalDiagnostics) 67foreach (var diagnostic in changedDiagnostics) 75private class LocationIgnoringDiagnosticComparer : IEqualityComparer<RazorDiagnostic> 77public static IEqualityComparer<RazorDiagnostic> Instance = new LocationIgnoringDiagnosticComparer(); 79public bool Equals(RazorDiagnostic? x, RazorDiagnostic? y) 85public int GetHashCode(RazorDiagnostic obj)
Microsoft.NET.Sdk.Razor.SourceGenerators.UnitTests (4)
RazorDiagnosticTest.cs (4)
16var diagnostics = RazorDiagnostic.Create(new RazorDiagnosticDescriptor("RZC1001", "Some message", RazorDiagnosticSeverity.Error)); 33var diagnostics = RazorDiagnostic.Create(new RazorDiagnosticDescriptor("RZC1001", "Some message", RazorDiagnosticSeverity.Error), span);
Microsoft.VisualStudio.LanguageServices.Razor.UnitTests (1)
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Diagnostics\RazorDiagnosticHelperTest.cs (1)
20var razorDiagnostic = RazorDiagnosticFactory.CreateDirective_BlockDirectiveCannotBeImported("test");
Microsoft.VisualStudioCode.RazorExtension.UnitTests (1)
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Diagnostics\RazorDiagnosticHelperTest.cs (1)
20var razorDiagnostic = RazorDiagnosticFactory.CreateDirective_BlockDirectiveCannotBeImported("test");