fix: IconService not available in MAUI blazorwebview
See original GitHub issue🐛 Bug Report
I’m hosting a blazor web app in a MAUI blazorwebview, see https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/blazorwebview?source=recommendations&view=net-maui-7.0.
Since MAUI does not support builder.Services.AddHttpClient(), exception raised when visiting a page that contains FluentIcon.
💻 Repro or Code Sample
Not available.
🤔 Expected Behavior
FluentIcon should be usable in MAUI blazorwebview.
😯 Current Behavior
blazor.webview.js raises exception: Unable to resolve service for type 'System.Net.Http.HttpClient' while attempting to activate 'Microsoft.Fast.Components.FluentUI.IconService'.
💁 Possible Solution
🔦 Context
🌍 Your Environment
- OS & Device: Windows 11 (update)
- Browser: BlazorWebview
- .NET and FAST Version: .NET 7 and FAST 1.6.0
Issue Analytics
- State:
- Created 9 months ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
fix: IconService not available in MAUI blazorwebview ...
I have a fix for this. In the latest commits (targeting 2.0 release) the IconService has been renamed to HttpBasedStaticAssetService . This is ......
Read more >Host a Blazor web app in a .NET MAUI app using ...
The .NET MAUI BlazorWebView control enables you to host a Blazor web app in your .NET MAUI app, and integrate the app with...
Read more >Blazor Page added to existing standard .NET MAUI app is ...
I simply want to place BlazorWebView in my regular .NET MAUI pages using XAML and handle my navigation through the Shell.
Read more >NET MAUI Blazor Hybrid local images not loading
Working on a .NET MAUI Blazor Hybrid and using MudBlazor for my UI. Images are currently not loading in my app.
Read more >Blazor Hybrid Web Apps with .NET MAUI
Through a BlazorWebView component, MAUI apps can use the Blazor Web ... NET MAUI Blazor offers some unique abilities that are not available...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I have a fix for this. In the latest commits (targeting 2.0 release) the
IconServicehas been renamed toHttpBasedStaticAssetService. This is the service that will be used in Blazor Server and Blazor Web Assembly situations.For Blazor Hybrid a new
FileBasedStaticAssetServiceneeds to be added to your Maui/Bazor solution. The file can currently not be added to the library because of dependency on NuGet packages that cannot be included in the Library project. Contents of the file:In your
MauiProgram.csmake sure the following is added before thereturn builder.Build():Thanks! Can’t wait to see 2.0 release.