Skip to content

Intellisense Gets Broken in vscode if we have some derived properties from TFM #1738

@Anipik

Description

@Anipik

In case of multple TargetFrameworks, omnisharp chooses the first target framework and do a reevaluation.

Before Re-evaluation, omnisharp uses setproperty function to set the TargetFramework property.

evaluatedProject.SetProperty(PropertyNames.TargetFramework, targetFramework);

So this updates a property if it exists, otherwise it searches for the first unconditioned PropertyGroup in the project file to add the property to. This is always going to be after any implicit imports as well as explicitly leading imports. This appears to be the long-standing behavior of SetProperty. Contrast that to SetGlobalProperty, which will treat the property as global.

Hence any property derived from targetFramework in implicit imports and leading imports will not be evaluated correctly.

There is a detail repro here dotnet/runtime#33427 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions