fgilde / MudBlazor.Extensions

MudBlazor.Extensions from https://www.mudex.org is a small extension for MudBlazor from https://mudblazor.com
http://www.mudex.org
MIT License
245 stars 20 forks source link

[Bug]: no value for property MudExConfiguration for MudExFileDisplayZip #44

Closed DragoQCC closed 1 year ago

DragoQCC commented 1 year ago

Contact Details

No response

What happened?

After updating to 1.7.67 when using the MudExFileDisplayZip I get the following error

System.InvalidOperationException: Cannot provide a value for property 'MudExConfiguration' on type 'MudBlazor.Extensions.Components.MudExFileDisplayZip'. There is no registered service of type 'MudBlazor.Extensions.Options.MudExConfiguration'.

         at Microsoft.AspNetCore.Components.ComponentFactory.<>c__DisplayClass7_0.<CreateInitializer>g__Initialize|1(IServiceProvider serviceProvider, IComponent component)
         at Microsoft.AspNetCore.Components.ComponentFactory.PerformPropertyInjection(IServiceProvider serviceProvider, IComponent instance)
         at Microsoft.AspNetCore.Components.ComponentFactory.InstantiateComponent(IServiceProvider serviceProvider, Type componentType)
         at Microsoft.AspNetCore.Components.RenderTree.Renderer.InstantiateChildComponentOnFrame(RenderTreeFrame& frame, Int32 parentComponentId)
         at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewComponentFrame(DiffContext& diffContext, Int32 frameIndex)
         at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewSubtree(DiffContext& diffContext, Int32 frameIndex)
         at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InsertNewFrame(DiffContext& diffContext, Int32 newFrameIndex)
         at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext& diffContext, Int32 oldStartIndex, Int32 oldEndIndexExcl, Int32 newStartIndex, Int32 newEndIndexExcl)
         at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.ComputeDiff(Renderer renderer, RenderBatchBuilder batchBuilder, Int32 componentId, ArrayRange`1 oldTree, ArrayRange`1 newTree)
         at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException)
         at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()

This was working fine on an older version of the project so I'm not sure what may have changed between then and now. I dont see anything in the release notes or readme about it.

Expected Behavior

Zip content would render in the dialog.

Screenshots

No response

What application type are you referring to?

ServerRendered

Custom Application Type

No response

MudBlazor.Extension Version

1.7.67

MudBlazor Version

6.10.0

What browser are you using?

Chrome, Firefox

Sample Solution

No response

Pull Request

No response

Code of Conduct

fgilde commented 1 year ago

Have you added the mud extension services?

builder.Services.AddMudExtensions();

DragoQCC commented 1 year ago

yes, i have that and also the app.UseMudExtensions(); as well. I haven't changed my code at all except for doing an upgrade to the package in Nuget.

DragoQCC commented 1 year ago

seems the errors start at 1.7.64 Starting at that version I get an error about failed JS interop calls and versions newer then 1.7.65 give me the error i posted. Going back to anything older like 1.7.63 seems to work as expected.

fgilde commented 1 year ago

Can you please check if your problem is solved with this package?

1.7.68-prev-2309171718-open...

fgilde commented 1 year ago

seems the errors start at 1.7.64 Starting at that version I get an error about failed JS interop calls and versions newer then 1.7.65 give me the error i posted. Going back to anything older like 1.7.63 seems to work as expected.

Then you have problems with your service registrations. Make sure MudServices are registered first and MudExtensionsServices afterwards

or call builder.Services.AddMudServicesWithExtensions() to register both correctly

DragoQCC commented 1 year ago

That version did not seem to make a difference. I also get this error when using the MudExFileDisplay

 Unhandled exception rendering component: Cannot provide a value for property 'FileService' on type 'MudBlazor.Extensions.Components.MudExFileDisplayDialog'. There is no registered service of type 'MudBlazor.Extensions.Services.MudExFileService'.

My program.cs does load them in the correct order

        builder.Services.AddMudServices();
        builder.Services.AddMudExtensions();

Again, everything seems fine up until the 1.7.64 update, which throws errors on these two components.

fgilde commented 1 year ago

That version did not seem to make a difference. I also get this error when using the MudExFileDisplay

 Unhandled exception rendering component: Cannot provide a value for property 'FileService' on type 'MudBlazor.Extensions.Components.MudExFileDisplayDialog'. There is no registered service of type 'MudBlazor.Extensions.Services.MudExFileService'.

My program.cs does load them in the correct order

        builder.Services.AddMudServices();
        builder.Services.AddMudExtensions();

Again, everything seems fine up until the 1.7.64 update, which throws errors on these two components.

Sure its a difference its another service that will not injected. So that means all registered services doesnt work in your app.

DragoQCC commented 1 year ago

I have figured out the issue it was a conflict with the code beam mud extension package. They also tell you to use builder.Services.AddMudExtensions(); fix for this was just to refer to both by the full namespace

        MudExtensions.Services.ExtensionServiceCollectionExtensions.AddMudExtensions(builder.Services);
        MudBlazor.Extensions.ServiceCollectionExtensions.AddMudExtensions(builder.Services);