> ## 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.

# AL0006 - Field name conflicts with primary constructor parameter

> Field names should not conflict with primary constructor parameters

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

## Description

Field names should not conflict with primary constructor parameters to avoid shadowing and confusion.

## Bad Code

```csharp theme={null}
public class Service(ILogger logger)
{
    private ILogger logger;
}
```

## Good Code

```csharp theme={null}
public class Service(ILogger logger)
{
    private ILogger _logger = logger;
}
```

## Properties

* **Category**: Design
* **Severity**: Warning
* **Enabled by default**: True
* **Code fix available**: False

## Configuration

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