commandlineparser / commandlineparser/commandline

Treat .NET 7 `required` properties as actually required by default

未關閉
#862 4 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
C#
星號
4.8k
分支
478
PR 合併指標
30 天內沒有已合併 PR

描述

**Code snippet:**
```cs
public class Options
{
[Option]
public required int Port { get; init; }

[Option]
public required string Server { get; init; }
}
```

**Expected behaviour:** Both `Port` and `Server` are required and the parsing fails if at least on of them is not present.

**Actual behaviour:** They are not required, I still have to specify `[Option(Required = true)]` in order for it to work

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

Start by tracing how [Option] properties are inspected and how their Required setting is inferred, paying attention to the .NET 7 required properties shown in the issue. Add regression coverage for missing Port and Server values, and verify that parsing fails without an explicit Required setting while existing option behavior remains unchanged.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
csharp
領域
cli
Issue 類型
功能
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。