Feature: Make [assembly: Attribute]
work with virtual methods that don't have an override
#222
Labels
[assembly: Attribute]
work with virtual methods that don't have an override
#222
Thank you for your great library! I am using it in my https://github.com/Jinjinov/BlazorWasmProfiler
Describe the solution you'd like
protected virtual void OnParametersSet()
is a method defined inMicrosoft.AspNetCore.Components.ComponentBase
.If I define
protected override void OnParametersSet()
in a.razor
file (Blazor component) then[assembly: Attribute]
works.I would like
[assembly: Attribute]
to work with every Blazor component (every Type derived fromMicrosoft.AspNetCore.Components.ComponentBase
) even if there is noprotected override void OnParametersSet()
in a.razor
file.Describe alternatives you've considered
I tried using a
Microsoft.CodeAnalysis.ISourceGenerator
to addprotected override void OnParametersSet()
to every Blazor component, but it is not possible to chain source generators. Because all source generators run in parallel, the Razor source generator that generates C# classes from razor files was running in parallel with my source generator (which tried to find types derived fromMicrosoft.AspNetCore.Components.ComponentBase
and could not find any).Additional context
I also tried using Mono.Cecil to add
protected virtual void OnParametersSet()
to the Blazor assembly, but changing the dll file in\bin\Debug\net7.0
doesn't help. Then I also tried changing the dll file in\bin\Debug\net7.0\wwwroot\_framework
but it still doesn't work. Then I tried changing the file in\obj\Debug\net7.0
but the build crashes.Do you have any suggestions how I can make it work?
The text was updated successfully, but these errors were encountered: