Skip to content

Use IVsSolution to look up IVsHierarchy by project GUID#35746

Merged
tmat merged 6 commits intodotnet:masterfrom
tmat:IVsHierarchy
May 31, 2019
Merged

Use IVsSolution to look up IVsHierarchy by project GUID#35746
tmat merged 6 commits intodotnet:masterfrom
tmat:IVsHierarchy

Conversation

@tmat
Copy link
Copy Markdown
Member

@tmat tmat commented May 16, 2019

No description provided.

@tmat
Copy link
Copy Markdown
Member Author

tmat commented May 16, 2019

@jasonmalinowski Looks reasonable?

Copy link
Copy Markdown
Member

@jasonmalinowski jasonmalinowski left a comment

Choose a reason for hiding this comment

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

High level this seems reasonable. I haven't done a careful analysis of things to see if there's small bugs.

Testing this will be fun. Things to test:

  • ASP.NET Web Sites, both script blocks and code in App_Code. Maybe also things like generic handlers.
  • ASP.NET Web Applications, both script blocks and regular code files.
  • ASP.NET MVC/Razor of however many flavors.

I'm also not sure if flavored csproj projects can do silly stuff here either. I hope not, more just because flavoring is insane in general.

@tmat tmat marked this pull request as ready for review May 20, 2019 20:45
@tmat tmat requested a review from a team as a code owner May 20, 2019 20:45
Copy link
Copy Markdown
Member

@jasonmalinowski jasonmalinowski left a comment

Choose a reason for hiding this comment

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

Some questions, but mostly either stylistic things or just "wanted to confirm that's what you meant" things. I think this is fine, modulo heavy testing of course.

// *DO NOT DELETE*
// This is used by Ruleset Editor from ManagedSourceCodeAnalysis.dll.
public IReadOnlyDictionary<string, IEnumerable<DiagnosticDescriptor>> GetAllDiagnosticDescriptors(IVsHierarchy hierarchyOpt)
=> GetAllDiagnosticDescriptors(hierarchyOpt != null && hierarchyOpt.TryGetProjectGuid(out var guid) ? guid : Guid.Empty);
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.

Can we split this into multiple lines?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We can, but it doesn't seem to be too long or too complex to me.

}

private ProjectId GetActiveContextProjectIdAndWatchHierarchies(uint cookie, IEnumerable<ProjectId> projectIds)
private ProjectId GetActiveContextProjectIdAndWatchHierarchies(uint cookie, ImmutableArray<DocumentId> documentIds)
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.

Why the change? It makes the other code a bit stranger to follow...

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.

(I actually originally wrote it this way, and then switched it over to ProjectId because the logic inside was a bit less clear...)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think i needed it this way at some point, now it's not needed anymore, although it saves some allocations. I can revert it if you prefer.

' Return a loose mock that just is a big no-op
Dim solutionMock As New Mock(Of IVsSolution)(MockBehavior.Loose)
Return solutionMock.Object
Case GetType(IVsSolution), GetType(SVsSolution)
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.

Something is directly asking as IVsSolution? That seems fishy.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

The request should have been for SVsSolution, not IVsSolution.

{
AssemblyName = project.AssemblyName,
FilePath = project.ProjectFilePath,
Hierarchy = project.Hierarchy,
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.

@tmat @jasonmalinowski What's the new way for TS to thread this through? Some of our refactorings are broken since the IVsHierarchy isn't being returned by IVsSolution.

As an aside, can you please ping me/us when changing a TS shim?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Are you currently calling VisualStudioProject.GetHierarchy to get such IVsHierarchy objects?

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.

Which VisualStudioProject? I'm assuming you don't mean the one in Microsoft.VisualStudio.LanguageServices.TypeScript.ScriptContexts. Either way, we're trying to specify hierarchies - not retrieve them.

@jmarolf jmarolf mentioned this pull request Jun 17, 2019
jmarolf added a commit to jmarolf/roslyn that referenced this pull request Jun 17, 2019
tmat added a commit to tmat/roslyn that referenced this pull request Jun 20, 2019
333fred added a commit to 333fred/roslyn that referenced this pull request Jun 20, 2019
* dotnet/master: (85 commits)
  Don't complete statement when typing semicolon inside comments in an argument list (dotnet#36521)
  Set focus to editor before finding text
  Add a bunch of nullability support to some code generation helpers
  Add 'annotations' and 'warnings' support to nullable directive (dotnet#36464)
  Fixed IDE services touching `notnull` constraint (dotnet#36508)
  Update compiler toolset to arcade version (dotnet#36549)
  Fix for 923157
  Do not include value types in NullableAttribute byte[] (dotnet#36519)
  Fix a deadlock in InvokeOnUIThread
  Apply a hang mitigating timeout to UI thread operations
  Move to a different lowering from for nullable value types to work around a bug in TransformCompoundAssignmentLHS. Addressed PR feedback.
  Fix stack overflow in requesting syntax directives (dotnet#36347)
  crash on ClassifyUpdate for EventFields (dotnet#35962)
  fixing bad merge with refactoring that was checked in later
  added basic completion statement telemetry
  Remove duplication in AbstractSymbolCompletionProvider.CreateItems
  Disable move type when the options service isn't present (dotnet#36334)
  Fix crash where type inference doing method inference needs to drop nullability
  Revert "Use IVsSolution to look up IVsHierarchy by project GUID (dotnet#35746)"
  Fix parsing bug in invalid using statements (dotnet#36428)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants