-
Notifications
You must be signed in to change notification settings - Fork 88
BlazorWasm support #256
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
BlazorWasm support #256
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. My main concern with this approach is that if someone changes the order of the assignments (I think) it'll throw a PNSE instead of a TypeInitializationException. Probably better to fix ConsoleInputStream to not throw on initialization and then catch the PNSE.
I guess my other problem is I don't have a Blazor test rig to validate this. Any pointers on setting one up?
Related issue: IronLanguages/ironpython2#769
Workaround: IronLanguages/ironpython2#769 (comment)
|
@slozier Is that better? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that works.
Going from a field to a property is a breaking change but I assume no one outside the assembly is using this... Also I think we lose thread safety on the singleton creation. Will need to look into it a bit more, but I guess I can fix it after the merge if required.
|
@slozier Sorry, I don't quite understand how this is a breaking change. If you would point me in the right direction I might be able to make it a non-breaking change. |
|
@TwoUnderscorez I meant having An alternative approach would be to leave private ConsoleInputStream() {
try {
_input = Console.OpenStandardInput();
} catch (PlatformNotSupportedException) {
_input = Stream.Null;
}
} |
|
@slozier I could do that, but I would have to leave the catch block in _inputEncoding = Console.InputEncoding;
_inputReader = Console.In;also throw |
|
@TwoUnderscorez I think the PNSE try/catch you have in |
|
Thanks for the PR! |
When trying to use IronPython3 from a Blazor web-assembly application,
Microsoft.Scripting.Runtime.SharedIOthrows an exception when trying to setupstdin, which is understandable, because there is none.All I did is catch the exception and set the stream to
Stream.Null.