Skip to content

Enable portable signing for Mono#26683

Merged
agocke merged 2 commits intodotnet:dev15.7.xfrom
agocke:enable-portable-signing-for-mono
May 11, 2018
Merged

Enable portable signing for Mono#26683
agocke merged 2 commits intodotnet:dev15.7.xfrom
agocke:enable-portable-signing-for-mono

Conversation

@agocke
Copy link
Copy Markdown
Member

@agocke agocke commented May 7, 2018

Customer scenario

Signing was previously working on Mono for keyfiles, but does not work after 2.7.1.

Bugs this fixes

#26678
https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems/edit/615168

Workarounds, if any

None, for Mono.

Risk

This check is only used for switching the key providers, and has a focused change just to allow mono to go through the same path as CoreCLR.

Performance impact

Low, one small reflection check per compile.

Is this a regression from a previous update?

Yes.

Root cause analysis

We have no Mono tests. It's not clear that this was supposed to work for Mono, it may have simply been functioning by accident.

How was the bug found?

Mono reported.

Desktop signing uses a COM call into the CLR to sign an assembly,
which is not available on Mono or CoreCLR. This change always
uses portable signing by default on Mono as well as CoreCLR.
@agocke agocke requested review from a team, akoeplinger and jaredpar May 7, 2018 18:12
@agocke
Copy link
Copy Markdown
Member Author

agocke commented May 7, 2018

@akoeplinger Could you or someone on Mono confirm that this is a robust mechanism for detecting if we're running on Mono?

@agocke
Copy link
Copy Markdown
Member Author

agocke commented May 7, 2018

cc @marek-safar

Copy link
Copy Markdown
Member

@akoeplinger akoeplinger left a comment

Choose a reason for hiding this comment

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

This is fine, thank you!

{
bool fallback =
!CoreClrShim.IsRunningOnCoreClr ||
!(CoreClrShim.IsRunningOnCoreClr || Type.GetType("Mono.Runtime") != null) ||
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this should eventually be refactored into a helper since it's used in a couple places in the codebase: https://github.com/dotnet/roslyn/search?q=%22Mono.Runtime%22&type=Code

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Need to wrap this into a helper for this change I think. The Type.GetType method can throw exceptions in corner cases. Can't let those take down the compiler here.

@marek-safar
Copy link
Copy Markdown
Contributor

@agocke yes that's recommended way to check for Mono runtime executing the code

@MeiChin-Tsai
Copy link
Copy Markdown

approved to merge once all green.

@jaredpar
Copy link
Copy Markdown
Member

retest windows_debug_vs-integration_prtest please

@agocke agocke merged commit 9420fa4 into dotnet:dev15.7.x May 11, 2018
@agocke agocke deleted the enable-portable-signing-for-mono branch May 11, 2018 16:46
@marek-safar
Copy link
Copy Markdown
Contributor

@jaredpar what's the timeline for 2.8 service release including this fix?

@jaredpar
Copy link
Copy Markdown
Member

@marek-safar this is currently targeted for 15.8.2. I don't know what the time frame for that to RTM is but typically it's days. The NuGet packages for the fix (2.8.1) will be made available as soon as we have validation the insertion into VS. Possibly later today or Monday at the latest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants