dotnet / dotnet/dotnet-api-docs

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

Aperta
#8,601 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
area-System.ServiceModel Pri3 untriaged
Lingua principale
C#
Stelle
949
Fork
1.7k
Merge medio
3g 27m
PR unite (30g)
49

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.