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

Feature/script supersede lower versions #1103

Merged
merged 7 commits into from
Feb 13, 2018

Conversation

filipw
Copy link
Member

@filipw filipw commented Feb 2, 2018

Conflicting assembly versions in scripting are typically resolved via identity comparer, which we already use.

However, scripting scenarios in Roslyn additionally set a special flag in the ReferenceManager to enable additional tie-breaking behavior in case of conflicting references. This flag is propagated from the compilation options, and is always implicitly injected for script compilations.

To mirror 1:1 the runtime behavior of scripts, we should ensure the same flag is set at tooling level (at the moment we have it set to to false which can lead to edge case false-positive intellisense errors). Unfortunately the flag is internal so it's set with reflection (along with a few other things we do with reflection in script tooling ☹️).

var referencesSupersedeLowerVersionsProperty = typeof(CompilationOptions).GetProperty(ReferencesSupersedeLowerVersionsProperty, BindingFlags.Instance | BindingFlags.NonPublic);
if (referencesSupersedeLowerVersionsProperty != null)
{
referencesSupersedeLowerVersionsProperty?.SetValue(compilationOptions, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the ?. needed after checking for null above?

Copy link
Member

Choose a reason for hiding this comment

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

Technically the if could be removed couldn't it?

Copy link
Member Author

Choose a reason for hiding this comment

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

you are both right 😀

Copy link
Member

@david-driscoll david-driscoll left a comment

Choose a reason for hiding this comment

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

👍

@filipw
Copy link
Member Author

filipw commented Feb 13, 2018

I will merge this now 😀

screen shot 2018-02-13 at 14 40 40

@filipw filipw merged commit 26c5dce into OmniSharp:master Feb 13, 2018
@filipw filipw deleted the feature/script-SupersedeLowerVersions branch February 13, 2018 13:40
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.

3 participants