-
Notifications
You must be signed in to change notification settings - Fork 459
Closed
Labels
status:in-progressWork is in progressWork is in progress
Description
🐛 Bug Report
This issue occurs exclusively in version 4.9.2, downgrading to 4.9.1 resolves the issue.
When injecting any design token and calling .SetValue() with any element reference, the DesignToken class fails to inject the registered LibraryConfiguration causing an Object reference not set to an instance of an object exception to be thrown inside UrlFormatterExtensions.cs.
💻 Repro or Code Sample
Component:
@using Microsoft.FluentUI.AspNetCore.Components.DesignTokens
<div class="container">
<FluentTextField @ref="Test" @bind-Value=Title></FluentTextField>
</div>
@code {
[Parameter, EditorRequired]
public string Title { get; set; } = null!;
FluentTextField Test;
[Inject]
private Density _density { get; set; } = default!;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await _density.SetValueFor(Test.Element, 10);
StateHasChanged();
}
}
}Startup:
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
});
builder.Services.AddMauiBlazorWebView();
builder.Services.AddHttpClient();
builder.Services.AddFluentUIComponents();
#if DEBUG
builder.Services.AddBlazorWebViewDeveloperTools();
builder.Logging.AddDebug();
#endif
return builder.Build();
}
}🤔 Expected Behavior
Calling .SetValue() on any DesignToken should not throw a null reference exception.
😯 Current Behavior
LibraryConfiguration is injected as null into DesignToken.razor.cs causing a null reference exception when attempting to set any DesignToken value.
🌍 Your Environment
- OS & Device: Windows
- .NET MAUI desktop application
- .NET and Fluent UI Blazor library Version: .NET 8 / Fluent UI 4.9.2
Metadata
Metadata
Assignees
Labels
status:in-progressWork is in progressWork is in progress