Closed LesF closed 2 months ago
I'm also facing the same issue, I've followed the steps from last chapter in the book and the WASM online chapter here in github but the Wasm assembly is not finding the Interactive pages and failing with this error:
Error: One or more errors occurred. (Root component type 'Northwind.Blazor.Components.Pages.CreateCustomer' could not be found in the assembly 'Northwind.Blazor'.)
at Jn (marshal-to-js.ts:349:18)
at xl (marshal-to-js.ts:306:28)
at 00b217ca:0x1fa8f
at 00b217ca:0x1bf5a
at 00b217ca:0xf141
at 00b217ca:0x1e7a9
at 00b217ca:0x1ef9f
at 00b217ca:0xcfbb
at 00b217ca:0x4412f
at e.<computed> (cwraps.ts:338:24)
I've searched in google without any luck on how to fix this, this is the repo with the code https://github.com/batusai513/dotnet-learn/tree/main/cs12dotnet8/PracticalApps/Northwind.Blazor
I'm not having much luck with this either. I added the FormName attribute to the EditForm in CustomerDetail.razor (the FormName is a requirement for EditForm, and @formname is required for a plain html form).
Deleting a customer is working, but editing or creating a customer does not work. When trying to create a customer, I am getting client-side validation errors for the customerId and customername.
I apologise for not getting to this sooner. I have been busy working on final drafts for my next book, Tools and Skills for .NET8. This weekend I should be (finally!) done with that, so I'll then have time to properly look at this issue. I've already gone through the print book Chapter 15 and fixed some minor errata. Next, I'll review the online client-side section. Thank you for your patience.
I'm sure we all appreciate your help with this. Thanks!
Still waiting for some action on this a month later.
I have updated the online section with new instructions and made the same changes to the PracticalApps
solution code in the Northwind.WebApi
, Northwind.Blazor
, and Northwind.Blazor.Wasm
projects. This should fix the problems.
https://github.com/markjprice/cs12dotnet8/blob/main/docs/ch15-blazor-wasm.md
Not sure if I have missed a step, but when I followed the online blazor-wasm chapter, posting create or update forms gives the error:
The POST request does not specify which form is being submitted. To fix this, ensure <form> elements have a @formname attribute with any unique value, or pass a FormName parameter if using <EditForm>.
So I added a parameter to CustomerDetail.razor to set formname. After that, the browser console shows errors when loading the customer list and clicking the link to edit a row. The dotnot resources loaded message shows, then it gives:
The edit form displays, I assume it gets it from the server. If I make a change and submit, no changes are saved and there are no errors shown. If I open the create form and submit I get:
InvalidOperationException: Unable to track an entity of type 'Customer' because its primary key property 'CustomerId' is null.
I can provide the errors from the browser console if needed, if there isn't an obvious mistake I have made configuring the project for wasm.