dotnet / dotnet/dotnet-api-docs

MessageProperties.Item[string] can throw, but documentation claims null is returned

オープン
#8,601 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
area-System.ServiceModel Pri3 untriaged
主要言語
C#
スター
949
フォーク
1.7k
平均マージ
2日 19時間
マージ済み PR(30日)
52

説明

In the documentation for `MessageProperties.Item[string]`, it is claimed that:

> The property with the specified name, or null if the property does not exist.

This is incorrect. The code will throw an exception if the property does not exist. This is not mentioned in the documentation.

Rendered documentation:
https://learn.microsoft.com/en-us/dotnet/api/system.servicemodel.channels.messageproperties.item?view=dotnet-plat-ext-6.0&viewFallbackFrom=net-6.0#system-servicemodel-channels-messageproperties-item(system-string)

Documentation source:
https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.ServiceModel.Channels/MessageProperties.xml

dotnet/wcf source code:
https://github.com/dotnet/wcf/blob/4e2a97e639417fd14158c9e7f0bb36de342a667d/src/System.Private.ServiceModel/src/System/ServiceModel/Channels/MessageProperties.cs#L73

4.8 reference source has the same behaviour:
https://referencesource.microsoft.com/#System.ServiceModel/System/ServiceModel/Channels/MessageProperties.cs,67

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

xml/System.ServiceModel.Channels/MessageProperties.xml を開き、MessageProperties.Item[string] のドキュメントを見つけます。記載されている動作を、リンク先の MessageProperties.cs の実装と比較します。プロパティが存在しない場合の動作を説明するようにドキュメントを更新し、その後、レンダリングされた戻り値のテキストが実装と一致することを確認します。

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

評価

技術スタック
csharp
領域
documentation
issue の種類
ドキュメント
難易度
1/5
見積もり時間
1時間未満
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
42/100

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

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