public override void VisitDirectiveBlock(DirectiveChunkGenerator chunkGenerator, Block block) { if (_nestedLevel > 0) { var directiveStart = block.Children.First(child => !child.IsBlock && ((Span)child).Kind == SpanKindInternal.Transition).Start; var errorLength = /* @ */ 1 + SectionDirective.Directive.Directive.Length; var error = RazorDiagnostic.Create( new RazorError( LegacyResources.FormatParseError_Sections_Cannot_Be_Nested(LegacyResources.SectionExample_CS), directiveStart, errorLength)); chunkGenerator.Diagnostics.Add(error); } _nestedLevel++; VisitDefault(block); _nestedLevel--; }