Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Properties generated from private fields do not conflict/trigger CS0108 or any other warning

オープン
#1,092 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
csharp
領域
tooling

調査の方向性

ObservableProperty のソースジェネレーター実装から始めて、その診断または警告のテストを見つけ、issue の TypeA/TypeB の例を再現します。private フィールドから生成されたプロパティが継承をまたいでどのようにチェックされるかを確認し、CS0108 のような明確な隠蔽診断、または MVVM 固有の警告が生成されれば、報告されたケースは完了とみなします。

索引モデルが issue の本文から書いたものです。

説明

bug :bug:
Describe the bug

Given two types, where one is derived from the other, adding a private field to the derived type with the same name as a private field on the base type will generate a property on each type's generated partial definition. Because code analysis is disabled on these generated files, no indication is given that the property on the derived type is hiding the property on the base type.

Regression

No response

Steps to reproduce

The following code should demonstrate the problem:

public class TypeA : ObservableObject
{
    [ObservableProperty]
    private bool _someField; // will generate TypeA.SomeField
}

public class TypeB : TypeA
{
    [ObservableProperty]
    private bool _someField; // will generate TypeB.SomeField, hiding TypeA.SomeField
}
Expected behavior

Some indication should be given that TypeB._someField causes hiding of the property generated for TypeA, either CS0108 on the field or some MVVM specific warning that explains exactly what is happening.

Screenshots

No response

IDE and version

VS 2022

IDE version

17.13.6

Nuget packages
  • CommunityToolkit.Common
  • CommunityToolkit.Diagnostics
  • CommunityToolkit.HighPerformance
  • CommunityToolkit.Mvvm (aka MVVM Toolkit)
Nuget package version(s)

8.4.0

Additional context

No response

Help us help you

No, just wanted to report this

主要言語
C#
スター
3.8k
フォーク
401
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

CommunityToolkit/dotnet のほかの issue

CommunityToolkit/dotnet の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。