Skip to content

[StyleCleanUp] Use is null check (IDE0041) #10613

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

h3xds1nz
Copy link
Member

@h3xds1nz h3xds1nz commented Mar 21, 2025

Fixes #10612

Description

Avoids using ReferenceEquals to check each object and uses is null check instead.

  • In case of WeakRefKey and DpiScale, the boxing casts are removed as they're both non-nullable structs.

Customer Impact

Cleaner codebase for developers, should reduce some boxes and branches.

Regression

No.

Testing

Local testing/build.

Risk

Should be low, mostly analyzer fixes but I did adjust some to remove double-checks on the same field.

Microsoft Reviewers: Open in CodeFlow

@h3xds1nz h3xds1nz requested review from a team as code owners March 21, 2025 21:40
@dotnet-policy-service dotnet-policy-service bot added PR metadata: Label to tag PRs, to facilitate with triage Community Contribution A label for all community Contributions labels Mar 21, 2025
Copy link

codecov bot commented Mar 21, 2025

Codecov Report

Attention: Patch coverage is 0% with 16 lines in your changes missing coverage. Please review.

Project coverage is 11.71271%. Comparing base (b6914d7) to head (e1cee12).

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #10613         +/-   ##
===================================================
+ Coverage   11.45872%   11.71271%   +0.25398%     
===================================================
  Files           3214        3214                 
  Lines         648458      648398         -60     
  Branches       71511       71501         -10     
===================================================
+ Hits           74305       75945       +1640     
+ Misses        572989      571199       -1790     
- Partials        1164        1254         +90     
Flag Coverage Δ
Debug 11.71271% <0.00000%> (+0.25398%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Contribution A label for all community Contributions PR metadata: Label to tag PRs, to facilitate with triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IDE0041: Use 'is null' check
1 participant