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

# AL0001 - Prohibit reassignment of primary constructor parameters

> Primary constructor parameters should not be reassigned

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

## Description

Primary constructor parameters should not be reassigned as this can lead to confusion and bugs.

## Bad Code

```csharp theme={null}
public class Service(ILogger logger)
{
    public void Reset() => logger = null;
}
```

## Good Code

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

## Properties

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

## Configuration

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