Avoid trying to boost on non-supported platforms#47373
Merged
davidwengier merged 6 commits intodotnet:masterfrom Sep 6, 2020
Merged
Avoid trying to boost on non-supported platforms#47373davidwengier merged 6 commits intodotnet:masterfrom
davidwengier merged 6 commits intodotnet:masterfrom
Conversation
Youssef1313
reviewed
Sep 2, 2020
Youssef1313
reviewed
Sep 2, 2020
Youssef1313
reviewed
Sep 2, 2020
Therzok
commented
Sep 2, 2020
Therzok
commented
Sep 2, 2020
Youssef1313
reviewed
Sep 2, 2020
On Mono, this throws an exception every time you try to query it, and it is documented that setting PriorityClass can throw, so adapt to that.
```
StreamJsonRpc.RemoteInvocationException: Success
at StreamJsonRpc.JsonRpc.InvokeCoreAsync[TResult] (StreamJsonRpc.RequestId id, System.String targetName, System.Collections.Generic.IReadOnlyList`1[T] arguments, System.Threading.CancellationToken cancellationToken, System.Boolean isParameterObject) [0x00184] in C:\A\_work\164\s\src\StreamJsonRpc\JsonRpc.cs:1350
at Microsoft.CodeAnalysis.Remote.RemoteEndPoint.InvokeAsync[T] (System.String targetName, System.Collections.Generic.IReadOnlyList`1[T] arguments, System.Threading.CancellationToken cancellationToken) [0x0005c] in /_/src/Workspaces/Remote/Core/RemoteEndPoint.cs:153
RPC server exception:
System.ComponentModel.Win32Exception: Success
at System.Diagnostics.Process.set_PriorityClass (System.Diagnostics.ProcessPriorityClass value) [0x00049] in <3b74eb7e72ba49d0adf622008aa5cb32>:0
at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.set_PriorityClass(System.Diagnostics.ProcessPriorityClass)
at Microsoft.CodeAnalysis.Remote.UserOperationBooster.Boost () [0x00029] in <8b79db78374649648c6dc65f376ad81c>:0
at Microsoft.CodeAnalysis.Remote.CodeAnalysisService+<>c__DisplayClass33_0.<GetSemanticClassificationsAsync>b__0 () [0x00012] in <8b79db78374649648c6dc65f376ad81c>:0
at Microsoft.CodeAnalysis.Remote.ServiceBase.RunServiceAsync[T] (System.Func`1[TResult] callAsync, System.Threading.CancellationToken cancellationToken) [0x00085] in <8b79db78374649648c6dc65f376ad81c>:0
```
sharwell
suggested changes
Sep 2, 2020
src/Workspaces/Remote/ServiceHub/Services/Host/RemoteHostService.cs
Outdated
Show resolved
Hide resolved
Contributor
Author
|
Updated! |
sharwell
reviewed
Sep 2, 2020
Therzok
commented
Sep 2, 2020
sharwell
approved these changes
Sep 2, 2020
sharwell
approved these changes
Sep 2, 2020
| process.PriorityClass = priorityClass; | ||
| return true; | ||
| } | ||
| catch (Exception e) when (e is PlatformNotSupportedException || e is Win32Exception) |
Contributor
There was a problem hiding this comment.
Suggested change
| catch (Exception e) when (e is PlatformNotSupportedException || e is Win32Exception) | |
| catch (Exception e) when (e is PlatformNotSupportedException or Win32Exception) |
Contributor
Author
There was a problem hiding this comment.
💯 did not know about this C# feature until now
CyrusNajmabadi
approved these changes
Sep 2, 2020
davidwengier
reviewed
Sep 3, 2020
| process.PriorityClass = priorityClass; | ||
| return true; | ||
| } | ||
| catch (Exception e) when (e is PlatformNotSupportedException || e is Win32Exception) |
Member
There was a problem hiding this comment.
Does Win32Exception mean we should never try again? The docs aren't really clear, but it seems like maybe that could be a temporary failure.
Contributor
Author
There was a problem hiding this comment.
I wasn't sure of all the possible error codes of the underlying implementation, which is why I initially had no latch to disable future calls.
On macOS, Win32Exception is mostly sent due to invalid pid or lack of permissions, which won't change over time.
davidwengier
approved these changes
Sep 3, 2020
Contributor
Author
|
Anything else needed? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Mono, this throws an exception every time you try to query it, and it is documented that setting PriorityClass can throw, so adapt to that.