Bug in framework/wcf/Basic/Contract/Data/NetDCSasDCSwithDCR/CS/DCSwithDCR/DCSwithDCR.cs
まだ誰も着手していません。
評価
調査の方向性
framework/wcf/Basic/Contract/Data/NetDCSasDCSwithDCR/CS/DCSwithDCR/DCSwithDCR.cs から始め、辞書フィールドと併せて MyDataContractResolver.TryResolveType() を確認します。意図した Dictionary がローカルでシャドーイングされずに使用されるようにサンプルを更新し、その後、.NET Framework サンプルがビルドでき、resolver の動作が引き続き正しいことを確認します。
索引モデルが issue の本文から書いたものです。
説明
Local variable dictionary or field dictionary?
In the MyDataContractResolver class in https://github.com/dotnet/samples/blob/main/framework/wcf/Basic/Contract/Data/NetDCSasDCSwithDCR/CS/DCSwithDCR/DCSwithDCR.cs, there is a field dictionary and there is also a local variable dictionary in the method TryResolveType(). So the field dictionary is never used. It seems to me that the original intent was to use the field dictionary and the local variable dictionary shouldn't have been there.
// DataContractResolver to be used by the DataContractSerializer
class MyDataContractResolver : DataContractResolver
{
private XmlDictionary dictionary = new XmlDictionary(); <-- Here **********
...
// Used at serialization
// Maps any Type to a new xsi:type representation
public override bool TryResolveType(Type type, Type declaredType, DataContractResolver knownTypeResolver, out XmlDictionaryString typeName, out XmlDictionaryString typeNamespace)
{
if (!knownTypeResolver.TryResolveType(type, declaredType, null, out typeName, out typeNamespace))
{
XmlDictionary dictionary = new XmlDictionary(); <-- And here **********
typeName = dictionary.Add(type.FullName);
typeNamespace = dictionary.Add(type.Assembly.FullName);
}
return true;
}
}
Note that the same code is also on this page - https://learn.microsoft.com/en-us/dotnet/framework/wcf/samples/datacontractserializer-datacontractresolver-netdatacontractserializer.
Target framework
Check the .NET target framework(s) being used, and include the version number(s).
- .NET Core
- .NET Framework
- .NET Standard
- 主要言語
- C#
- スター
- 3.7k
- フォーク
- 5.1k
- 平均マージ
- 19時間 47分
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dotnet/samples のほかの issue
-
dotnet-target-version
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
-
dotnet-target-version
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
dotnet-target-version
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
Race condition in orleans/ShoppingCart/Grains/InventoryGrain.cs#L48対応中かも @TimonPasslick が 160 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
dotnet-target-version
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
似ている issue
-
Audit by ear: boss warnings, other not-enough messages, ailments and barriers in a chapter 1 battleオープンenhancement needs-game ready-for-agent
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Sour-Dev-Home/metaphor-accessibility#1273 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
joinrpg/joinrpg-net#6336 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
muxinc/mux-csharp#88 ·
-
In-car displays show 0 km/h and P while the AV drives対応中かも @bazilinskyy が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
bazilinskyy/coupled-sim#366 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 3 日以内に返信