Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit ca0a273

Browse files
committed
Use ContentPresenter instead of ContentControl
This resolves the, "Logical tree depth exceeded while traversing the tree. This could indicate a cycle in the tree" exception.
1 parent 48cb0cc commit ca0a273

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/GitHub.VisualStudio/UI/GitHubPane.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System.Runtime.InteropServices;
66
using System.Windows;
77
using System.Windows.Controls;
8-
using GitHub.Helpers;
98
using GitHub.Extensions;
109
using GitHub.Factories;
1110
using GitHub.Services;
@@ -38,17 +37,17 @@ public class GitHubPane : ToolWindowPane, IServiceProviderAware
3837
bool initialized = false;
3938
IDisposable viewSubscription;
4039
IGitHubPaneViewModel viewModel;
41-
ContentControl contentControl;
40+
ContentPresenter contentPresenter;
4241

4342
public FrameworkElement View
4443
{
45-
get { return contentControl.Content as FrameworkElement; }
44+
get { return contentPresenter.Content as FrameworkElement; }
4645
set
4746
{
4847
viewSubscription?.Dispose();
4948
viewSubscription = null;
5049

51-
contentControl.Content = value;
50+
contentPresenter.Content = value;
5251

5352
viewSubscription = value.WhenAnyValue(x => x.DataContext)
5453
.SelectMany(x =>
@@ -66,7 +65,7 @@ public FrameworkElement View
6665
public GitHubPane() : base(null)
6766
{
6867
Caption = "GitHub";
69-
Content = contentControl = new ContentControl();
68+
Content = contentPresenter = new ContentPresenter();
7069

7170
BitmapImageMoniker = new Microsoft.VisualStudio.Imaging.Interop.ImageMoniker()
7271
{
@@ -95,12 +94,10 @@ public void Initialize(IServiceProvider serviceProvider)
9594

9695
async Task InitializeAsync(IServiceProvider serviceProvider)
9796
{
98-
// Allow MEF to refresh its cache on a background thread so it isn't counted against us.
97+
// Allow MEF to initialize its cache asynchronously
9998
var asyncServiceProvider = (IAsyncServiceProvider)GetService(typeof(SAsyncServiceProvider));
10099
await asyncServiceProvider.GetServiceAsync(typeof(SComponentModel));
101100

102-
await ThreadingHelper.SwitchToMainThreadAsync();
103-
104101
var provider = VisualStudio.Services.GitHubServiceProvider;
105102
var teServiceHolder = provider.GetService<ITeamExplorerServiceHolder>();
106103
teServiceHolder.ServiceProvider = serviceProvider;

0 commit comments

Comments
 (0)