dotnet / razor

Compiler and tooling experience for Razor ASP.NET Core apps in Visual Studio, Visual Studio for Mac, and VS Code.
https://asp.net
MIT License
505 stars 195 forks source link

Razor throwing exceptions during LiveShare #6568

Open NTaylorMullen opened 2 years ago

NTaylorMullen commented 2 years ago

Nandini mentioned that Razor in LiveShare scenarios is throwing numerous exceptions:

(StackTrace=System.InvalidOperationException: 'Projects' must be called on the project snapshot manager's thread.
   at Microsoft.CodeAnalysis.Razor.ProjectSnapshotManagerDispatcher.AssertDispatcherThread(String caller)
   at Microsoft.CodeAnalysis.Razor.ProjectSystem.DefaultProjectSnapshotManager.get_Projects()
   at Microsoft.VisualStudio.LiveShare.Razor.Host.DefaultProjectSnapshotManagerProxy.<GetLatestProjectsAsync>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.VisualStudio.LiveShare.Razor.Host.DefaultProjectSnapshotManagerProxy.<GetProjectManagerStateAsync>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 System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Microsoft.Cascade.Rpc.RpcDispatcher`1.<>c__DisplayClass24_2.<<CreateDispatchMethod>b__4>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 System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Microsoft.Cascade.Rpc.RpcDispatcher`1.<HandleRequestAsync>d__16.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 System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Microsoft.Cascade.Rpc.RpcSession.<RequestAsync>d__94.MoveNext())}}

Looking at the callstack it looks like our legacy LiveShare stack is spinning up in our "new" world. Technically we should be turning off our custom LiveShare behavior when the new Razor LSP editor is enabled because it "just works".

ryanbrandenburg commented 2 years ago

The work item here is to turn off the Legacy Razor stuff when LiveShare is on.

nandiniYeltiwar commented 2 years ago

What is the timeline for fixing this?

NTaylorMullen commented 2 years ago

What is the timeline for fixing this?

We've de-prioritized it as for now because it doesn't seem like there's any end-user impact (it's from our legacy systems). We're prioritizing other end-user impact based work first.