CodeBeamOrg / CodeBeam.MudBlazor.Extensions

Useful third party extension components for MudBlazor, from the contributors.
https://mudextensions.codebeam.org/
MIT License
367 stars 62 forks source link

MudStepper Example Compilation Issues #238

Closed jbenson001 closed 11 months ago

jbenson001 commented 12 months ago

I am having trouble getting the MudStepper example working from this URL: [https://codebeam-mudextensions.pages.dev/mudstepper]

There were numerous compilation errors since it seems namespaces have changed in the most current version. I am using .NET Core 6 - Blazor Server MudBlazor: v6.2.3 CodeBeam.MudBlazor.Extensions: v6.5.2 I have installed the NuGet package from VS2022

I have resolved most compilation errors except for 2 of the same error: CS0117 'RuntimeHelpers' does not contain a definition for 'CreateInferredBindSetter' .. path to file here ...

I am attaching my razor component for anyone to look at. This component works in the page on the website, but not in my test project. Can anyone please point out what I am doing wrong or missing?

UPDATE 1: I have found the offending line of code: <MudNumericField @bind-Value="_activeIndex" Label="Change ActiveIndex" @bind-Value:after="(() => _stepper.SetActiveStepByIndex(_activeIndex))" Variant="Variant.Outlined" Margin="Margin.Dense" /> I believe in .NET 6 it does not like the @bind-Value:After="......". I commented out that line for testing and it compiles but now I receive this runtime error: InvalidOperationException: Cannot provide a value for property 'ScrollManagerExtended' on type 'MudExtensions.MudListExtended`1[[MudBlazor.Size, MudBlazor, Version=6.5.0.0, Culture=neutral, PublicKeyToken=null]]'. There is no registered service of type 'MudExtensions.Services.IScrollManagerExtended'.

I have also created a new project using .NET 7 and the original code does compile, however, I do receive the same error as written above.

UPDATE 2: In my .NET 6 test app, I added builder.Services.AddMudServices(); to the Program.cs file. It now runs and the page load but it now throws an error in the console and the page does not behave correctly. I am attaching the file with the error details ( ConsoleError.txt )

Any help would be apprecitated.

Thanks, Jim MudStepperExample.txt ConsoleError.txt

mckaragoz commented 12 months ago

Did you completely setup extension package that reference css and js files like MudBlazor core package? If you have ScrollManagerExtended error, you probably didn't add the script. Readme file show how can we setup the library.

And yes bind-Something:after is net 7 feature, it doesn't work with net 6, nothing related to MudBlazor and MudExtensions. Our libraries both support net 6 and net 7.

And did you check AddMudExtensions method in program.cs?

jbenson001 commented 12 months ago

Hi @mckaragoz , Thank you for getting back to me so quickly. I did modify the Program.cs as in my second update. I was just going to update again as I have got this working. I just found the script and css file references as needed. I did go to the readme, but like a dummy, I did not scroll down enough. I now have all necessary code in place. It is very similar, if not the same as setting up MudBlazor. Again, thank you for the guidance. I wish I had just taken my time and looked more thoroughly. Now I will know how to do this when I set up the real project for production. Looking forward to checking out all of the extenions. Thanks again!!!

Jim

mckaragoz commented 11 months ago

We can close this issue now. If you have another issue please open again.