-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
WASM: Fix System.Diagnostics.TextWriterTraceListener tests #39186
WASM: Fix System.Diagnostics.TextWriterTraceListener tests #39186
Conversation
It was using Process.GetCurrentProcess() which throws PNSE on WebAssembly.
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
using Process process = Process.GetCurrentProcess(); | ||
s_processName = processName = process.ProcessName; | ||
} | ||
catch (PlatformNotSupportedException) |
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.
catch (PlatformNotSupportedException) | |
catch (PlatformNotSupportedException) // Process isn't supported on Browser |
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.
Did you consider instead doing a platform check?
if (RuntimeInformation.IsOSPlatform(OSPlatform.Browser) { ... }
else { ... }
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.
yeah but I think over the last couple PRs we landed on the consensus to prefer catching PNSE instead for cases like this.
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.
over the last couple PRs
Oh there have been more of these? I must have missed that. Could you point me to some examples?
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.
E.g. b62b16a#diff-ce3739bb88265fab85205217d762f650R70-R79 and the discussion on the PR: #38968 (comment)
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.
Ok.
It was using Process.GetCurrentProcess() which throws PNSE on WebAssembly.