Skip to content

Potential fix for code scanning alert no. 2: Reference equality test on System.Object - #35

Merged
Seramis merged 1 commit into
mainfrom
alert-autofix-2
Nov 22, 2026
Merged

Seramis merged 1 commit into
mainfrom
alert-autofix-2

Conversation

@Seramis

@Seramis Seramis commented Nov 22, 2026

Copy link
Copy Markdown
Member

Potential fix for https://github.com/ByteAether/WeakEvent/security/code-scanning/2

Use explicit reference comparison via ReferenceEquals in Matches instead of == for object? operands.

Best single fix (no functionality change):

  • File: src/WeakEvent/WeakEventHandler.cs
  • Update line 84 expression from _weakTarget?.Target == handler.Target to ReferenceEquals(_weakTarget?.Target, handler.Target).
  • No new imports or helper methods are needed (ReferenceEquals is available from object).

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…on System.Object

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@Seramis Seramis self-assigned this Nov 22, 2026
@Seramis Seramis added the bug Something isn't working label Nov 22, 2026
@Seramis
Seramis marked this pull request as ready for review November 22, 2026 17:41
@Seramis
Seramis merged commit f362a8e into main Nov 22, 2026
3 checks passed
@Seramis
Seramis deleted the alert-autofix-2 branch November 22, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant