`init` accessor of CliAction.Terminating cannot be called in C# 7
KalleOlaviNiemitalo opened this issue · 0 comments
KalleOlaviNiemitalo commented
#2205 changed the CliAction.Terminating property from { get; protected set; } to { get; protected init; } here:
command-line-api/src/System.CommandLine/Invocation/CliAction.cs
Lines 15 to 18 in 104bb34
The init accessor cannot be directly called in C# 7; it requires at least C# 9. That makes the property difficult to initialize in these cases:
- When targeting .NET Framework, where Microsoft does not support C# 8.
- When the application must remain buildable in Visual Studio 2017 (whose support ends in April 2027).
#1586 was a similar issue about the init accessor of Option.Arity, fixed in #1595 by changing to set.