i am about to create a Base-Class for my Razor-Components. This Base-Class looks like:
public abstract class ExampleBase : ComponentBase
{
public virtual void Submit()
{
//DoSomething
}
public virtual void Back()
{
//DoSomething else
}
}
my Blazor-Component inherits from this class
@inherits ExampleBase
<button @onclick="Submit" />
So far so good, but when i start my App and this Page is about to Load then i receive an Exception:
[2020-09-29T12:09:03.920Z] Error: System.ArgumentException: The component type must implement Microsoft.AspNetCore.Components.IComponent. at Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.OpenComponent(Int32 sequence, Type componentType)
what is wrong on being inherited from ComponentBase ?
Thanks for your help
Addition: I call my Razor-Component like this and the Exception throws at builder.OpenComponent
RenderFragment CreateFragment() => builder =>
{
builder.OpenComponent(0, typeof(MyRazorComponent));
builder.CloseComponent();
}
Hope this helps