Open
Description
Known Issue
There is a known issue that the Razor compiler generates uncompilable C# when specifying a @rendermode
on a Razor component that also uses the @typeparam
directive.
Symptoms
When specifying both @rendermode
and @typeparam
in a Razor component, the user will receive error similar to CS0305: Using the generic type 'Component<T>' requires '1' type arguments.
Workarounds
A user can specify the rendermode manually via the @attribute
directive.
@attribute [type: RenderModeInteractiveServer]
EDIT: The attribute class needs to be also created as well since it did not ship in .NET after all:
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
class RenderModeInteractiveServer : RenderModeAttribute
{
public override IComponentRenderMode Mode => RenderMode.InteractiveServer;
}
Planned Fix
At this time, there is no fix planned, as it is believed to affect a small number of users. If you are experiencing this issue, please upvote this issue to help us prioritize this.
A compiler update with a clearer error is planned.
Activity