new Guid() creates the all-zero GUID, where Guid.NewGuid() was likely meant
What it finds
The parameterless constructor of Guid gives Guid.Empty, all zeros, like every struct's default value. Code that wants a fresh identifier calls Guid.NewGuid(); code that wants the empty one reads more clearly as Guid.Empty.
From the rule's source, empty_guid_created.rs.
using System; class Ids{ Guid Next() => new Guid();tx0 reports: new Guid() is the empty GUID Guid Fresh() => Guid.NewGuid(); Guid Parse(string s) => new Guid(s);} Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/csharp:empty-guid-created" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/csharp:empty-guid-created] reason="..."tx0 explain tx0/csharp:empty-guid-created shows the same in the terminal. Found a false positive? Report it.