diff --git a/Python/Product/Uwp/PythonUwpPackage.cs b/Python/Product/Uwp/PythonUwpPackage.cs index 277102ec67..6bf312e34e 100644 --- a/Python/Product/Uwp/PythonUwpPackage.cs +++ b/Python/Product/Uwp/PythonUwpPackage.cs @@ -47,7 +47,6 @@ namespace Microsoft.PythonTools.Uwp { [ProvideObject(typeof(PythonUwpPropertyPage))] [ProvideObject(typeof(PythonUwpProject))] - [ProvideAutoLoad(VSConstants.UICONTEXT.SolutionHasAppContainerProject_string)] [Description("Python Tools Uwp Interpreter")] [ProvideProjectFactory(typeof(PythonUwpProjectFactory), null, null, null, null, ".\\NullPath", LanguageVsTemplate = PythonConstants.LanguageName)] [ProvidePythonInterpreterFactoryProvider(PythonUwpInterpreterFactory.InterpreterGuidString, typeof(PythonUwpInterpreterFactoryProvider))] diff --git a/Python/Product/VSInterpreters/MSBuildProjectInterpreterFactoryProvider.cs b/Python/Product/VSInterpreters/MSBuildProjectInterpreterFactoryProvider.cs index db3b105d28..8fb0b10d8f 100644 --- a/Python/Product/VSInterpreters/MSBuildProjectInterpreterFactoryProvider.cs +++ b/Python/Product/VSInterpreters/MSBuildProjectInterpreterFactoryProvider.cs @@ -464,7 +464,7 @@ public void AddInterpreter(IPythonInterpreterFactory factory, bool disposeInterp throw new ArgumentNullException("factory"); } - if (_factories.ContainsKey(factory)) { + if (_factories != null && _factories.ContainsKey(factory)) { return; } @@ -515,6 +515,9 @@ public void AddInterpreter(IPythonInterpreterFactory factory, bool disposeInterp } lock (_factoriesLock) { + if (_factories == null) { + _factories = new Dictionary(); + } _factories[factory] = new FactoryInfo(item, disposeInterpreter); } OnInterpreterFactoriesChanged(); @@ -534,7 +537,7 @@ public void RemoveInterpreterFactory(IPythonInterpreterFactory factory) { throw new ArgumentNullException("factory"); } - if (!_factories.ContainsKey(factory)) { + if (_factories == null || !_factories.ContainsKey(factory)) { return; } @@ -611,7 +614,7 @@ public IEnumerable GetProjectSpecificInterpreterFacto public MSBuild.ProjectItem GetProjectItem(IPythonInterpreterFactory factory) { lock (_factoriesLock) { FactoryInfo info; - if (_factories.TryGetValue(factory, out info)) { + if (_factories != null && _factories.TryGetValue(factory, out info)) { return info.ProjectItem; } } @@ -629,7 +632,7 @@ public MSBuild.ProjectItem GetProjectItem(IPythonInterpreterFactory factory) { public bool IsProjectSpecific(IPythonInterpreterFactory factory) { lock (_factoriesLock) { FactoryInfo info; - if (_factories.TryGetValue(factory, out info)) { + if (_factories != null && _factories.TryGetValue(factory, out info)) { return info.ProjectItem.ItemType.Equals(InterpreterItem); } } @@ -662,7 +665,7 @@ public bool IsAvailable(IPythonInterpreterFactory factory) { /// public bool Contains(IPythonInterpreterFactory factory) { lock (_factoriesLock) { - return _factories.ContainsKey(factory); + return _factories != null && _factories.ContainsKey(factory); } }