Skip to content

Conversation

@apachezy
Copy link
Contributor

@apachezy apachezy commented Dec 13, 2025

Pull request type

Please check the type of change your PR introduces:

  • Update
  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes

What is the current behavior?

In the current implementation, the TitleBar window procedure always creates a new HwndProcEventArgs object for each window message—even when there are no subscribers to the WndProcInvoked event. This results in unnecessary object allocations and performance overhead, particularly during high-frequency message processing.

Issue Number: N/A

What is the new behavior?

The TitleBar now checks whether any handlers are attached to the WndProcInvoked event before instantiating the HwndProcEventArgs. If no subscribers are present, the event argument object is not created, eliminating the associated allocation cost. This change is transparent to existing API consumers and does not affect any functional behavior.

Other information

@github-actions github-actions bot added controls Changes to the appearance or logic of custom controls. PR Pull request dotnet release titlebar Titlebar updates labels Dec 13, 2025
@apachezy apachezy changed the title fix(controls): fix unconditional HwndProcEventArgs creation in TitleBar window procedure fix(controls): Fix unconditional HwndProcEventArgs creation in TitleBar window procedure Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

controls Changes to the appearance or logic of custom controls. dotnet PR Pull request release titlebar Titlebar updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant