BenMorris / NetArchTest

A fluent API for .Net that can enforce architectural rules in unit tests.
MIT License
1.41k stars 83 forks source link

Immutability check does not work with C#9 init-only properties #138

Open GregoireWulliamoz-eaton opened 10 months ago

GregoireWulliamoz-eaton commented 10 months ago

In C#9, init only properties were introduced. It's now heavily used through record. We can consider those properties as immutable.

Unfortunately, this case is not detected through BeImmutable() function.

This feature is not available out of the box in .NET Standard 2.0, 2.1 nor Mono. There is an existing hack to make this feature available but I am worried about how it would behave as a Nuget package.

I would be happy to contribute if you have any proposition to guide me.