Conflicting "context" variables
Posted: 2/9/2023 9:12:44 PM
By: PrintableKanjiEmblem
Times Read: 599
0 Dislikes: 0
Topic: Programming: Blazor Server
Parent Message

Error: The child content element 'ChildContent' of component 'EditForm' uses the same parameter name ('context') as enclosing child content element 'Authorized' of component 'AuthorizeView'.

This is another weird one in Blazor Server 6.

When you wrap content containing an in an <Authorized> section, it turns out that both the <Authorized> element and the > element will try to create a variable named "context" and then bad things happen.

Easy fix, just add Context="Auth" to the <Authorized> element, like this: (Be aware that "Context" is case sensitive, so "context" will not work.)

Now get back to work! ;)

Rating: (You must be logged in to vote)