-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Make [assembly: Attribute]
work with virtual methods that don't have an override
#222
Comments
Sorry for delay, |
Third party NuGet Assembly1
My project Assembly2 MethodTimerAttribute.cs
Program.cs
Derived.cs
I would like that What I tried to do was to add |
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: