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

Fix error in Linux ERR999.UnhandledEngineException : System.InvalidOperationException: This operation is not supported for a relative URI. #2664

Merged
merged 6 commits into from
May 4, 2023

Conversation

shaopeng-gh
Copy link
Collaborator

@shaopeng-gh shaopeng-gh commented May 4, 2023

Test:

have added the test in BinSkim after this is merged in and sub-module update,
the failing test that repro the issue (microsoft/binskim#884) will pass see below:

image

image

image

Reason:

Below code will output false in Linux, means not absolute Uri.
But I think it is wrong, I don't know if it is .NET bug or not. The url should be a absolute uri.

string path = "/home/__w/1/s/src/build/_deps/cxx-src/WORKSPACE";
Uri uri = new Uri(path, UriKind.RelativeOrAbsolute);
Console.WriteLine("uri.IsAbsoluteUri:" + uri.IsAbsoluteUri);

The place fix is made, if you look at the code above, it is always a Absolute uri before reaching the line. So we don't leave .NET to do the guessing, we just create a Absolute uri.

@shaopeng-gh shaopeng-gh marked this pull request as ready for review May 4, 2023 03:26
@@ -14,6 +14,7 @@
* BRK: Remove unused `quiet` parameter from `SarifLogger`. [#2639]https://github.com/microsoft/sarif-sdk/pull/2639
* BRK: Remove `ComputeHashData` and `AnalysisTargetToHashDataMap` properties from `SarifLogger` (in preference of new `fileRegionsCache` parameter. [#2639](https://github.com/microsoft/sarif-sdk/pull/2639)
* BRK: Eliminate proactive hashing of artifacts in `SarifLogger` constructor when `OptionallyEmittedData.Hashes` is specified. [#2639](https://github.com/microsoft/sarif-sdk/pull/2639)
* BUG: Fixed `ERR999.UnhandledEngineException`: `System.InvalidOperationException`: "This operation is not supported for a relative URI" when running in Linux with files skipped due to zero byte size. [#2664](https://github.com/microsoft/sarif-sdk/pull/2664)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

BUG

please view the PR description in GitHub so it has the screenshots.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Put the whole thing from ERR999 to relative URI inside backticks,

@@ -14,6 +14,7 @@
* BRK: Remove unused `quiet` parameter from `SarifLogger`. [#2639]https://github.com/microsoft/sarif-sdk/pull/2639
* BRK: Remove `ComputeHashData` and `AnalysisTargetToHashDataMap` properties from `SarifLogger` (in preference of new `fileRegionsCache` parameter. [#2639](https://github.com/microsoft/sarif-sdk/pull/2639)
* BRK: Eliminate proactive hashing of artifacts in `SarifLogger` constructor when `OptionallyEmittedData.Hashes` is specified. [#2639](https://github.com/microsoft/sarif-sdk/pull/2639)
* BUG: Fixed `ERR999.UnhandledEngineException`: `System.InvalidOperationException`: "This operation is not supported for a relative URI" when running in Linux with files skipped due to zero byte size. [#2664](https://github.com/microsoft/sarif-sdk/pull/2664)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Put the whole thing from ERR999 to relative URI inside backticks,

@suvamM suvamM enabled auto-merge (squash) May 4, 2023 19:06
@suvamM suvamM merged commit bc8cb57 into main May 4, 2023
@suvamM suvamM deleted the users/shaopeng-gh/fixlinuxpathissue branch May 4, 2023 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants