Skip to content

Cannot compare Guid to Guid.Empty #1658

@dcyonce

Description

@dcyonce

Target name(s)

ESP32-S3

Firmware version

1.12.4.187

Was working before? On which version?

No response

Device capabilities

No response

Description

Cannot compare a Guid to Guid.Empty

None of the following work for various reasons. some are compile errors, some generate System.NullReferenceException: Exception was thrown: System.NullReferenceException

_CurrentTripGUID == Guid.Empty
_CurrentTripGUID.Equals(Guid.Empty)
_CurrentTripGUID.Equals((object)Guid.Empty
_CurrentTripGUID.CompareTo((object)Guid.Empty) == 0

We desperately need a method to see if a Guid is == Guid.Empty

How to reproduce

Try any of these lines of code

private static Guid _CurrentTripGUID;

_CurrentTripGUID == Guid.Empty
_CurrentTripGUID.Equals(Guid.Empty)
_CurrentTripGUID.Equals((object)Guid.Empty
_CurrentTripGUID.CompareTo((object)Guid.Empty) == 0

Expected behaviour

I would expect all of these lines to function:

_CurrentTripGUID == Guid.Empty
_CurrentTripGUID.Equals(Guid.Empty)
_CurrentTripGUID.CompareTo(Guid.Empty) = 0

Screenshots

No response

Aditional information

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions