Closed verdie-g closed 2 weeks ago
@verdie-g
Did you add the icons package as per https://www.fluentui-blazor.net/IconsAndEmoji?
dotnet add package FluentUI.AspNetCore.Components.Icons
Is this happening in a published application? If so, it is probably the trimmer being to aggressive. Try with adding to your project file:
<ItemGroup> <TrimmerRootAssembly Include="Microsoft.FluentUI.AspNetCore.Components" /> </ItemGroup>
I could reproduce in a minimal application:
Home.razor
with the snippet of my first messageDid you add the icons package as per https://www.fluentui-blazor.net/IconsAndEmoji?
I confirm that this package is included in the template
Is this happening in a published application?
and that I've not published the app but just ran it from my IDE.
~Ok, with these settings your home page is using SSR. Maybe that is it.~ Never mind, it's wasm...
Will take a look later
Ok, the issue is that you have not specified an Intent
of the MessageBar in the options.
It will go through this code
return Content.Intent switch
{
MessageIntent.Info => new CoreIcons.Filled.Size20.Info(),
MessageIntent.Warning => new CoreIcons.Filled.Size20.Warning(),
MessageIntent.Error => new CoreIcons.Filled.Size20.DismissCircle(),
MessageIntent.Success => new CoreIcons.Filled.Size20.CheckmarkCircle(),
_ => null,
};
In your case it returns null and that is what gives you the error.
So 'workaround' is for now to supply an Intent
(of type Messageintent
) in the options.
I'll implement a default (MessageIntent.Info
) for this for the next trelease.
🐛 Bug Report
MessageService.ShowMessageBar can throw a System.ArgumentNullException.
💻 Repro or Code Sample
🌍 Your Environment