Skip to content

init accessor of CliAction.Terminating cannot be called in C# 7 #2213

@KalleOlaviNiemitalo

Description

@KalleOlaviNiemitalo

#2205 changed the CliAction.Terminating property from { get; protected set; } to { get; protected init; } here:

/// <summary>
/// Indicates that the action terminates a command line invocation, and later actions are skipped.
/// </summary>
public bool Terminating { get; protected init; } = true;

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:

#1586 was a similar issue about the init accessor of Option.Arity, fixed in #1595 by changing to set.

Metadata

Metadata

Assignees

Labels

Area-APIbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions