-
Notifications
You must be signed in to change notification settings - Fork 215
Description
This issue has been moved from a ticket on Developer Community.
Original error report
[severity:It's more difficult to complete my work]
When i try to format a razor file with properties or methods using RenderFragment the follow exception appear:
StreamJsonRpc.RemoteInvocationException: The changes must not overlap. (Parameter 'changes')
at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__1711.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__181.MoveNext() RPC server exception: System.ArgumentException: The changes must not overlap. (Parameter 'changes') at Microsoft.CodeAnalysis.Text.SourceText.WithChanges(IEnumerable
1 changes)
at Microsoft.CodeAnalysis.Text.ChangedText.WithChanges(IEnumerable1 changes) at Microsoft.CodeAnalysis.Razor.Formatting.CSharpFormattingPass.ExecuteAsync(FormattingContext context, ImmutableArray
1 changes, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Razor.Formatting.RazorFormattingService.GetDocumentFormattingChangesAsync(DocumentContext documentContext, ImmutableArray1 htmlChanges, Nullable
1 range, RazorFormattingOptions options, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.<>c__DisplayClass7_01.<<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, Func2 implementation, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Remote.RemoteWorkspaceManager.RunServiceAsync[T](ServiceBrokerClient client, Checksum solutionChecksum, Func
2 implementation, CancellationToken cancellationToken)
Original Comments
Feedback Bot on 09/10/2025, 07:41 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 09/10/2025, 11:22 AM:
Thanks for reporting this. Unfortunately I’ve been unable to reproduce it locally (though I must say, formatting of RenderFragments doesn’t look great when it does work, so you might be better off!). Would it be possible for you to attach the whole razor file to this issue? Also, include the details of your C# new lines settings from Tools -> Options -> Languages -> C# -> Code Style, click “New Lines”, and let me know which options there are turned off, if any.
Diego Tormes on 09/10/2025, 11:57 PM:
Hi!
I disabled the “Use Roslyn Cohost server for Razor” option to test, and the error disappeared. Then I re-enabled it (doing the required restart), and the original exception did not occur again.
However, Razor formatting still fails in .razor files that expose a RenderFragment method or property via code.
Are you planning to address this issue?