dbolin / Apex.Analyzers

Roslyn powered analyzers for C# to support convention defined architecture
MIT License
15 stars 2 forks source link

C# 9 Init-only property setters trigger IMM002 #57

Closed mwelsh1118 closed 3 years ago

mwelsh1118 commented 3 years ago

The following auto-property will trigger IMM002, even though the property is immutable after the object is initialized:

public int Property { get; init; }

I can look at creating a Pull Request to address this if you'd like.

dbolin commented 3 years ago

This is fixed in version 1.2.6, and adds another analyzer to catch 'this' reference escaping in the body of an init only property method.

mwelsh1118 commented 3 years ago

Confirmed. Thanks for the quick turnaround!