dotnet / dotnet/dotnet-api-docs

XmlSerializer: Example in Dynamically Generated Assemblies uses not Recommended classes

Open
#8,747 2 comments 0 reactions 0 assignees View on GitHub
area-Serialization Pri3
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

The section ["Dynamically Generated Assemblies"](https://learn.microsoft.com/en-us/dotnet/api/system.xml.serialization.xmlserializer?view=net-7.0#dynamically-generated-assemblies) in the remarks section of the documentation for `XmlSerializer` uses the [not recommended](https://learn.microsoft.com/en-us/dotnet/api/system.collections.hashtable?view=net-7.0#remarks:~:text=Important-,We%20don%27t%20recommend,-that%20you%20use) class `Hashtable`.

Also I suggest that the documentation for the constructors (i.e. [this](https://learn.microsoft.com/en-us/dotnet/api/system.xml.serialization.xmlserializer.-ctor?view=net-7.0#system-xml-serialization-xmlserializer-ctor(system-type-system-xml-serialization-xmlrootattribute))) reiterates the info about the possible memory leak if not reused or at least link to the section mentioned above.

See [this](https://github.com/restsharp/RestSharp/issues/1988) as an example where this unclear documentation lead to a major memory leak in the popular RestSharp package.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.