Skip to content

Razor on MAUI Blazor for Andorid, iOS #12805

@vsfeedback

Description

@vsfeedback

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


Too slou debug, many errors.

StreamJsonRpc.RemoteInvocationException: Ran out of lines while trying to process formatted changes. Abandoning further formatting to not corrupt the source file, please report this issue.
v StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__1711.MoveNext() --- Konec trasování zásobníku z předchozího místa, ze kterého byla vyvolána výjimka --- v System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() v System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) v Microsoft.CodeAnalysis.Remote.BrokeredServiceConnection1.<TryInvokeAsync>d__181.MoveNext() RPC server exception: System.InvalidOperationException: Ran out of lines while trying to process formatted changes. Abandoning further formatting to not corrupt the source file, please report this issue. at Microsoft.CodeAnalysis.Remote.Razor.ThrowingErrorLoggerProvider.Logger.Log(LogLevel logLevel, String message, Exception exception) at Microsoft.CodeAnalysis.Razor.Logging.AbstractLoggerFactory.AggregateLogger.Log(LogLevel logLevel, String message, Exception exception) at Microsoft.CodeAnalysis.Razor.Formatting.CSharpFormattingPass.ExecuteAsync(FormattingContext context, ImmutableArray1 changes, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Razor.Formatting.RazorFormattingService.GetDocumentFormattingChangesAsync(DocumentContext documentContext, ImmutableArray1 htmlChanges, Nullable1 range, RazorFormattingOptions options, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.<>c__DisplayClass7_01.&lt;&lt;RunWithSolutionAsync&gt;g__ProcessSolutionAsync|1&gt;d.MoveNext() --- End of stack trace from previous location --- at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.RunWithSolutionAsync[T](AssetProvider assetProvider, Checksum solutionChecksum, Boolean updatePrimaryBranch, Func2 implementation, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.RunWithSolutionAsync[T](AssetProvider assetProvider, Checksum solutionChecksum, Boolean updatePrimaryBranch, Func2 implementation, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Remote.RemoteWorkspaceManager.RunServiceAsync[T](ServiceBrokerClient client, Checksum solutionChecksum, Func2 implementation, CancellationToken cancellationToken)


Original Comments

Feedback Bot on 19/02/2026, 10:27 AM:

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.

David Wengier [MSFT] on 19/02/2026, 04:00 PM:

Thanks for reporting this issue. When formatting logs this error it is usually difficult for us to reproduce without extra info, and so we have added extra logging to our formatting engine to help with this. The instructions for turning on the extra logging are here: https://github.com/dotnet/razor/blob/main/docs/Formatting.md#turn-on-formatting-logging

If you could enable this logging, open VS, and perform your formatting operation again, that will create a folder on disk with all of the info we need to solve this problem. If you can then zip up the folder and attach it to this issue, we’ll be able to get this resolved.

Thanks very much!

Milan Volčík on 20/02/2026, 07:17 PM:

(private comment, text removed)

David Wengier [MSFT] on 20/02/2026, 08:58 PM:

Thanks! Looks like the Razor parser isn’t handling the @if on line 54, and it ends up thinking a few close braces are Html, and a few <div> and </div> tags are C#, which confuses the formatter. Will definitely look into hardening this!

Looks like only one of the formatting operations in the log failed though, so hopefully you were able to complete your work despite the error popping up 😃

David Wengier [MSFT] on 20/02/2026, 09:20 PM:

Ahhh, I see what is happening. I’m guessing you typed the @if, and then pasted in the if condition, but it doesn’t have parentheses. We have code that ignores formatting requests on paste if the document has Razor syntax errors that overlap the pasted range, but in this case the pasted range doesn’t have Razor syntax errors (it does have C# syntax errors, but we don’t check for them because that’s too expensive), but it causes Razor syntax errors immediately after the pasted range. We should be able to just check a little bit of a broader section of the document and things should be back to normal.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions