Skip to content
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

Merged
merged 3 commits into from
Jul 14, 2020

Conversation

akoeplinger
Copy link
Member

It was using Process.GetCurrentProcess() which throws PNSE on WebAssembly.

It was using Process.GetCurrentProcess() which throws PNSE on WebAssembly.
@Dotnet-GitSync-Bot
Copy link
Collaborator

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.

@ghost
Copy link

ghost commented Jul 13, 2020

Tagging subscribers to this area: @tarekgh, @tommcdon, @pjanotti
Notify danmosemsft if you want to be subscribed.

using Process process = Process.GetCurrentProcess();
s_processName = processName = process.ProcessName;
}
catch (PlatformNotSupportedException)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
catch (PlatformNotSupportedException)
catch (PlatformNotSupportedException) // Process isn't supported on Browser

Copy link
Member

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 { ... }

Copy link
Member Author

@akoeplinger akoeplinger Jul 13, 2020

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.

Copy link
Member

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?

Copy link
Member Author

@akoeplinger akoeplinger Jul 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

@akoeplinger akoeplinger requested a review from stephentoub July 13, 2020 21:31
@akoeplinger akoeplinger merged commit a9b1173 into dotnet:master Jul 14, 2020
@akoeplinger akoeplinger deleted the fix-textwritertracelistener branch July 14, 2020 17:43
@karelz karelz added this to the 5.0.0 milestone Aug 18, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants