Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 8a1a71c

Browse files
committed
Check project item type before adding TypeScript file to context.
Ignore all project item types apart from None and TypeScriptCompile. This fixes the startup exception when opening SharpDevelop.Tests.sln with SharpDevelop when the TypeScript addin is enabled. System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at ICSharpCode.TypeScriptBinding.Hosting.TypeScriptContextProvider.AddFileToProjectContext(TypeScriptContext context, FileName fileName) at ICSharpCode.TypeScriptBinding.Hosting.TypeScriptContextProvider.CreateProjectContext(TypeScriptProject project) at ICSharpCode.TypeScriptBinding.TypeScriptProjectMonitor.CreateTypeScriptContextIfProjectHasTypeScriptFiles(IProject project) at ICSharpCode.TypeScriptBinding.TypeScriptProjectMonitor.SolutionLoaded(Object sender, SolutionEventArgs e)
1 parent 3df8fea commit 8a1a71c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/AddIns/BackendBindings/TypeScript/Project/Src/TypeScriptProject.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,16 @@ public IEnumerable<FileName> GetTypeScriptFileNames()
8585
return project
8686
.Items
8787
.Where(item => TypeScriptParser.IsTypeScriptFileName(item.FileName))
88+
.Where(IsSupportedProjectItemType)
8889
.Select(item => item.FileName);
8990
}
9091

92+
bool IsSupportedProjectItemType(ProjectItem item)
93+
{
94+
return item.ItemType == ItemType.None ||
95+
item.ItemType.ItemName == "TypeScriptCompile";
96+
}
97+
9198
bool HasMSBuildProject {
9299
get { return msbuildProject != null; }
93100
}

0 commit comments

Comments
 (0)