Questions tagged [blazor-webassembly]

There are two hosting models for Blazor apps: server-side (often pre-rendered) and client-side (WebAssembly). Because of the different hosting environments, something what may work on the client-side might not on the server-side, and vice versa. Use this tag for questions specific to client-side hosted Blazor apps.

3430 questions
66
votes
1 answer

StateHasChanged() vs InvokeAsync(StateHasChanged) in Blazor

I know that calling the StateHasChanged() method notifies the component that the state has changed and so it should re-render. However, I also sometimes see things like await InvokeAsync(StateHasChanged) or await InvokeAsync(() => StateHasChanged())…
Arad Alvand
  • 8,607
  • 10
  • 51
  • 71
56
votes
13 answers

There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'browser-wasm'

Trying to migrate from ASP.NET Core 3.1 to 5.0 using this guide provided by Microsoft. Installed SDK 5.0.100-rc.1 with runtimes. Updated project as guide says and still getting following error: There was no runtime pack for Microsoft.AspNetCore.App…
Kasta
  • 1,724
  • 2
  • 16
  • 22
53
votes
9 answers

Is there any hot reload for blazor server-side?

I have just one, quick question. Is there way to hot reload a blazor app? At least, .razor files? Now I'm hosting my app on local IIS (not IIS express). I was looking through internet, but i didn't found anything helpful. Thank you all for anwsering…
41
votes
6 answers

Blazor, how can I trigger the enter key event to action a button function?

I was trying the todo-list example from Microsoft: https://learn.microsoft.com/en-us/aspnet/core/tutorials/build-a-blazor-app?view=aspnetcore-3.1 I want to add a todo item and instead of pressing the button with a mouse click I want to press the…
33
votes
2 answers

Blazor Server side vs Blazor WebAssembly Hosted

I am new to Blazor and am trying to understand the differences between different hosting models. From what I read I understand Blazor Server side and Blazor WebAssembly Hosted have server side code, both use Signal R to communicate with the…
Newbie
  • 563
  • 1
  • 5
  • 16
32
votes
11 answers

The Visual Studio 2022 Error "Failed to launch debug adapter. Additional information may be available in the output window."

I am using Visual Studio 2022 for Blazor WebAssembly Project and the ASP.NET Core API Project. When I run these projects independently, they works fine in Edge, Chrome browsers but, when I select Multiple-Startup projects, I am getting the following…
Mahesh S
  • 451
  • 1
  • 5
  • 7
29
votes
1 answer

C# Blazor WebAssembly: Argument 2: cannot convert from 'void' to 'Microsoft.AspNetCore.Components.EventCallback'

I'm new to blazor C# and trying to make a simple countdown timer website. My website consist of: Text to display the timer Start and stop button Buttons to set the timer I'm having a problem in the buttons to set the timer. When i click on it, it…
TheNoobProgrammer
  • 1,013
  • 4
  • 10
  • 21
25
votes
3 answers

Blazor WASM Net 6 Preview 4 Azure AD - There was an error trying to log you in: 'Cannot read property 'toLowerCase' of undefined'

I have a simple Blazor WASM running Net 6 Preview 4 that I setup using this guide: https://learn.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/hosted-with-azure-active-directory?view=aspnetcore-6.0 The exact code works perfect with Net…
aherrick
  • 19,799
  • 33
  • 112
  • 188
22
votes
18 answers

Exception: '<' is an invalid start of a value

I have a Blazor Webassembly project with a controller method as follows: [HttpGet] public async Task> GetStatesForProfile() { IConfigurationSection statesSection = configuration.GetSection("SiteSettings:States"); …
mz1378
  • 1,957
  • 4
  • 20
  • 40
21
votes
0 answers

Remove Duende IdentityServer from MS Blazor Web Assembly template solution server project

I just created a Blazor Web Assembly solution for .net 6 with 'Individual Accounts' and 'ASP.NET Core Hosted' selected. This message is displayed in a ReadMe.txt in the .Server project: This code includes a dependency on Duende IdentityServer. This…
niico
  • 11,206
  • 23
  • 78
  • 161
20
votes
3 answers

"Cannot read property '_blazorFilesById' of null error" with Blazor InputFile component

I've started getting this error from my Blazor WebAssembly app: "Cannot read property '_blazorFilesById' of null error" with Blazor app I'm assuming that's related to the InputFile component I'm using, which has been working fine. I've tried…
tomRedox
  • 28,092
  • 24
  • 117
  • 154
19
votes
2 answers

Compiling existing C# code to WebAssembly

Is it possible to compile existing C# code to WebAssembly (.wasm) so that no or nearly no code changes have to be done? Do I have to use Blazor for it or are their other possibilities?
Janine
  • 297
  • 3
  • 9
19
votes
5 answers

How to add Font Awesome to Blazor client (Razor component) app?

I created a Blazor WebAssembly hosted template in .NET Core 3.1. Then right clicked on project.Client/wwwroot/css folder and clicked on Add client side library. Then selected the Font Awesome library and installed it. I added the below line to…
Sorush
  • 3,275
  • 4
  • 28
  • 42
18
votes
8 answers

NET5.0 Blazor WASM CORS client exception

I have a Blazor WASM app and a Web Api to get called by Blzor via HttpClient. Both programs run on the same machine (and also in production environment which should not be to exotic for a small business application!). Calling the Web Api from the…
tomschrot
  • 219
  • 1
  • 2
  • 4
18
votes
8 answers

Unable to debug Blazor hosted webassembly 3.2.0 from Visual Studio 2019 16.6.2

I have Visual Studio 2019 16.6.2 installed, along with the .NET Core 3.1.301 SDK and all the necessary Blazor templates. If I create a brand new Blazor WebAssmbly application, I can run it from Visual Studio by pressing Ctrl+F5 and it opens a new…
1
2 3
99 100