Skip to content

System.Text.Json should support unloadable assemblies correctly #65323

@eiriktsarpalis

Description

@eiriktsarpalis

I think this should make the cache work reasonably well with collectible assemblies, but it's hard to tell for sure. Could you please add a test which:

  • Creates a new unloadable ALC and loads some assembly with test types into it
  • Serializes/deserializes objects of the types from the assembly above
  • Unloads the ALC
  • Validates that the ALC was actually unloaded

Good guide what to do is here: https://docs.microsoft.com/en-us/dotnet/standard/assembly/unloadability

In short what we want to avoid:
Global GC root which holds onto anything from unloadable ALCs as that will prevent the ALC from unloading. We already have quite a few caches in the FX which do this, so let's not add another one.

Originally posted by @vitek-karas in #64646 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions