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
<PackageReference Include="Nall.Generator.Equals.Analyzers" Version="1.0.5"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="Nall.Generator.Equals.Analyzers" Version="1.0.5" />
<PackageReference Include="Nall.Generator.Equals.Analyzers"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add Nall.Generator.Equals.Analyzers --version 1.0.5
#r "nuget: Nall.Generator.Equals.Analyzers, 1.0.5"
#:package Nall.Generator.Equals.Analyzers@1.0.5
#addin nuget:?package=Nall.Generator.Equals.Analyzers&version=1.0.5
#tool nuget:?package=Nall.Generator.Equals.Analyzers&version=1.0.5
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:
License
This project is licensed under the MIT License - see the LICENSE file for details.
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.
# 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