Add System.Resources.Extensions (dotnet/corefx#36906)
authorEric StJohn <ericstj@microsoft.com>
Fri, 26 Apr 2019 05:05:19 +0000 (22:05 -0700)
committerJan Kotas <jkotas@microsoft.com>
Sat, 27 Apr 2019 12:09:40 +0000 (05:09 -0700)
commitae6c7a9a7ddfa43f30450fa4085d952a1aaf3723
treec53182323a4bf8cbca4197c59022dfd1c8d9c1ab
parenta011bafd661919f67eff1532563ce95f2f57ce19
Add System.Resources.Extensions (dotnet/corefx#36906)

* Add System.Resources.Binary.Reader|Writer

* Fix ResourceWriter tests

* Test fixes and PR feedback

* More test fixes

* Add packages for System.Resources.Binary.*

* Suppress duplicate types in System.Resources.Binary.*

* Test refactoring and adding RuntimeResourceSet

It turns out me must have our own ResourceSet since the CoreLib resource set doesn't
expose a constructor that takes an IResourceReader.

I've shared the code since it does a bit of non-trivial caching.

* Don't use auto-property initializers for platfrom sensitive test data

For some reason I thought these lazy-initialized the properties but they don't.

As a result we were hitting the platform sensitive code even when we never
called the getter.  Switch to an expression instead.

* Only use Drawing converters on Windows

* Fix test failures

* Don't leak System.Private.CoreLib into resources

* Make sure RuntimeResourceSet doesn't call ResourceReader(IResourceReader)

* WIP

* Rename types in System.Resources.Extensions

Leave RuntimeResourceSet internal as it doesn't need to be public.

* Update packages

* Respond to API review feedback

Remove abstraction for ResourceReader/Writer: just reuse the source.

Remove non-essential members.

* Clean up

* Further cleanup

* Further cleanup

* Review feedback

* Ensure we have stable type names in Resources.Extensions

We don't want to use the runtime type identity when doing type checks or writing
types as this may change.  Instead, check-in hard-coded strings that match the
type identity.

Add a test case to ensure the resources we generate match what we
test the reader against in the resource manager case (also to track any
change to the binary format).

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems
src/System.Private.CoreLib/shared/System/IO/PinnedBufferMemoryStream.cs
src/System.Private.CoreLib/shared/System/Resources/FastResourceComparer.cs
src/System.Private.CoreLib/shared/System/Resources/ResourceReader.Core.cs [new file with mode: 0644]
src/System.Private.CoreLib/shared/System/Resources/ResourceReader.cs
src/System.Private.CoreLib/shared/System/Resources/RuntimeResourceSet.cs