blazor after visual studio update throws some strange JS warnings

题意:Blazor 在 Visual Studio 更新后出现一些奇怪的 JS 警告。

问题背景:

After update visual studio to 17.11.3, in almost every file that i opened with visual studio threw some warning:

在将 Visual Studio 更新到 17.11.3 后,几乎每个我用 Visual Studio 打开的文件都抛出了某些警告:

Severity    Code    Description Project File    Line    Suppression State
Warning (active)    TS1109  (JS) Expression expected.   Miscellaneous   D:\xxx\Components\Core\DialogConfirmComponent.razor__virtual.html__virtual.js   9   

As on screen

如屏幕所示

Is it some .net bug ? or i should do something with it? no idea what it is this _virtual.html_virtual.js? guess some temp file?

这是某个 .NET 的错误吗?还是我应该对它做些什么?我不知道这个 _virtual.html_virtual.js 是什么?我猜是某个临时文件?

before update there was no such things...?

在更新之前没有这样的情况…?

thanks and regards

Edit:

Minimal Reproducible Example

最小可复现示例

  1. Have 17.11.3 Visual Studio   拥有 Visual Studio 17.11.3
  2. Dotnet new install MudBlazor.Templates   使用 Dotnet 安装 MudBlazor.Templates
  3. New project - MudBlazor Web APP (server rendering mode / global)   新项目 - MudBlazor Web 应用(服务器渲染模式 / 全局)
  4. Open counter component. delete all.   打开计数器组件。删除所有内容。
  5. Paste into this counter component   粘贴到这个计数器组件中。
    <MudButton Variant="Variant.Filled" Color="Color.Primary" DropShadow="false" OnClick="@(()=>blabla())">Validate</MudButton>
@code {

    public void blabla()
    {
        
    }

}
  1. Save and see the warnings   保存并查看警告。

问题解决:

ok i found it for future searchers

好的,我找到了,供未来的搜索者使用。

from version of visual studio 17.11.3        从 Visual Studio 17.11.3 版本开始

OnClick="@(async () => await Validate())">

i causing this isasue        我导致了这个问题。

@onclick="@(async () => await Validate())"> or @onclick="Validate"

is not throwing it.        没有抛出它。

but the OnClick should also work as it is part of the api MudBlazor - Blazor Component Library

但是 OnClick 也应该正常工作,因为它是 MudBlazor - Blazor 组件库的一部分。

please if someone known - why this is throwing it now? i added minimal example in first post/question

请问如果有人知道——为什么现在会抛出这个?我在第一篇帖子/问题中添加了最小示例。

i downgraded to visual studio 17.10.5 and NO WARNINGS so issue is only in 17.11.3.

我降级到 Visual Studio 17.10.5,结果没有警告,所以这个问题仅出现在 17.11.3 中。

so it is issue with VS i opened case for them

所以这是 VS 的问题,我已经为他们开了个案例。

blazor after visual studio update throws some strange warnings · Issue #10896 · dotnet/razor · GitHub

edit. yes it is their bug and slould be fixed.

编辑:是的,这是他们的错误,应该被修复。

猜你喜欢

转载自blog.csdn.net/suiusoar/article/details/143483412