-
-
Notifications
You must be signed in to change notification settings - Fork 192
Open
Description
Step to reproduce:
dotnet new blazorwasm -n test01cd test01dotnet add package Fido2.BlazorWebAssembly --version 4.0.0- update your
Program.cs
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using test01;
+ using Fido2.BlazorWebAssembly;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
+ builder.Services.AddWebAuthn();
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
await builder.Build().RunAsync();
- update your
Pages/Counter.razor
@page "/counter"
+ @using Fido2.BlazorWebAssembly
+ @inject WebAuthn WebAuthn
<PageTitle>Counter</PageTitle>
<h1>Counter</h1>
<p role="status">Current count: @currentCount</p>
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
@code {
private int currentCount = 0;
- private void IncrementCount()
+ private async Task IncrementCount()
{
+ await WebAuthn.Init(); // Failed to fetch dynamically imported module
currentCount++;
}
}
dotnet run
console logs:
Failed to load resource: the server responded with a status of 404 (Not Found)
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Failed to fetch dynamically imported module: http://localhost:5272/_content/Fido2.BlazorWebAssembly/js/WebAuthn.js
TypeError: Failed to fetch dynamically imported module: http://localhost:5272/_content/Fido2.BlazorWebAssembly/js/WebAuthn.js
Microsoft.JSInterop.JSException: Failed to fetch dynamically imported module: http://localhost:5272/_content/Fido2.BlazorWebAssembly/js/WebAuthn.js
TypeError: Failed to fetch dynamically imported module: http://localhost:5272/_content/Fido2.BlazorWebAssembly/js/WebAuthn.js
at Microsoft.JSInterop.JSRuntime.<InvokeAsync>d__23`1[[Microsoft.JSInterop.IJSObjectReference, Microsoft.JSInterop, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext()
at Fido2.BlazorWebAssembly.WebAuthn.<>c__DisplayClass2_0.<<-ctor>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at test01.Pages.Counter.IncrementCount() in C:\Users\wuyafe10\source\repos\wu-yafeng\sample\src\test01\Pages\Counter.razor:line 18
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

Metadata
Metadata
Assignees
Labels
No labels