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.
When the command is a raw file path, using the file path as a regex pattern can cause exceptions (E.g. "C://Users//..., /u is interpreted as a hexadecimal group).
Consider the following example:
Line 93 is expected to return "C://Users//Setup2.exe". However, when
FirstOrDefault
compares the first two cmds, becauseRegex.IsMatch("C://Users//Setup1.exe", "C://Users//Setup2.exe")
throws an "Insufficient hexadecimal digits" exception due to the "\u", FirstOrDefault will not check the second process's full cmd, resulting in an unexpected failure/exception.The proposed change modifies the execution order. FirstorDefault will first iterate through all the processes and see if there is a complete raw string matching. If there is no such matching, continue with regex matching.