Blazor SSR error when rendermode is InteractiveAuto #57874
Labels
area-blazor
Includes: Blazor, Razor Components
Needs: Author Feedback
The author of this issue needs to respond in order for us to continue investigating this issue.
Status: No Recent Activity
Is there an existing issue for this?
Describe the bug
I am passing a model(s) as a parameter to an interactive component that is rendered on a SSR page and I experience different unexpected behaviors such as exceptions or parameter value reset. Read below for a better understanding.
The Component:
The model(s):
The usage on the page:
Ok: a model with the primary constructor; works as expected
NotOk: a model with 2 explicit constructors; throws an exception (see the Exceptions field below)
AnotherNotOk: a model with 3 explicit constructors, a fix for the
NotOk
; a default constructor was added because it fixes the exception thrown with theNotOk
; initially, the propertyValue
is correctly shown, however it gets reset after a bit (prerendering stuff?)Important
The exception is thrown only when there are more than 1 property in a model
Maybe 2 and 3 should be reported separately but I thought that they might be somehow related.
Expected Behavior
NotOk should not throw the exception. Why explicitly defined default contstuctor fixes the issue? Shouldn't it work without it since these are auto-generated under the hood anyway?
AnotherNotOk, as I said, "fixes" the
NotOk
but the propertyValue
gets reset which does not seem ok.Steps To Reproduce
Minimal reproduction project
Ok behavior:
Not Ok behavior:
Home.razor
Another Not Ok behavior:
Home.razor
Value
property dissappearsP.S. The exception message does not look good. #51749 (comment)
Exceptions (if any)
Error: One or more errors occurred. (Could not parse the parameter value for parameter '{definition.Name}' of type '{definition.TypeName}' and assembly '{definition.Assembly}'.)
.NET Version
8.0.304
Anything else?
Please tell me if you need more info.
Thanks!
The text was updated successfully, but these errors were encountered: