From d8279494316966550104a75a402ca2e16e6b94b5 Mon Sep 17 00:00:00 2001 From: Heejae Chang Date: Fri, 3 Apr 2015 13:36:51 -0700 Subject: [PATCH] fixed assert where cshtml didn't get proper IVsHierarchy set --- .../Implementation/Venus/ContainedDocument.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/VisualStudio/Core/Def/Implementation/Venus/ContainedDocument.cs b/src/VisualStudio/Core/Def/Implementation/Venus/ContainedDocument.cs index 2250bd470d7..b951aaceda8 100644 --- a/src/VisualStudio/Core/Def/Implementation/Venus/ContainedDocument.cs +++ b/src/VisualStudio/Core/Def/Implementation/Venus/ContainedDocument.cs @@ -72,12 +72,14 @@ internal sealed class ContainedDocument : ForegroundThreadAffinitizedObject, IVi private readonly string _itemMoniker; public AbstractProject Project { get { return _containedLanguage.Project; } } - public DocumentId Id { get; private set; } - public IReadOnlyList Folders { get; private set; } - public TextLoader Loader { get; private set; } - public DocumentKey Key { get; private set; } public bool SupportsRename { get { return _hostType == HostType.Razor; } } + public DocumentId Id { get; } + public IReadOnlyList Folders { get; } + public TextLoader Loader { get; } + public DocumentKey Key { get; } + public IVsHierarchy SharedHierarchy { get; } + public ContainedDocument( AbstractContainedLanguage containedLanguage, SourceCodeKind sourceCodeKind, @@ -99,6 +101,8 @@ internal sealed class ContainedDocument : ForegroundThreadAffinitizedObject, IVi var rdt = (IVsRunningDocumentTable)componentModel.GetService().GetService(typeof(SVsRunningDocumentTable)); var filePath = rdt.GetMonikerForHierarchyAndItemId(hierarchy, itemId); + this.SharedHierarchy = hierarchy == null ? null : LinkedFileUtilities.GetSharedHierarchyForItem(hierarchy, itemId); + if (Project.Hierarchy != null) { string moniker; @@ -115,11 +119,6 @@ internal sealed class ContainedDocument : ForegroundThreadAffinitizedObject, IVi _vbHelperFormattingRule = vbHelperFormattingRule; } - public IVsHierarchy SharedHierarchy - { - get { return null; } - } - private HostType GetHostType() { var projectionBuffer = _containedLanguage.DataBuffer as IProjectionBuffer; -- GitLab