Blazor netcore 6.0 wasm reproducable bug with GRPC / protobuf

Allen A 1 Reputation point
2022-10-26T20:19:19.037+00:00

I'm trying to get grpc working with blazor client webassembly. To reproduce the problem simple create a Blazor WebAssembly App (no auth, https checked but nothing else checked). After creating the app, add packages grpc.aspnet.core.web 2.49.0 and google.protobuf.tools 3.21.8. After adding both in any order you will immediately get the error

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

If you have one or the other as a package then the error doesn't occur, but both together produces it 100% of the time. If I do a blazor app but with server and add the package to the server side then it has no problems at all so this has something to do with the client side webassembly.

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,500 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 61,731 Reputation points
    2022-10-27T15:40:08.017+00:00

    there are two gRPC nuget packages. One for asp net core apps (has client and server support). this package require the asp.net core framework. two Grpc.Net.Client which is for .net core clients, but it requires http2 support in core.

    neither of these packages will work with Blazor. Blazor WASM is a unique framework, and its HttpClient just calls javascript as WASM has no network support.

    you want to use the browser version and call js interop.

    https://github.com/grpc/grpc-web

    0 comments No comments