-
Notifications
You must be signed in to change notification settings - Fork 730
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
Using MemoryStream on JsonConfigurationExtensions.AddJsonStream throws StreamNotReadable due to casting #1979
Comments
I'm unable to reproduce this using a clean app, created a new dotnet core web app and added the same code as above, and it was able to run fine and I was able to interact with the Config and lookup the SomeValue
|
Here's a full example, it's caused by building the configuration for reuse inside tests and is a facet of using a StreamReader that forcibly disposes your Stream.
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
If you believe you have an issue that affects the security of the platform please do NOT create an issue and instead email your issue details to secure@microsoft.com. Your report may be eligible for our bug bounty but ONLY if it is reported through email.
Describe the bug
When attempting to use a MemoryStream of a JSON file for config a
System.ArgumentException: Stream was not readable
is received. This is because the AddJsonStream extension https://github.com/aspnet/Extensions/blob/release/3.0-preview7/src/Configuration/Config.Json/src/JsonConfigurationExtensions.cs.AddJsonStream uses the following https://github.com/aspnet/Extensions/blob/release/3.0-preview7/src/Configuration/Config.Json/src/JsonConfigurationSource.cs that implements FileConfigurationProvider.To Reproduce
Steps to reproduce the behavior:
With these arguments '....'Expected behavior
Either I would expect:
i. the configuration to be read for
or
ii. AddJsonStream to only take a FileStream
ScreenshotsIf applicable, add screenshots to help explain your problem.Additional contextAdd any other context about the problem here.Include the output of
dotnet --info
The text was updated successfully, but these errors were encountered: