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

Compile doesn't throw exceptions while configuring with attributes

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

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

評価

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

調査の方向性

[AdaptFrom] 設定から始め、Compile() 中に IMapFrom および ForType<Bar,Foo>() と比較します。RequireDestinationMemberSource を有効にして records の例を再現し、その後、欠落している Title メンバーがいつ検証されるかを追跡します。Compile() が属性設定に対して、他の 2 つの経路と同じ欠落メンバーエラーを報告すれば完了です。

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

説明

bug configuration problem

While im configuring with attributes

[AdaptFrom(typeof(Foo))]
public record Bar(string Title);
public record Foo(string Name);

These records are supposed to throw an error during Compile(), but it doesn't happen

TypeAdapterConfig.GlobalSettings.RequireDestinationMemberSource= true;
TypeAdapterConfig.GlobalSettings.Compile(); // successfull?? why??
var foo= new Foo("Name");
var bar= foo.Adapt<Bar>(); // Exception: corresponding source member mapped or ignored:Title

On the other hand, if I configure using an interface:
IMapFrom<Foo>
or utilize the method:
TypeAdapterConfig.GlobalSettings.ForType<Bar, Foo>();

In this scenario, everything works fine

TypeAdapterConfig.GlobalSettings.RequireDestinationMemberSource= true;
TypeAdapterConfig.GlobalSettings.Compile(); // Exception: corresponding source member mapped or ignored:Title

Why is this happening?
(lib: Mapster v7.4.0)

主要言語
C#
スター
5.2k
フォーク
411
平均マージ
1日 8時間
マージ済み PR(30日)
4

環境構築

はじめの一歩

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

MapsterMapper/Mapster のほかの issue

MapsterMapper/Mapster の issue をすべて見る

似ている issue

C# の issue をもっと見る

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

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