dotnet / dotnet/roslyn

Quick fix for adding event handler does work in Blazor component

Open
#85,590 0 comments 0 reactions 0 assignees View on GitHub
Area-Razor
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

_This issue has been moved from [a ticket on Developer Community](https://developercommunity.visualstudio.com/t/Quick-fix-for-adding-event-handler-does-/10853238)._

---
[severity:It bothers me. A fix would be nice]
When adding an event handler for a timer, there is no quick fix shown to create the missing new handler. In the example below, I add an additional event handler XX:

protected override void OnInitialized()
{
AuthStateProvider.AuthenticationStateChanged += OnAuthenticationStateChanged;

_timer = new System.Timers.Timer(1000); // Set the interval to 1 second (1000 ms)
_timer.Elapsed += OnTimerElapsed;
_timer.AutoReset = true;
_timer.Enabled = true;
_timer.Elapsed += XX;
}

but when I do Ctrl . nothing happens. I should suggest creating another handler named XX.

---
### Original Comments

#### Feedback Bot on 2/19/2025, 05:48 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.