Configuration binder source generator emits unqualified List<T> when binding arrays without implicit usings
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- csharp
- 領域
- backend, build-system
調査の方向性
gen/Emitter/CoreBindingHelpers.csから始め、特に、issueで修飾されていない型List<T>を出力すると指摘されているEmitBindCoreImplForArrayを確認してください。暗黙のusingを無効にして、提供された再現コードをビルドし、生成されたBindingExtensions.g.csを調べて失敗を確認してください。グローバルusingディレクティブなしで配列のバインディングがコンパイルできれば完了です。また、#121364のテストでこのケースが見逃された理由も調査してください。
索引モデルが issue の本文から書いたものです。
説明
Description
The configuration binder source generator produces code that fails to compile when binding an array with implicit usings disabled.
This is a remaining case of #118630: #121364 qualified the generated HashSet<> references, but the temporary List<> used for array binding remains unqualified.
Reproduction Steps
Create these two files and run dotnet build.
repro.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net11.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<EnableConfigurationBindingGenerator>true</EnableConfigurationBindingGenerator>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Binder"
Version="11.0.0-rc.3.26522.148" />
</ItemGroup>
</Project>
Program.cs
using Microsoft.Extensions.Configuration;
new ConfigurationBuilder().Build().Get<int[]>();
Expected behavior
The generated code compiles without requiring global using directives from the consuming project.
Actual behavior
The build fails:
BindingExtensions.g.cs(66,29): error CS0246: The type or namespace name 'List<>' could not be found (are you missing a using directive or an assembly reference?)
The generated array-binding method contains:
var temp1 = new List<int>();
The generated file neither imports System.Collections.Generic nor fully qualifies this type.
Regression?
Not a new .NET 11 regression. The original example also fails with Binder 8.0.0, 9.0.0, and 10.0.14, where the unqualified HashSet<> reference causes a compilation error first. The .NET 11 fix removes that error but leaves this array-binding failure.
Known Workarounds
Enable implicit usings, or add:
global using System.Collections.Generic;
Other information
EmitBindCoreImplForArray in gen/Emitter/CoreBindingHelpers.cs emits new List<...>() directly. Fully qualifying that reference would address this case.
When investigating this, also consider looking into why testing of #121364 didn't find this issue.
[!NOTE]
This issue was drafted with GitHub Copilot assistance.
- 主要言語
- C#
- スター
- 18.4k
- フォーク
- 5.8k
- 平均マージ
- 2日 15時間
- マージ済み PR(30日)
- 596
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dotnet/runtime のほかの issue
-
area-Extensions-FileSystem untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
dotnet/runtime#136989 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[wasi] .NET 10: WasmEnableSIMD with AOT fails because WasiApp.targets has -msimd128 commented outオープンarea-Build-mono untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
area-System.ComponentModel untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
dotnet/runtime#136608 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
MemoryMappedFile (Windows): failed MEM_COMMIT is ignored, accessor over reserved memory crashes the process対応中かも @RutulPatel8 が 3 日前に担当しました。 オープンarea-System.IO bug untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
dotnet/runtime#136599 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area-System.IO untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
dotnet/runtime#136577 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
The Recommended preset turns on Import Uno DSP, which only works with the Material theme対応中かも @agneszitte が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
unoplatform/uno.templates#2388 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
eyalgolan/statecraft-israel#2732 ·
メンテナーはふだん 1 日以内に返信
-
要トリアージ
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
-
kind/chore status/draft
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
Altinn/altinn-events#1158 ·
メンテナーはふだん 1 日以内に返信
-
S: Untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
Trauma-Station/Trauma-Station#5285 ·
メンテナーはふだん 1 日以内に返信