blazor-webassembly

Blazor Startup Error: System.Threading.SynchronizationLockException: Cannot wait on monitors on this runtime

时光总嘲笑我的痴心妄想 提交于 2020-12-13 04:08:16
问题 I am trying to call an api during the blazor(client side) startup to load language translations into the ILocalizer. At the point I try and get the .Result from the get request blazor throws the error in the title. This can replicated by calling this method in the program.cs private static void CalApi() { try { HttpClient httpClient = new HttpClient(); httpClient.BaseAddress = new Uri(@"https://dummy.restapiexample.com/api/v1/employees"); string path = "ididcontent.json"; string response =

Include a Blazor Webassembly project into an existing ASP.NET Core project

泪湿孤枕 提交于 2020-12-13 03:33:21
问题 When creating a new Blazor Webassembly project, there is a checkbox ASP.NET Core hosted where if selected will create three projects at once, a blazor webassembly project, an ASP.NET Core project, and a shared library project. When the ASP.NET Core project is run in Visual Studio, we can debug the blazor project as well as the ASP.NET Core project (put breakpoint, step, etc.). When the ASP.NET Core project is published, the blazor project is also included in the wwwroot folder. I'm not

Include a Blazor Webassembly project into an existing ASP.NET Core project

本小妞迷上赌 提交于 2020-12-13 03:29:35
问题 When creating a new Blazor Webassembly project, there is a checkbox ASP.NET Core hosted where if selected will create three projects at once, a blazor webassembly project, an ASP.NET Core project, and a shared library project. When the ASP.NET Core project is run in Visual Studio, we can debug the blazor project as well as the ASP.NET Core project (put breakpoint, step, etc.). When the ASP.NET Core project is published, the blazor project is also included in the wwwroot folder. I'm not

Blazor WebAssembly version 5 build error after migration

|▌冷眼眸甩不掉的悲伤 提交于 2020-12-12 10:49:07
问题 After migrating to .Net Core 5 my standalone BlazorWebAssembly project could not be build and have the following error, I tried so many thing but it did not fixed. NETSDK1082 There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'browser-wasm'. MyProjectName C:\Program Files\dotnet\sdk\5.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets 387 (I have tested with both Visual Studio 2019 16.8.1 and also 16.9

How to pass a value from a page to the layout in Blazor?

早过忘川 提交于 2020-12-10 13:12:40
问题 I have a layout ( MainLayout.razor ), and it has a flag called ShowFooter . On some pages, I want to be able to set that flag to true , and some others to false . I haven't been able to find any clear instructions on how a page component can communicate with the layout. How should this be done in Blazor? Note: You might say I should have 2 layouts, one with and one without the footer, but that wouldn't really solve my problem, I want to be able to show and hide the footer at different times