Fix resource stream for collectible assemblies
authorJan Vorlicek <janvorli@microsoft.com>
Thu, 28 Feb 2019 19:06:57 +0000 (20:06 +0100)
committerJan Vorlicek <janvorli@microsoft.com>
Thu, 28 Feb 2019 19:06:57 +0000 (20:06 +0100)
commit5fcc6f14e1197c313edc3673ad67f6af26c2199e
tree7638796334bb901888b2f0cd5fecae1e49811b8b
parent12167a75fc494deb8040fa3a04961ca5f10d14aa
Fix resource stream for collectible assemblies

The GetManifestResourceStream was returning a stream that didn't keep
the underlying assembly alive. For collectible assemblies, that means
that an assembly could be collected and the stream still kept,
potentially reading garbage.

The fix is to create a new stream type that stores a reference to the
underlying assembly, thus ensuring the proper lifetime management.
src/System.Private.CoreLib/src/System/Reflection/RuntimeAssembly.cs
tests/src/Regressions/coreclr/GitHub_22888/test22888.cs [new file with mode: 0644]
tests/src/Regressions/coreclr/GitHub_22888/test22888.csproj [new file with mode: 0644]
tests/src/Regressions/coreclr/GitHub_22888/test22888.resx [new file with mode: 0644]
tests/src/Regressions/coreclr/GitHub_22888/test22888resources.cs [new file with mode: 0644]
tests/src/Regressions/coreclr/GitHub_22888/test22888resources.csproj [new file with mode: 0644]