2
votes

The title says it. This isn't really the end of the world, but it's an annoyance. If I rename a Blazor component, IntelliSense breaks and still accepts the old name until I restart Visual Studio. I also get an error when trying to do the rename.

I'm using Visual Studio 2019 Professional. Is this a known issue in VS?

Here's the stack trace of the error:

StreamJsonRpc.RemoteInvocationException: Unexpected false at StreamJsonRpc.JsonRpc.d__1331.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.Remote.RemoteEndPoint.<InvokeAsync>d__211.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject) RPC server exception: System.InvalidOperationException: Unexpected false at Roslyn.Utilities.Contract.Fail(String message) at Roslyn.Utilities.Contract.ThrowIfFalse(Boolean condition) at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.SolutionCreator.d__14.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.RemoteWorkspace.SolutionCreator.d__13.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.SolutionCreator.d__12.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.RemoteWorkspace.SolutionCreator.d__10.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.SolutionCreator.d__8.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.RemoteWorkspace.SolutionCreator.d__7.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.RemoteWorkspace.SolutionCreator.d__6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject) --- 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.RemoteWorkspace.<CreateSolution_NoLockAsync>d__10.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.RemoteWorkspace.d__12.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.CodeAnalysisService.<>c__DisplayClass29_0.<b__0>d.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.ServiceBase.d__16`1.MoveNext()

1

1 Answers

2
votes

Is this a known issue in VS?

I guess it is, at least for both of us... My solution: Double click on the Blazor's project name, and remove all the settings added by VS in reference to naming changes made.

Of course, you may post an issue in github...

UPDATE:

Note this experiment: I renamed Index.razor to Index.txt, and then opened the csproj file. VS added these settings:

<ItemGroup>
    <None Remove="Pages\Index.txt" />
  </ItemGroup>

  <ItemGroup>
    <Content Include="Pages\Index.txt" />
  </ItemGroup>

Again, I renamed Index.txt to Index.razor... VS has removed these elements. No issues. I'm using community version, but when I was using the professional version, I had to remove them manually...But alas, it took me some time to realize this (rather by change than by being smart...)

Another experiment: Renamed Counter.razor to Counter2.razor... tried to add an element for Counter2 in the Index page: <Counter2 />, but it is rejected. I could still use <Counter />, which does not exist any longer. Only after closing the Index page and opening it did it recognize the new changes...