-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Ensure only one binding path for extension #1996
Conversation
Check that only one binding path is active and remove and extra binding paths that would cause issues.
aff0975 to
9196e0c
Compare
This is a helper class and not fundamental to GitHub for Visual Studio.
Make RationalizeBindingPaths return false when an assembly has already been loaded from an alternative location. Make FindBindingPaths return empty when not running inside Visual Studio.
Codecov Report
@@ Coverage Diff @@
## master #1996 +/- ##
==========================================
- Coverage 41.7% 40.22% -1.48%
==========================================
Files 373 406 +33
Lines 16126 17377 +1251
Branches 2211 2393 +182
==========================================
+ Hits 6725 6990 +265
- Misses 8890 9859 +969
- Partials 511 528 +17
|
This doesn't need to run in production.
24dfe51 to
fed313c
Compare
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.
This is using reflection to change private state of code we don't own, which sounds to me like a recipe for disaster down the line. Even though it's only doing it in debug builds, it's quite possibly something that will come back to bite us and cause hours of debugging.
@madskristensen @AArnott does this sound like something we should be doing?
|
Thanks for checking. I'm pretty sure we really wouldn't want this to ever ship to customers. As for your own debugging experience, I guess that's up to you as I can't speak to how unstable this would make your code. @Michael-Eng FYI |
Separate the code that reads and the code that mutates.
Simply detect wrong binding path and offer to show info rather than attempt to fix.
Use ShellSettingsManager instead of reflection to find BindingPaths.
CA was failing because InitializeAsync wasn't awaiting anything on a non-DEBUG build.
|
@grokys here's a non-hacky version for you that doesn't use reflection. 😉 There is a new feature in Visual Studio 2017 that lets you disable |
grokys
left a comment
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.
Much happier with this ;) Just one question but LGTM!
| /// method will check to see if a reference assembly could be loaded from an alternative | ||
| /// binding path. It will return any alternative paths that is finds. | ||
| /// </remarks> | ||
| public static class BindingPathUtilities |
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.
This class only seems to be used by BindingPathHelper - can these methods just be put there?
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.
It was just painful to write units tests that target, GitHub.VisualStudio because of the compile time! Now that it's stable, I've merged into BindingPathHelper as suggested. 👍
Merge BindingPathUtilities into BindingPathHelper.
Explicitly specify CultureInfo.CurrentCulture. Make class BindingPathHelper static.
Check that only one binding path is active and warn when extra binding paths might cause issues.
What this PR does
BindingPathsin Visual Studio configuration usingShellSettingsManagerGitHub.VisualStudio.dllDEBUGbuilds (no need to run in production)How to test
View > Other Windows > GitHubYesand follow instructionsxmldoc
VisualStudio/src/GitHub.Exports/Helpers/BindingPathUtilities.cs
Lines 10 to 32 in 7d5631b
Fixes #1995