Nall.Generator.Equals.Analyzers 1.0.5

dotnet add package Nall.Generator.Equals.Analyzers --version 1.0.5
                    
NuGet\Install-Package Nall.Generator.Equals.Analyzers -Version 1.0.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Nall.Generator.Equals.Analyzers" Version="1.0.5">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nall.Generator.Equals.Analyzers" Version="1.0.5" />
                    
Directory.Packages.props
<PackageReference Include="Nall.Generator.Equals.Analyzers">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Nall.Generator.Equals.Analyzers --version 1.0.5
                    
#r "nuget: Nall.Generator.Equals.Analyzers, 1.0.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Nall.Generator.Equals.Analyzers@1.0.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Nall.Generator.Equals.Analyzers&version=1.0.5
                    
Install as a Cake Addin
#tool nuget:?package=Nall.Generator.Equals.Analyzers&version=1.0.5
                    
Install as a Cake Tool

Nall.Generator.Equals.Analyzers

A Roslyn analyzer for the Generator.Equals library that ensures proper equality attribute usage on collection properties.

Installation

dotnet add package Nall.Generator.Equals.Analyzers

Features

Diagnostics

  • GE001: Detects collection properties in [Equatable] classes that lack required equality attributes
  • GE002: Detects complex object properties in [Equatable] classes where the property type lacks [Equatable] attribute
  • GE003: Detects collection properties with complex element types that lack [Equatable] attribute on the element type

Code Fixes

  • Intelligent Attribute Suggestions: Provides collection-specific attribute recommendations:
    • List<T> / Array / IEnumerable<T>[OrderedEquality] or [UnorderedEquality]

Example Usage

GE001: Collection Properties Without Equality Attributes

// Before
[Equatable]
public partial class MyClass
{
    public List<string> Items { get; set; } // ⚠️ GE001: Missing equality attribute
}

// After
[Equatable]
public partial class MyClass
{
    [UnorderedEquality] // or [OrderedEquality]
    public List<string> Items { get; set; }
}

GE002: Complex Object Properties Without Equatable

// Before
[Equatable]
public partial class Person
{
    public Address HomeAddress { get; set; } // ⚠️ GE002: Type 'Address' needs [Equatable]
}

public class Address { /* ... */ }

// After
[Equatable]
public partial class Person
{
    public Address HomeAddress { get; set; } // ✅ No warning
}

[Equatable]
public partial class Address { /* ... */ }

GE003: Collection Element Types Without Equatable

// Before
[Equatable]
public partial class CustomerList
{
    [OrderedEquality]
    public List<Customer> Customers { get; set; } // ⚠️ GE003: Element type 'Customer' needs [Equatable]
}

public class Customer { /* ... */ }

// After
[Equatable]
public partial class CustomerList
{
    [OrderedEquality]
    public List<Customer> Customers { get; set; } // ✅ No warning
}

[Equatable]
public partial class Customer { /* ... */ }

Example of code fix suggestions: alternate text is missing from this package README image

License

This project is licensed under the MIT License - see the LICENSE file for details.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.5 3,497 11/27/2025
1.0.4 3,044 9/17/2025

# Release Notes

## Version 1.0.4 - 2025-09-17

### ✨ New Features
- **GE002 Diagnostic**: Detects complex object properties in `[Equatable]` classes where the property type lacks `[Equatable]` attribute
- **GE003 Diagnostic**: Detects collection properties with complex element types that lack `[Equatable]` attribute on the element type

### 🔧 Bug Fixes
- **Removed Dictionary and HashSet support** - These collection types are not actually supported by the Generator.Equals library
- **Removed DictionaryEquality and SetEquality attributes** - These attributes don't exist in the Generator.Equals library

### ✅ Supported Collection Types
- **Arrays**: `T[]`
- **Lists**: `List<T>`, `IList<T>`, `ICollection<T>`, `IEnumerable<T>`
- **Collections**: `Collection<T>`, `ObservableCollection<T>`

### ✅ Supported Equality Attributes
- `IgnoreEquality`, `DefaultEquality`, `SequenceEquality`
- `ReferenceEquality`, `OrderedEquality`, `UnorderedEquality`

---

## Version 1.0.3 - 2025-09-17

### 🎉 Initial Release
- **GE001 Diagnostic**: Detects collection properties in `[Equatable]` classes missing equality attributes
- **Basic Code Fix Provider**: Provides code fixes to add equality attributes