馃悰 Bug Report
It seems like, similar to #3408 #3973 #3994, the RenderFragmentDialog may also need the [DynamicDependency] attribute.
There may also be other dialog components where this is a problem.
This specifically happens on publish - when I run in debug this doesn't occur (making me think this is the same issue as the above linked tickes).
馃捇 Repro or Code Sample
DialogService.ShowDialogAsync(@<MyComponent/>, new DialogParameters()
{
ShowDismiss = true,
PrimaryAction = "Ok",
SecondaryAction = null,
Title = "ComponentTest",
TrapFocus = false,
Width = "60vw",
Height = "80vh"
});
Adding this above the function resolves the error:
// Preserve Dialog constructor for the linker / test after migration to V5
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicConstructors, typeof(RenderFragmentDialog))]
void PreserveDialog() { }
PreserveDialog();
馃槸 Current Behavior
Get this exception:
[InvalidOperationException]: [Message: CtorNotLocated, Microsoft.FluentUI.AspNetCore.Components.RenderFragmentDialog] [Stacktrace: at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.FindApplicableConstructor(Type , Type[] , ConstructorInfoEx[] , ConstructorInfo& , Nullable`1[]& )
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateFactoryReflection(Type , Type[] )
at Microsoft.AspNetCore.Components.DefaultComponentActivator.GetObjectFactory(Type )
at Microsoft.AspNetCore.Components.DefaultComponentActivator.CreateInstance(Type )
at Microsoft.AspNetCore.Components.ComponentFactory.InstantiateComponent(IServiceProvider , Type , IComponentRenderMode , Nullable`1 )
at Microsoft.AspNetCore.Components.RenderTree.Renderer.InstantiateChildComponentOnFrame(RenderTreeFrame[] , Int32 , Int32 )
at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewComponentFrame(DiffContext& , Int32 )
at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewSubtree(DiffContext& , Int32 )
at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InsertNewFrame(DiffContext& , Int32 )
at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext& , Int32 , Int32 , Int32 , Int32 )
at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.ComputeDiff(Renderer , RenderBatchBuilder , Int32 , ArrayRange`1 , ArrayRange`1 )
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder , RenderFragment , Exception& )
at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry )
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()]
"
馃拋 Possible Solution
I feel like just replicating this fix for all the Dialog types will be enough #3994
- Possibly in v5 & v4?
- is there a test that could be added in the pipeline to check for this automatically? Annoying as it requires running the trimmer.
馃實 Your Environment
Windows 10 - FluentUI-Blazor v4.14.3 - Google Chrome - Net10
(This may also be an issue in V5)
馃悰 Bug Report
It seems like, similar to #3408 #3973 #3994, the
RenderFragmentDialogmay also need the[DynamicDependency]attribute.There may also be other dialog components where this is a problem.
This specifically happens on publish - when I run in debug this doesn't occur (making me think this is the same issue as the above linked tickes).
馃捇 Repro or Code Sample
Adding this above the function resolves the error:
馃槸 Current Behavior
Get this exception:
馃拋 Possible Solution
I feel like just replicating this fix for all the Dialog types will be enough #3994
馃實 Your Environment
Windows 10 - FluentUI-Blazor v4.14.3 - Google Chrome - Net10
(This may also be an issue in V5)