Namespace clash in generated handler
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 67/100
調査の方向性
Start by locating the source generator that emits <Class>_<Method>_Generated.g.cs for Amazon.Lambda.Annotations and inspect how it writes parameter type names. Reproduce the namespace clash with the attached AnnotationsNamespaceClash.zip sample and run dotnet build; done when generated code uses globally qualified names and the sample builds without CS0234.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
Generated handler doesn't use global:: for type names: build fails with CS0234 when a sibling namespace shadows the root namespace
The generated handler (<Class>_<Method>_Generated.g.cs) refers to parameter types by their
namespace-qualified name without a global:: prefix. The generated class is declared inside the handler's own
namespace, so if a namespace with the same first segment exists alongside it, C# name lookup stops at that
namespace and never reaches the top-level one. The result is CS0234 in generated code that the user cannot edit.
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
Generated code compiles regardless of which other namespaces exist. Emitting fully qualified global:: names for
every type in the generated file avoids the problem. The generator already emits some types with full names
(Amazon.Lambda.Core.ILambdaContext, Amazon.Lambda.SQSEvents.SQSEvent); they are only safe because nobody has an
Acme.Amazon namespace. The same bug applies to any root namespace.
Current Behavior
Build fails with error: error CS0234: The type or namespace name 'Lambda' does not exist in the namespace 'Acme.Common' (are you missing an assembly reference?)
The generated class is in namespace Acme.EventDistributor.Trigger. Resolving Common there searches
Acme.EventDistributor.Trigger, Acme.EventDistributor, Acme, and only then the global namespace. It finds
Acme.Common and stops, so Common.Lambda is looked up inside Acme.Common and fails.
In general, with a handler in A.B.C and a [FromServices] type in X.Y, the build breaks if A.X or A.B.X
exists without a matching Y below it.
Reproduction Steps
Run dotnet build for attached sample project AnnotationsNamespaceClash.zip
Possible Solution
Update source generator to emit fully qualified global:: names for all types referenced in generated code.
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
Amazon.Lambda.Annotations v 2.4.1
Targeted .NET Platform
.NET SDK 10.0.401, net10.0
Operating System and version
Windows 11
- 主要言語
- C#
- スター
- 1.7k
- フォーク
- 505
- 平均マージ
- 2日 9時間
- マージ済み PR(30日)
- 9
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
aws/aws-lambda-dotnet のほかの issue
-
bug module/aspnetcore-support p2 queued
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
aws/aws-lambda-dotnet#1123 · コメント 4 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
feature-request needs-triage
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
aws/aws-lambda-dotnet#2588 ·
メンテナーはふだん 1 日以内に返信
-
Generated XML doc `cref` contains unescaped generic arguments: CS1584 / CS1658 / CS1570 warnings対応中かも @reginaldalfret が 5 日前に担当しました。 オープンbug needs-triage
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
aws/aws-lambda-dotnet#2587 ·
メンテナーはふだん 1 日以内に返信
-
feature-request p2
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
aws/aws-lambda-dotnet#2551 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
JSON log format pairs ILogger message template placeholders with state values by position, garbling ASP.NET Core hosting logs対応中かも @Pybsama が 76 日前に担当しました。 オープンbug investigating p2
難易度 3/5 1〜2日 初心者へのやさしさ 70/100
aws/aws-lambda-dotnet#2468 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
aws/aws-lambda-dotnet の issue をすべて見る
似ている issue
-
documentation
難易度 1/5 1〜3時間 初心者へのやさしさ 62/100
-
bug misleading tooling trivial
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
Docs example projects pinned to a literal library version instead of 3.*対応中かも @DaveSkender が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
facioquo/stock-indicators-dotnet#2372 ·
メンテナーはふだん 1 日以内に返信
-
[Docs] officecli-docx SKILL.md still describes `\n` as a soft line break after #262対応中かも @giprime が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
Facepunch/sbox-public#12097 ·
メンテナーはふだん 2 日以内に返信