gpt4 book ai didi

c# - 重命名 Blazor 组件文件名时出错

转载 作者:行者123 更新时间:2023-12-04 08:23:10 28 4
gpt4 key购买 nike

标题说了算。这并不是真正的世界末日,而是一种烦恼。如果我重命名 Blazor 组件,IntelliSense中断并仍然接受旧名称,直到我重新启动 Visual Studio。尝试进行重命名时,我也收到错误消息。
我正在使用 Visual Studio 2019 Professional .这是 VS 中的已知问题吗?
这是错误的堆栈跟踪:

StreamJsonRpc.RemoteInvocationException: Unexpected falseat 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 falseat 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()

最佳答案

Is this a known issue in VS?


我想是的,至少对我们俩来说是...我的解决方案:双击 Blazor 的项目名称,并删除 VS 添加的所有设置,以引用所做的命名更改。
当然,你可以在github上发布一个问题......
更新:
注意这个实验:
我将 Index.razor 重命名为 Index.txt,然后打开了 csproj 文件。 VS 添加了这些设置:
<ItemGroup>
<None Remove="Pages\Index.txt" />
</ItemGroup>

<ItemGroup>
<Content Include="Pages\Index.txt" />
</ItemGroup>
同样,我将 Index.txt 重命名为 Index.razor... VS 已删除这些元素。没有问题。我使用的是社区版,但是当我使用专业版时,我不得不手动删除它们......但是,唉,我花了一些时间才意识到这一点(而不是通过改变而不是聪明......)
另一个实验:将 Counter.razor 重命名为 Counter2.razor... 尝试在索引页面中为 Counter2 添加一个元素: <Counter2 /> ,但被拒绝。我仍然可以使用 <Counter /> ,现在已经不存在了。只有在关闭索引页面并打开它之后,它才识别出新的变化......

关于c# - 重命名 Blazor 组件文件名时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65397195/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com