From 7e2a0db2517dcee28986324f61b3348493a30800 Mon Sep 17 00:00:00 2001 From: enricosada Date: Mon, 18 May 2015 14:27:25 -0700 Subject: [PATCH] fix invalid already rendered folder error fixes #246 closes #391 commit 2c37b20d129a231a16d2e64cbf2f007aa73e40c4 Author: enricosada Date: Wed Apr 29 18:57:04 2015 +0200 fix invalid already rendered folder error fix invalid already rendered folder error when a project contains folders with same name commit b8d03011db57b3b5df66c31d3a1564352c947cd1 Author: enricosada Date: Wed May 6 23:30:12 2015 +0200 add regression tests --- .../src/unittests/Tests.ProjectSystem.RoundTrip.fs | 11 +++++++++++ .../vs/FsPkgs/FSharp.Project/FS/MSBuildUtilities.fs | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/vsintegration/src/unittests/Tests.ProjectSystem.RoundTrip.fs b/vsintegration/src/unittests/Tests.ProjectSystem.RoundTrip.fs index 600adeb3b..6fa28965e 100644 --- a/vsintegration/src/unittests/Tests.ProjectSystem.RoundTrip.fs +++ b/vsintegration/src/unittests/Tests.ProjectSystem.RoundTrip.fs @@ -100,6 +100,17 @@ type RoundTrip() = CompileItem @"A\qux.fs"] this.``FsprojRoundtrip.PositiveTest``(MSBuildItems origItems, MSBuildItems expectedItems) + [] + member public this.``FsprojRoundTrip.Regression.FoldersWithSameName``() = + let items = MSBuildItems [CompileItem @"First\Second\bar.fs" + CompileItem @"Second\qux.fs"] + this.``FsprojRoundtrip.PositiveTest``(items, items) + + [] + member public this.``FsprojRoundTrip.Regression.FoldersWithSameName2``() = + let items = MSBuildItems [CompileItem @"First\First\bar.fs"] + this.``FsprojRoundtrip.PositiveTest``(items, items) + member this.``Fsproj.NegativeTest``(items : MSBuildItems) = DoWithTempFile "Test.fsproj" (fun file -> File.AppendAllText(file, TheTests.SimpleFsprojText([], [], items.ToString())) diff --git a/vsintegration/src/vs/FsPkgs/FSharp.Project/FS/MSBuildUtilities.fs b/vsintegration/src/vs/FsPkgs/FSharp.Project/FS/MSBuildUtilities.fs index 3e6c64bc6..97525f5c9 100644 --- a/vsintegration/src/vs/FsPkgs/FSharp.Project/FS/MSBuildUtilities.fs +++ b/vsintegration/src/vs/FsPkgs/FSharp.Project/FS/MSBuildUtilities.fs @@ -120,7 +120,7 @@ type internal MSBuildUtilities() = // push folder Inc(curPathParts) curPathParts.Add(pathParts.[curPathParts.Count]) // e.g. transition from A\ to A\D\E\bar.fs - if not(alreadyRenderedFolders.Add(curPathParts)) && throwIfCannotRender then + if not(alreadyRenderedFolders.Add(new List(curPathParts))) && throwIfCannotRender then raise <| new InvalidOperationException(String.Format(FSharpSR.GetString(FSharpSR.ProjectRenderFolderMultiple), projectNode.ProjectFile, bi.Include)) Inc(curPathParts) if bi.ItemType = ProjectFileConstants.Folder then -- GitLab