> ## Documentation Index
> Fetch the complete documentation index at: https://ancplua.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# AL0050 - Use empty-guid guard helper

> Use Guard.NotEmpty() instead of verbose if (guid == Guid.Empty) throw patterns

Source: [Al0050UseGuardNotEmptyGuidAnalyzer.cs](https://github.com/ANcpLua/ANcpLua.Analyzers/blob/main/src/ANcpLua.Analyzers/Analyzers/Al0050UseGuardNotEmptyGuidAnalyzer.cs)

## Description

Use `Guard.NotEmpty()` instead of verbose empty-GUID check and throw patterns.

## Bad Code

```csharp theme={null}
public void Load(Guid id)
{
    if (id == Guid.Empty)
        throw new ArgumentException("GUID cannot be empty", nameof(id));
}
```

## Good Code

```csharp theme={null}
public void Load(Guid id)
{
    Guard.NotEmpty(id);
}
```

## Properties

* **Category**: Roslyn Utilities
* **Severity**: Warning
* **Enabled by default**: True
* **Code fix available**: True

## Configuration

```editorconfig theme={null}
dotnet_diagnostic.AL0050.severity = warning
```
