Skip to content

Add/remove source file only when link metadata changes#5880

Merged
davkean merged 4 commits intodotnet:masterfrom
davkean:LinkedMetadataRefresh
Feb 10, 2020
Merged

Add/remove source file only when link metadata changes#5880
davkean merged 4 commits intodotnet:masterfrom
davkean:LinkedMetadataRefresh

Conversation

@davkean
Copy link
Member

@davkean davkean commented Feb 10, 2020

Fixes: #5259

The first two commits are boilerplate that are required to plumb through the "previous" metadata for an item, 8f43fd7 actually fixes the bug.

@davkean davkean requested a review from a team as a code owner February 10, 2020 03:26
@davkean davkean merged commit 3783eac into dotnet:master Feb 10, 2020
@jjmew jjmew added the Bug label Mar 24, 2020
davkean added a commit to davkean/project-system that referenced this pull request Sep 1, 2020
Fixes: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/961596

Roslyn is responsible for applying SubType to Forms, Components and other types. In multi-targeted projects, the same file can have conflicting "sub types":

#if NET45
    class MyComponent : Form
#else
    class MyComponent : Component
#endif

This results Roslyn pushing "Form" when it encounters scans the first definition and "Component" when it encounters the second definition.
There is no guaranteed order to which one of these get scanned first, so this can result in the same time having a different sub type every time Roslyn does analysis. Sub Type affects the designer and icon that a type gets, so this results in a type that flickers between two different icons.

This was worse before dotnet#5880 as we'd see the sub type change and go back to Roslyn to add/remove the file, resulting in a constant churn. This longer occurs, but we still have the fighting sub type dance whenver the file content changes.

To fix this, Roslyn will now only scan the the primary context: dotnet/roslyn#44270.

This change plumbs through this property by finding the context that lives in the "active configuration" and passing this through to Roslyn.
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.

Language service add/removing files when their sub type metadata changes

3 participants