dotnet icon indicating copy to clipboard operation
dotnet copied to clipboard

`Guard.IsReferenceEqualTo` should accept `T?`

Open AlgorithmsAreCool opened this issue 5 months ago • 0 comments

Describe the bug

Currently it seems that Guard.IsReferenceEqualTo requires the parameters to be non-null. I believe the signature should be changed to permit nullable types because I believe that comparison to null values is a reasonable expectation and it is supported by the underlying call to object.ReferenceEquals

Regression

No response

Steps to reproduce

object x = null;
object y = new Object();

Guard.IsReferenceEqualTo(x,y); //produces CS8634

Expected behavior

No CS8634

Screenshots

No response

IDE and version

VS 2022 Preview

IDE version

No response

Nuget packages

  • [ ] CommunityToolkit.Common
  • [ ] CommunityToolkit.Diagnostics
  • [ ] CommunityToolkit.HighPerformance
  • [ ] CommunityToolkit.Mvvm (aka MVVM Toolkit)

Nuget package version(s)

8.2.2

Additional context

No response

Help us help you

Yes, I'd like to be assigned to work on this item

AlgorithmsAreCool avatar Sep 08 '24 13:09 AlgorithmsAreCool