-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Random cleanup #7173
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
Merged
Merged
Random cleanup #7173
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ece10a6
Use Shouldly
Forgind d3d7f3c
Delete ToolsVersion and xmlns
Forgind dcf30e5
new() without type
Forgind f4b6729
Use $ to format string literals
Forgind 6eb5b48
Clean up exceptions
Forgind 67b91d9
Inline variable declaration
Forgind e66628f
=> for simple methods
Forgind c669c98
Add space
Forgind cd50fe3
PR comments
Forgind d609930
Use named functions to clarify meaning of exceptions
Forgind 59b556e
Use ContainsKey
Forgind File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -288,19 +288,10 @@ public void WaitForCancelCompletion() | |
| { | ||
| taskCleanedUp = _requestTask.Wait(BuildParameters.RequestBuilderShutdownTimeout); | ||
| } | ||
| catch (AggregateException e) | ||
| catch (AggregateException e) when (e.Flatten().InnerExceptions.All(ex => ex is TaskCanceledException || ex is OperationCanceledException)) | ||
| { | ||
| AggregateException flattenedException = e.Flatten(); | ||
|
|
||
| if (flattenedException.InnerExceptions.All(ex => (ex is TaskCanceledException || ex is OperationCanceledException))) | ||
| { | ||
| // ignore -- just indicates that the task finished cancelling before we got a chance to wait on it. | ||
| taskCleanedUp = true; | ||
| } | ||
| else | ||
| { | ||
| throw; | ||
| } | ||
| // ignore -- just indicates that the task finished cancelling before we got a chance to wait on it. | ||
| taskCleanedUp = true; | ||
| } | ||
|
|
||
| if (!taskCleanedUp) | ||
|
|
@@ -824,17 +815,7 @@ private async Task BuildAndReport() | |
|
|
||
| thrownException = ex; | ||
| } | ||
| catch (LoggerException ex) | ||
| { | ||
| // Polite logger failure | ||
| thrownException = ex; | ||
| } | ||
| catch (InternalLoggerException ex) | ||
| { | ||
| // Logger threw arbitrary exception | ||
| thrownException = ex; | ||
| } | ||
| catch (Exception ex) | ||
| catch (Exception ex) // LoggerException is a polite logger failure. InternalLoggerException is an arbitrary exception. Handle them the same. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand the "handle them the same" part of this comment. Maybe just delete the comment? |
||
| { | ||
| thrownException = ex; | ||
|
|
||
|
|
@@ -874,13 +855,8 @@ private void ReportResultAndCleanUp(BuildResult result) | |
| { | ||
| _projectLoggingContext.LogProjectFinished(result.OverallResult == BuildResultCode.Success); | ||
| } | ||
| catch (Exception ex) | ||
| catch (Exception ex) when (!ExceptionHandling.IsCriticalException(ex)) | ||
| { | ||
| if (ExceptionHandling.IsCriticalException(ex)) | ||
| { | ||
| throw; | ||
| } | ||
|
|
||
| if (result.Exception == null) | ||
| { | ||
| result.Exception = ex; | ||
|
|
||
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
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
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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1005,14 +1005,14 @@ private ITranslator GetConfigurationTranslator(TranslationDirection direction) | |||||
| return BinaryTranslator.GetReadTranslator(File.OpenRead(cacheFile), null); | ||||||
| } | ||||||
| } | ||||||
| catch (Exception e) | ||||||
| catch (DirectoryNotFoundException e) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
instead? |
||||||
| { | ||||||
| if (e is DirectoryNotFoundException || e is UnauthorizedAccessException) | ||||||
| { | ||||||
| ErrorUtilities.ThrowInvalidOperation("CacheFileInaccessible", cacheFile, e); | ||||||
| } | ||||||
|
|
||||||
| // UNREACHABLE | ||||||
| ErrorUtilities.ThrowInvalidOperation("CacheFileInaccessible", cacheFile, e); | ||||||
| throw; | ||||||
| } | ||||||
| catch (UnauthorizedAccessException e) | ||||||
| { | ||||||
| ErrorUtilities.ThrowInvalidOperation("CacheFileInaccessible", cacheFile, e); | ||||||
| throw; | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Make a named function here.