Skip to content

Many error messages after editing a .razor file #12297

@vsfeedback

Description

@vsfeedback

This issue has been moved from a ticket on Developer Community.


Using the latest dev18 MAIN, I have just run into the error bars appearing after editing a .razor file.

You can see when I run into this error at the end of the video at https://microsoft.sharepoint.com/:v:/t/DotNetTeam/ETcq03FyD89FvcAfrBs54uQBErOs1hGiJ7RwdActK343Rg?e=VKg2fb

image.png

Stack trace from one of the errors

StreamJsonRpc.RemoteInvocationException: Razor source generator did not produce a host output for project 'PhotoGallery.Web': warning CS8785: Generator 'RazorSourceGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'ArgumentOutOfRangeException' with message 'Specified argument was out of the range of valid values. (Parameter 'character')'.
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'character')
   at Microsoft.CodeAnalysis.Text.LinePosition.. ctor(Int32 line, Int32 character)
   at Microsoft.CodeAnalysis.Text.TextLineCollection.GetLinePosition(Int32 position)
   at Microsoft.AspNetCore.Razor.Language.Legacy.SeekableTextReader.UpdateState()
   at Microsoft.AspNetCore.Razor.Language.Legacy.Tokenizer.TakeCurrent()
   at Microsoft.AspNetCore.Razor.Language.Legacy.HtmlTokenizer.Token()
   at Microsoft.AspNetCore.Razor.Language.Legacy.HtmlTokenizer.Data()
   at Microsoft.AspNetCore.Razor.Language.Legacy.HtmlTokenizer.Dispatch()
   at Microsoft.AspNetCore.Razor.Language.Legacy.Tokenizer.Turn()
   at Microsoft.AspNetCore.Razor.Language.Legacy.TokenizerView`1.Next()
   at Microsoft.AspNetCore.Razor.Language.Legacy.TokenizerBackedParser`1.EatCurrentToken()
   at Microsoft.AspNetCore.Razor.Language.Legacy.HtmlMarkupParser.ParseJavascriptAndEndScriptTag(SyntaxListBuilder`1& builder, MarkupStartTagSyntax startTag, AcceptedCharactersInternal endTagAcceptedCharacters)
   at Microsoft.AspNetCore.Razor.Language.Legacy.HtmlMarkupParser.ParseMarkupElement(SyntaxListBuilder`1& builder, ParseMode mode)
   at Microsoft.AspNetCore.Razor.Language.Legacy.HtmlMarkupParser.ParseMarkupNode(SyntaxListBuilder`1& builder, ParseMode mode)
   at Microsoft.AspNetCore.Razor.Language.Legacy.HtmlMarkupParser.ParseMarkupNodes(SyntaxListBuilder`1& builder, ParseMode mode, Func`2 stopCondition)
   at Microsoft.AspNetCore.Razor.Language.Legacy.HtmlMarkupParser.ParseDocument()
   at Microsoft.AspNetCore.Razor.Language.Legacy.RazorParser.Parse(RazorSourceDocument source)
   at Microsoft.AspNetCore.Razor.Language.RazorSyntaxTree.Parse(RazorSourceDocument source, RazorParserOptions options)
   at Microsoft.AspNetCore.Razor.Language.DefaultRazorParsingPhase.ExecuteCore(RazorCodeDocument codeDocument, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Razor.Language.RazorEnginePhaseBase.Execute(RazorCodeDocument codeDocument, CancellationToken cancellationToken)
   at Microsoft.NET.Sdk.Razor.SourceGenerators.SourceGeneratorProjectEngine.ExecutePhases(ReadOnlySpan`1 phases, RazorCodeDocument codeDocument)
   at Microsoft.NET.Sdk.Razor.SourceGenerators.SourceGeneratorProjectEngine.ProcessInitialParse(RazorProjectItem projectItem, Boolean designTime)
   at Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator.<>c__DisplayClass6_2. <Initialize>b__23(ValueTuple`2 pair, CancellationToken _)
   at Microsoft.CodeAnalysis.TransformNode`2.<>c__DisplayClass6_0. <.ctor>b__0(TInput i, CancellationToken token)
   at Microsoft.CodeAnalysis.TransformNode`2.UpdateStateTable(Builder builder, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
-----

at StreamJsonRpc.JsonRpc. <InvokeCoreAsync>d__171`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.Remote.BrokeredServiceConnection`1. <TryInvokeAsync>d__18`1.MoveNext()
RPC server exception:
System.InvalidOperationException: Razor source generator did not produce a host output for project 'PhotoGallery.Web': warning CS8785: Generator 'RazorSourceGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'ArgumentOutOfRangeException' with message 'Specified argument was out of the range of valid values. (Parameter 'character')'.
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'character')
   at Microsoft.CodeAnalysis.Text.LinePosition.. ctor(Int32 line, Int32 character)
   at Microsoft.CodeAnalysis.Text.TextLineCollection.GetLinePosition(Int32 position)
   at Microsoft.AspNetCore.Razor.Language.Legacy.SeekableTextReader.UpdateState()
   at Microsoft.AspNetCore.Razor.Language.Legacy.Tokenizer.TakeCurrent()
   at Microsoft.AspNetCore.Razor.Language.Legacy.HtmlTokenizer.Token()
   at Microsoft.AspNetCore.Razor.Language.Legacy.HtmlTokenizer.Data()
   at Microsoft.AspNetCore.Razor.Language.Legacy.HtmlTokenizer.Dispatch()
   at Microsoft.AspNetCore.Razor.Language.Legacy.Tokenizer.Turn()
   at Microsoft.AspNetCore.Razor.Language.Legacy.TokenizerView`1.Next()
   at Microsoft.AspNetCore.Razor.Language.Legacy.TokenizerBackedParser`1.EatCurrentToken()
   at Microsoft.AspNetCore.Razor.Language.Legacy.HtmlMarkupParser.ParseJavascriptAndEndScriptTag(SyntaxListBuilder`1& builder, MarkupStartTagSyntax startTag, AcceptedCharactersInternal endTagAcceptedCharacters)
   at Microsoft.AspNetCore.Razor.Language.Legacy.HtmlMarkupParser.ParseMarkupElement(SyntaxListBuilder`1& builder, ParseMode mode)
   at Microsoft.AspNetCore.Razor.Language.Legacy.HtmlMarkupParser.ParseMarkupNode(SyntaxListBuilder`1& builder, ParseMode mode)
   at Microsoft.AspNetCore.Razor.Language.Legacy.HtmlMarkupParser.ParseMarkupNodes(SyntaxListBuilder`1& builder, ParseMode mode, Func`2 stopCondition)
   at Microsoft.AspNetCore.Razor.Language.Legacy.HtmlMarkupParser.ParseDocument()
   at Microsoft.AspNetCore.Razor.Language.Legacy.RazorParser.Parse(RazorSourceDocument source)
   at Microsoft.AspNetCore.Razor.Language.RazorSyntaxTree.Parse(RazorSourceDocument source, RazorParserOptions options)
   at Microsoft.AspNetCore.Razor.Language.DefaultRazorParsingPhase.ExecuteCore(RazorCodeDocument codeDocument, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Razor.Language.RazorEnginePhaseBase.Execute(RazorCodeDocument codeDocument, CancellationToken cancellationToken)
   at Microsoft.NET.Sdk.Razor.SourceGenerators.SourceGeneratorProjectEngine.ExecutePhases(ReadOnlySpan`1 phases, RazorCodeDocument codeDocument)
   at Microsoft.NET.Sdk.Razor.SourceGenerators.SourceGeneratorProjectEngine.ProcessInitialParse(RazorProjectItem projectItem, Boolean designTime)
   at Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator.<>c__DisplayClass6_2. <Initialize>b__23(ValueTuple`2 pair, CancellationToken _)
   at Microsoft.CodeAnalysis.TransformNode`2.<>c__DisplayClass6_0. <.ctor>b__0(TInput i, CancellationToken token)
   at Microsoft.CodeAnalysis.TransformNode`2.UpdateStateTable(Builder builder, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
-----

at Microsoft.CodeAnalysis.Remote.Razor.ProjectSystem.GeneratorRunResult.CreateAsync(Boolean throwIfNotFound, Project project, RemoteSnapshotManager snapshotManager, CancellationToken cancellationToken)
      at Microsoft.CodeAnalysis.Remote.Razor.ProjectSystem.GeneratorRunResult.CreateAsync(Boolean throwIfNotFound, Project project, RemoteSnapshotManager snapshotManager, CancellationToken cancellationToken)
      at Microsoft.CodeAnalysis.Remote.Razor.ProjectSystem.RemoteProjectSnapshot.GetRequiredCodeDocumentAsync(IDocumentSnapshot documentSnapshot, CancellationToken cancellationToken)
      at Microsoft.CodeAnalysis.Remote.Razor.ProjectSystem.RemoteDocumentSnapshot.GetGeneratedOutputAsync(CancellationToken cancellationToken)
      at Microsoft.CodeAnalysis.Razor.ProjectSystem.DocumentContext. <GetCodeDocumentAsync>g__GetCodeDocumentCoreAsync|19_0(CancellationToken cancellationToken)
      at Microsoft.CodeAnalysis.Remote.Razor.RemoteAutoInsertService.TryResolveInsertionAsync(RemoteDocumentContext remoteDocumentContext, LinePosition linePosition, String character, RemoteAutoInsertOptions options, CancellationToken cancellationToken)
      at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.<>c__DisplayClass7_0`1. <<RunWithSolutionAsync>g__ProcessSolutionAsync|1>d.MoveNext()
   --- End of stack trace from previous location ---
      at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.RunWithSolutionAsync[T](AssetProvider assetProvider, Checksum solutionChecksum, Boolean updatePrimaryBranch, Func`2 implementation, CancellationToken cancellationToken)
      at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.RunWithSolutionAsync[T](AssetProvider assetProvider, Checksum solutionChecksum, Boolean updatePrimaryBranch, Func`2 implementation, CancellationToken cancellationToken)
      at Microsoft.CodeAnalysis.Remote.RemoteWorkspaceManager.RunServiceAsync[T](ServiceBrokerClient client, Checksum solutionChecksum, Func`2 implementation, CancellationToken cancellationToken)


Original Comments

Feedback Bot on 10/1/2025, 06:24 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Feedback Bot on 10/2/2025, 02:56 PM:

Thank you for sharing your feedback! Our teams prioritize action on product issues with broad customer impact. See details at: https://docs.microsoft.com/en-us/visualstudio/ide/report-a-problem#faq. In case you need answers to common questions or need assisted support, be sure to use https://visualstudio.microsoft.com/vs/support/. We’ll keep you posted on any updates to this feedback.

Metadata

Metadata

Assignees

Labels

author: migration bot 🤖The issue was created by a issue mover bot. The author may not be the actual author

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions