Guid empty string comparison (PC0015)

When checking if a Guid is empty, do not compare it to an empty string. Use IsNullGuid() instead, or compare against a Guid variable initialized to the empty Guid value.

A code fix is available for this diagnostic.

Example

The following code incorrectly compares a Guid to an empty string:

codeunit 50100 MyCodeunit
{
    procedure CheckGuid(MyGuid: Guid)
    begin
        if Format(MyGuid) = '' then // Guid empty string comparison [PC0015]
            Error('Guid is empty');
    end;
}

To fix this, use IsNullGuid:

codeunit 50100 MyCodeunit
{
    procedure CheckGuid(MyGuid: Guid)
    begin
        if IsNullGuid(MyGuid) then
            Error('Guid is empty');
    end;
}