Skip to content

Commit

Permalink
Merge pull request #1356 from zooba/issue-1355
Browse files Browse the repository at this point in the history
Fixes #1355 UWP package cannot find Microsoft.PythonTools.dll
  • Loading branch information
Dino Viehland authored Jun 21, 2016
2 parents b89530d + 8a7ce31 commit 388c478
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 0 additions & 1 deletion Python/Product/Uwp/PythonUwpPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -515,6 +515,9 @@ public void AddInterpreter(IPythonInterpreterFactory factory, bool disposeInterp
}

lock (_factoriesLock) {
if (_factories == null) {
_factories = new Dictionary<IPythonInterpreterFactory, FactoryInfo>();
}
_factories[factory] = new FactoryInfo(item, disposeInterpreter);
}
OnInterpreterFactoriesChanged();
Expand All @@ -534,7 +537,7 @@ public void RemoveInterpreterFactory(IPythonInterpreterFactory factory) {
throw new ArgumentNullException("factory");
}

if (!_factories.ContainsKey(factory)) {
if (_factories == null || !_factories.ContainsKey(factory)) {
return;
}

Expand Down Expand Up @@ -611,7 +614,7 @@ public IEnumerable<IPythonInterpreterFactory> 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;
}
}
Expand All @@ -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);
}
}
Expand Down Expand Up @@ -662,7 +665,7 @@ public bool IsAvailable(IPythonInterpreterFactory factory) {
/// </remarks>
public bool Contains(IPythonInterpreterFactory factory) {
lock (_factoriesLock) {
return _factories.ContainsKey(factory);
return _factories != null && _factories.ContainsKey(factory);
}
}

Expand Down

0 comments on commit 388c478

Please sign in to comment.