Error opening Edit page as page (not dialog)

Hello Radzen Team,
in my App the Click an a Row in Datagrid doesnt show the Edit Page any more.
I tested it with a newly generated app and it doesnt work there either:

error opening edit page

can you help please?

Kind Regards
Thomas

This appears too in Version 2.44.3. Perhaps in earlier Versions too. i realized it in 2.44.3

I found this error in my page:

And this in VS 2019
Microsoft.AspNetCore.Authorization.DefaultAuthorizationService: Information: Authorization was successful.
Ausnahme ausgelöst: "Microsoft.CSharp.RuntimeBinder.RuntimeBinderException" in Trent.dll
Ausnahme ausgelöst: "Microsoft.CSharp.RuntimeBinder.RuntimeBinderException" in System.Private.CoreLib.dll
Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer: Warning: Unhandled exception rendering component: The best overloaded method match for 'Trent.TrentdbService.GetArtikelByArtikelId(int?)' has some invalid arguments

Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: The best overloaded method match for 'Trent.TrentdbService.GetArtikelByArtikelId(int?)' has some invalid arguments
at CallSite.Target(Closure , CallSite , TrentdbService , Object )
at Trent.Pages.EditArtikelComponent.Load() in C:\Users\Thomas\source\repos\trent\server\Pages\EditArtikel.razor.designer.cs:line 128
at Trent.Pages.EditArtikelComponent.OnInitializedAsync() in C:\Users\Thomas\source\repos\trent\server\Pages\EditArtikel.razor.designer.cs:line 120
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit 'iG845ELxg1qAI1-dDfZ2uJJuYCdYJQS4pTKIOk4A9x8'.

Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: The best overloaded method match for 'Trent.TrentdbService.GetArtikelByArtikelId(int?)' has some invalid arguments
at CallSite.Target(Closure , CallSite , TrentdbService , Object )
at Trent.Pages.EditArtikelComponent.Load() in C:\Users\Thomas\source\repos\trent\server\Pages\EditArtikel.razor.designer.cs:line 128
at Trent.Pages.EditArtikelComponent.OnInitializedAsync() in C:\Users\Thomas\source\repos\trent\server\Pages\EditArtikel.razor.designer.cs:line 120
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer: Warning: Unhandled exception rendering component: Cannot access a disposed object.

System.ObjectDisposedException: Cannot access a disposed object.
at Microsoft.AspNetCore.Components.RenderTree.ArrayBuilder1.ThrowObjectDisposedException() at Microsoft.AspNetCore.Components.RenderTree.ArrayBuilder1.GrowBuffer(Int32 desiredCapacity)
at Microsoft.AspNetCore.Components.RenderTree.ArrayBuilder1.Append(T[] source, Int32 startIndex, Int32 length) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InsertNewFrame(DiffContext& diffContext, Int32 newFrameIndex) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForFramesWithSameSequence(DiffContext& diffContext, Int32 oldFrameIndex, 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.AppendDiffEntriesForFramesWithSameSequence(DiffContext& diffContext, Int32 oldFrameIndex, 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.AppendDiffEntriesForFramesWithSameSequence(DiffContext& diffContext, Int32 oldFrameIndex, 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.AppendDiffEntriesForFramesWithSameSequence(DiffContext& diffContext, Int32 oldFrameIndex, 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, ArrayRange1 oldTree, ArrayRange`1 newTree)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit 'iG845ELxg1qAI1-dDfZ2uJJuYCdYJQS4pTKIOk4A9x8'.

System.ObjectDisposedException: Cannot access a disposed object.
at Microsoft.AspNetCore.Components.RenderTree.ArrayBuilder1.ThrowObjectDisposedException() at Microsoft.AspNetCore.Components.RenderTree.ArrayBuilder1.GrowBuffer(Int32 desiredCapacity)
at Microsoft.AspNetCore.Components.RenderTree.ArrayBuilder1.Append(T[] source, Int32 startIndex, Int32 length) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InsertNewFrame(DiffContext& diffContext, Int32 newFrameIndex) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForFramesWithSameSequence(DiffContext& diffContext, Int32 oldFrameIndex, 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.AppendDiffEntriesForFramesWithSameSequence(DiffContext& diffContext, Int32 oldFrameIndex, 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.AppendDiffEntriesForFramesWithSameSequence(DiffContext& diffContext, Int32 oldFrameIndex, 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.AppendDiffEntriesForFramesWithSameSequence(DiffContext& diffContext, Int32 oldFrameIndex, 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, ArrayRange1 oldTree, ArrayRange`1 newTree)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
Microsoft.AspNetCore.Routing.EndpointMiddleware: Information: Executed endpoint '/_blazor'
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 44526.3659ms 101
Der Thread 0x5338 hat mit Code 0 (0x0) geendet.

cant find out what the problem is...

I was able to reproduce the problem. Fix is expected with next update.

Great! Thank you!

Thomas

Hello enchev,
there are 2 new versions and the error remains.
Will it be fixed in the next version?
I cant work with my app because i open all edit page as pages and not dialogs :slight_smile:

Regards
Thomas

You will need to regenerate your pages. The fix was released.

Hello enchev,
how can i regenerate the pages without loosing all the settings i have made in the pages. Events, Layout, ect. ?

You cannot. Option is to create new pages to check what code is used to convert the page parameter to proper type and use the same approach in your pages.

This means a must generate the Pages again with "override existing pages" and do all changes i have done to the generated pages again??

No, what I suggested is to use the same approach that is used by the new Radzen version.

Hello enchev,
i have generated a new page from entity "einheit". But it doesnt work. I cant save from the edit page.

Video

And when i try to create a page with "open add/edit in dialogs" there appears an error:

Video

You can debug the application to see why it’s not working.

Hello enchev,
i tried to debug this. But i created a new page. and then it doesnt work.

The only thing that comes up is this:

Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request starting HTTP/1.1 GET http://localhost:5000/_content/Radzen.Blazor/fonts/SourceSansPro-Bold.woff  
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware: Information: The file /_content/Radzen.Blazor/fonts/SourceSansPro-Bold.woff was not modified
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 15.1504ms 304 application/font-woff
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request starting HTTP/1.1 GET http://localhost:5000/_content/Radzen.Blazor/fonts/MaterialIcons-Regular.woff  
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware: Information: The file /_content/Radzen.Blazor/fonts/MaterialIcons-Regular.woff was not modified
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 12.3086ms 304 application/font-woff
Microsoft.AspNetCore.Authorization.DefaultAuthorizationService: Information: Authorization was successful.
"iisexpress.exe" (CoreCLR: clrhost): "C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.2\Microsoft.CSharp.dll" geladen. Das Laden von Symbolen wurde übersprungen. Das Modul ist optimiert, und die Debugoption "Nur eigenen Code" ist aktiviert.
Microsoft.EntityFrameworkCore.Database.Command: Information: Executed DbCommand (27ms) [Parameters=[@__einheitId_0='?' (DbType = Int32)], CommandType='Text', CommandTimeout='30']
SELECT TOP(1) [e].[EinheitId], [e].[Bezeichnung], [e].[Kurzbezeichnung], [e].[aktiv]
FROM [dbo].[Einheit] AS [e]
WHERE [e].[EinheitId] = @__einheitId_0
Ausnahme ausgelöst: "Microsoft.CSharp.RuntimeBinder.RuntimeBinderException" in System.Linq.Expressions.dll

What can i do against this? It is a created page without any changes. Create page...CRUD Page... Starting app and i cant save from the edit page.

Please give me a hint what i can have done wrong...

Regards
Thomas

PS: I know i have a community version and no claim to support. But i think this is a simply a bug in radzen?! What can i do wrong if i only create a page and start the app?

The error is here:

    protected async System.Threading.Tasks.Task Form0Submit(Trent.Models.Trentdb.Einheit args)
    {
        try
        {
            var trentdbUpdateEinheitResult = await Trentdb.UpdateEinheit(**EinheitId**, einheit);
            UriHelper.NavigateTo("einheit-new");
        }
        catch (Exception trentdbUpdateEinheitException)
        {
                NotificationService.Notify(NotificationSeverity.Error, $"Error", $"Unable to update Einheit");
        }
    }

The generated call to updateEinheit must be

Trentdb.UpdateEinheit(Convert.ChangeType(EinheitId, Type.GetTypeCode(typeof(int))), einheit);

not

Trentdb.UpdateEinheit(EinheitId, einheit);

The dynamic type "EinheitId" is Type string at runtime which cannot be converted to "int?" for the Update method. No idea why it is string...

I wonder that noone else has this problem...

Thomas

Hello radzen team,
is it right that this problem can only be fixed with a new radzen version?
if yes... can you give me a note when this will be fixed?

Kind regards
Thomas

P.S: im kind of irritated that no one other has this problem. thats the reason for my question that this problem can only be fixed with a new radzen version

As I’ve replied yesterday - the problem is already fixed in our new templates. You have two options:

  • regenerate your CRUD pages to get the fix. In this case you will loose your changes in these pages.
  • manually change your pages (Edit page particularly) to use the same approach as in our latest Radzen version.

I have nothing more to add to this discussion and I’l lock this thread.