Skip to content

Commit 7e2a0db

Browse files
enricosadalatkin
authored andcommitted
fix invalid already rendered folder error
fixes #246 closes #391 commit 2c37b20d129a231a16d2e64cbf2f007aa73e40c4 Author: enricosada <enrico@sada.io> 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 <enrico@sada.io> Date: Wed May 6 23:30:12 2015 +0200 add regression tests
1 parent 39f7f47 commit 7e2a0db

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

vsintegration/src/unittests/Tests.ProjectSystem.RoundTrip.fs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,17 @@ type RoundTrip() =
100100
CompileItem @"A\qux.fs"]
101101
this.``FsprojRoundtrip.PositiveTest``(MSBuildItems origItems, MSBuildItems expectedItems)
102102

103+
[<Test>]
104+
member public this.``FsprojRoundTrip.Regression.FoldersWithSameName``() =
105+
let items = MSBuildItems [CompileItem @"First\Second\bar.fs"
106+
CompileItem @"Second\qux.fs"]
107+
this.``FsprojRoundtrip.PositiveTest``(items, items)
108+
109+
[<Test>]
110+
member public this.``FsprojRoundTrip.Regression.FoldersWithSameName2``() =
111+
let items = MSBuildItems [CompileItem @"First\First\bar.fs"]
112+
this.``FsprojRoundtrip.PositiveTest``(items, items)
113+
103114
member this.``Fsproj.NegativeTest``(items : MSBuildItems) =
104115
DoWithTempFile "Test.fsproj" (fun file ->
105116
File.AppendAllText(file, TheTests.SimpleFsprojText([], [], items.ToString()))

vsintegration/src/vs/FsPkgs/FSharp.Project/FS/MSBuildUtilities.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ type internal MSBuildUtilities() =
120120
// push folder
121121
Inc(curPathParts)
122122
curPathParts.Add(pathParts.[curPathParts.Count]) // e.g. transition from A\ to A\D\E\bar.fs
123-
if not(alreadyRenderedFolders.Add(curPathParts)) && throwIfCannotRender then
123+
if not(alreadyRenderedFolders.Add(new List<string>(curPathParts))) && throwIfCannotRender then
124124
raise <| new InvalidOperationException(String.Format(FSharpSR.GetString(FSharpSR.ProjectRenderFolderMultiple), projectNode.ProjectFile, bi.Include))
125125
Inc(curPathParts)
126126
if bi.ItemType = ProjectFileConstants.Folder then

0 commit comments

Comments
 (0)