-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataContractSerializer caches collectible types in statics #77877
Comments
Tagging subscribers to this area: @dotnet/area-system-collections Issue DetailsDescriptionThe AssemblyLoadContext of any type that has undergone data contract serialization cannot be unloaded / collected. The specific offender is DataContractCriticalHelper, which has a few static caches and also retains a reference to the most-recently-serialized type. Reproduction Steps
Expected behaviorUnloading and collecting results in proper collection of collectible types / assemblies / contexts. Actual behaviorCollectible types / assemblies / contexts that have been data contract serialised cannot be collected. Regression?No response Known WorkaroundsThe following code allows proper collection to occur:
Configuration.NET 6 Other informationNo response
|
Description
The AssemblyLoadContext of any type that has undergone data contract serialization cannot be unloaded / collected. The specific offender is DataContractCriticalHelper, which has a few static caches and also retains a reference to the most-recently-serialized type.
Reproduction Steps
Expected behavior
Unloading and collecting results in proper collection of collectible types / assemblies / contexts.
Actual behavior
Collectible types / assemblies / contexts that have been data contract serialised cannot be collected.
Regression?
No response
Known Workarounds
The following code allows proper collection to occur:
Configuration
.NET 6
macOS Ventura 13.0
ARM64
Other information
No response
The text was updated successfully, but these errors were encountered: