debugging 无法启动wasm调试Blazor WASM

xfyts7mz  于 2023-06-23  发布在  其他
关注(0)|答案(2)|浏览(181)

我试着调试我的Blazor WASM项目,但是无论我用哪种方法调试都没有开始。它不适用于VS Code,Visual Studio 2019和VS 2022。如果我按下Shift+Alt+D,然后将浏览器启动参数用于调试,它似乎找到了源文件,但冻结了工作区并写入“Tab is inactive”,因此我无法从源代码中提取任何代码。就像这样:
https://www.screencast.com/t/3M8i3YckY
Visual Studios和VS Code都写了“未绑定断点”或“没有加载符号”,这取决于天知道是什么--一开始。它有时会让我调试然后,但下一次调试启动没有工作在同一个浏览器。当我尝试另一个,它的工作,但只是一个额外的时间。当我用完浏览器时,我不知道如何返回到可以调试的状态。
现在他们(VSes和代码)只是挂起一段时间后,打开浏览器,并最终拍摄“无法连接到调试目标。承诺被取消了。无法连接到localhost:????".
当我尝试调试示例Blazor WASM项目时,它像预期的那样工作得很好。
下面是launchSettings.json。

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:46330",
      "sslPort": 44369
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
    },
    "Web.Client": {
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "dotnetRunMessages": "true",
      "applicationUrl": "https://localhost:5003;http://localhost:5002",
      "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
    },
    "Docker": {
      "commandName": "Docker",
      "launchBrowser": true,
      "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
      "publishAllPorts": true,
      "useSSL": true
    }
  }
}

下面是.csproj:

<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
    <ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
    <UserSecretsId>1c3cafab-2f7d-4a06-b84c-46691a8e5dcf</UserSecretsId>
    <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
  </PropertyGroup>

  <ItemGroup>
    <Content Remove="compilerconfig.json" />
    <Content Remove="wwwroot\css\MDB\css\NavMenu.css" />
    <Content Remove="wwwroot\css\NavMenu.css" />
    <Content Remove="wwwroot\css\standard-items\standard-items.css" />
    <Content Remove="wwwroot\css\standard-items\standard-items.scss" />
  </ItemGroup>

  <ItemGroup>
    <None Remove=".dockerignore" />
    <None Remove="Dockerfile" />
    <None Remove="Dockerfile.original" />
  </ItemGroup>

  <ItemGroup>
    <_ContentIncludedByDefault Remove="wwwroot\css\app.min.css" />
    <_ContentIncludedByDefault Remove="wwwroot\css\standard-items\standard-items.min.css" />
  </ItemGroup>

  <ItemGroup>
    <Protobuf Include="..\Web.Common\Services.proto" GrpcServices="Client" Link="..\Protos\Services.proto" />
  </ItemGroup>
  
  <ItemGroup>
    <PackageReference Include="Grpc.Net.Client" Version="2.38.0" />
    <PackageReference Include="Grpc.Net.Client.Web" Version="2.38.0" />
    
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.7" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.7" PrivateAssets="all" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="5.0.7" />

    <PackageReference Include="Grpc" Version="2.38.1" />
    <PackageReference Include="Grpc.Tools" Version="2.38.1" PrivateAssets="all" />
    <PackageReference Include="Google.Protobuf" Version="3.17.3" />
    <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.11.1" />

    <PackageReference Include="MudBlazor" Version="5.1.0" />

    <PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
  </ItemGroup>

  <ItemGroup>
    <ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
  </ItemGroup>

  <ItemGroup>
    <None Include="compilerconfig.json" />
    <None Include="wwwroot\css\MDB\scss\NavMenu.scss" />
    <None Include="wwwroot\css\NavMenu.css" />
    <None Include="wwwroot\css\standard-items\standard-items.css">
      <DesignTime>True</DesignTime>
      <AutoGen>True</AutoGen>
      <DependentUpon>standard-items.scss</DependentUpon>
    </None>
    <None Include="wwwroot\css\standard-items\standard-items.scss">
      <Generator>SassTranspiler</Generator>
      <LastGenOutput>standard-items.css</LastGenOutput>
    </None>
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\Web.Common\Communication.csproj" />
  </ItemGroup>

  <ItemGroup>
    <Folder Include="wwwroot\css\standard-items\Inputs\" />
    <Folder Include="wwwroot\css\standard-items\Cards\" />
  </ItemGroup>

  <ItemGroup>
    <None Remove="..\.dockerignore" />
  </ItemGroup>

</Project>

请帮助,因为我严重憔悴没有客户端调试.
更新:我设法摆脱了“标签是不活动的”消息,但断点不被击中。

qqrboqgw

qqrboqgw1#

这个解决方法对我很有效(在Visual Studio 2019.11.4上,使用Chrome版本94.0...):我清理了解决方案并重新启动了我的电脑。

slsn1g29

slsn1g292#

我现在仍然对此感到非常困惑,但是如果我将窗口从辅助显示器移到主显示器上,那么调试就可以工作了。有时候吧
它不喜欢Edge( chrome 版)进行Ctrl + Shift + D调试,我不得不使用Chrome。

相关问题