From 75c59faaf6479c64f576bef848bbb469b541aea1 Mon Sep 17 00:00:00 2001
From: Martin521 <29605222+Martin521@users.noreply.github.com>
Date: Fri, 15 Nov 2024 14:34:09 +0000
Subject: [PATCH 1/7] fix for race condition in FileIndex.fileIndexOfFile
---
src/Compiler/Utilities/range.fs | 40 +++++++++----------
.../FSharp.Compiler.ComponentTests.fsproj | 1 +
.../Miscellaneous/FileIndex.fs | 21 ++++++++++
3 files changed, 42 insertions(+), 20 deletions(-)
create mode 100644 tests/FSharp.Compiler.ComponentTests/Miscellaneous/FileIndex.fs
diff --git a/src/Compiler/Utilities/range.fs b/src/Compiler/Utilities/range.fs
index 6d0002a97ba..b34ef4963c0 100755
--- a/src/Compiler/Utilities/range.fs
+++ b/src/Compiler/Utilities/range.fs
@@ -193,28 +193,28 @@ type FileIndexTable() =
//
// TO move forward we should eventually introduce a new type NormalizedFileName that tracks this invariant.
member t.FileToIndex normalize filePath =
- match fileToIndexTable.TryGetValue filePath with
- | true, idx -> idx
- | _ ->
-
- // Try again looking for a normalized entry.
- let normalizedFilePath =
- if normalize then
- FileSystem.NormalizePathShim filePath
- else
- filePath
+ lock fileToIndexTable <| fun () ->
+ match fileToIndexTable.TryGetValue filePath with
+ | true, idx -> idx
+ | _ ->
- match fileToIndexTable.TryGetValue normalizedFilePath with
- | true, idx ->
- // Record the non-normalized entry if necessary
- if filePath <> normalizedFilePath then
- lock fileToIndexTable (fun () -> fileToIndexTable[filePath] <- idx)
+ // Try again looking for a normalized entry.
+ let normalizedFilePath =
+ if normalize then
+ FileSystem.NormalizePathShim filePath
+ else
+ filePath
+
+ match fileToIndexTable.TryGetValue normalizedFilePath with
+ | true, idx ->
+ // Record the non-normalized entry if necessary
+ if filePath <> normalizedFilePath then
+ fileToIndexTable[filePath] <- idx
- // Return the index
- idx
+ // Return the index
+ idx
- | _ ->
- lock fileToIndexTable (fun () ->
+ | _ ->
// Get the new index
let idx = indexToFileTable.Count
@@ -227,7 +227,7 @@ type FileIndexTable() =
fileToIndexTable[filePath] <- idx
// Return the index
- idx)
+ idx
member t.IndexToFile n =
if n < 0 then
diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj
index ffc935a2075..9be28c59bff 100644
--- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj
+++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj
@@ -316,6 +316,7 @@
+
diff --git a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FileIndex.fs b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FileIndex.fs
new file mode 100644
index 00000000000..0d5caabb982
--- /dev/null
+++ b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FileIndex.fs
@@ -0,0 +1,21 @@
+module Miscellaneous.FileIndex
+
+open FSharp.Compiler.Text
+open System.Threading.Tasks
+open Xunit
+
+// This is a regression test for a bug that existed in FileIndex.fileIndexOfFile
+[]
+let NoRaceCondition() =
+ let parallelOptions = ParallelOptions()
+ let mutable count = 10000
+ while count > 0 do
+ let file = $"test{count}.fs"
+ let files = Array.create 2 file
+ let indices = Array.create 2 -1
+ let getFileIndex i = indices[i] <- FileIndex.fileIndexOfFile files[i]
+ Parallel.For(0, files.Length, parallelOptions, getFileIndex) |> ignore
+ if indices[0] <> indices[1] then
+ Assert.Fail $"Found different indices: {indices[0]} and {indices[1]}"
+ count <- count - 1
+
\ No newline at end of file
From d838f1bdbb7c5f72aa28761ba0befc4e6a0540de Mon Sep 17 00:00:00 2001
From: Martin521 <29605222+Martin521@users.noreply.github.com>
Date: Fri, 15 Nov 2024 14:43:46 +0000
Subject: [PATCH 2/7] fantomas
---
src/Compiler/Utilities/range.fs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/Compiler/Utilities/range.fs b/src/Compiler/Utilities/range.fs
index b34ef4963c0..cece2c76648 100755
--- a/src/Compiler/Utilities/range.fs
+++ b/src/Compiler/Utilities/range.fs
@@ -193,7 +193,8 @@ type FileIndexTable() =
//
// TO move forward we should eventually introduce a new type NormalizedFileName that tracks this invariant.
member t.FileToIndex normalize filePath =
- lock fileToIndexTable <| fun () ->
+ lock fileToIndexTable
+ <| fun () ->
match fileToIndexTable.TryGetValue filePath with
| true, idx -> idx
| _ ->
From 7326da955cb9e888a0504b99a5ff6944b59df908 Mon Sep 17 00:00:00 2001
From: Martin521 <29605222+Martin521@users.noreply.github.com>
Date: Fri, 15 Nov 2024 15:59:49 +0000
Subject: [PATCH 3/7] fixed ilverify baselines (just a single line number
changed)
---
eng/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl | 2 +-
eng/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl | 2 +-
eng/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl | 2 +-
eng/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/eng/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl b/eng/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl
index 527bb371db2..9bd1b288922 100644
--- a/eng/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl
+++ b/eng/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl
@@ -59,7 +59,7 @@
[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x0000000B][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000CD][found Char] Unexpected type on the stack.
-[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@543::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method.
+[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@544::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method.
[IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000037][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000043][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : .$Internal.Utilities.XmlAdapters::.cctor()][offset 0x0000000A][found Char] Unexpected type on the stack.
diff --git a/eng/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl b/eng/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl
index 164060143d0..9c6129e3256 100644
--- a/eng/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl
+++ b/eng/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl
@@ -84,7 +84,7 @@
[IL]: Error [StackUnexpected]: : Internal.Utilities.FSharpEnvironment+probePathForDotnetHost@321::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000028][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.SimulatedMSBuildReferenceResolver+Pipe #6 input at line 68@68::FSharp.Compiler.CodeAnalysis.ILegacyReferenceResolver.Resolve([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyResolutionEnvironment, [S.P.CoreLib]System.Tuple`2[], string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>)][offset 0x0000034D][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000CD][found Char] Unexpected type on the stack.
-[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@543::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method.
+[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@544::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method.
[IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000037][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000043][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : .$Internal.Utilities.XmlAdapters::.cctor()][offset 0x0000000A][found Char] Unexpected type on the stack.
diff --git a/eng/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl b/eng/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl
index 7de0bcd6baf..d8a4775a6cd 100644
--- a/eng/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl
+++ b/eng/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl
@@ -85,7 +85,7 @@
[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x0000000B][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000B6][found Char] Unexpected type on the stack.
-[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@543::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method.
+[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@544::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method.
[IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000035][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000041][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : .$Internal.Utilities.XmlAdapters::.cctor()][offset 0x0000000A][found Char] Unexpected type on the stack.
diff --git a/eng/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl b/eng/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl
index 21b484b426d..2a5fa1240d1 100644
--- a/eng/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl
+++ b/eng/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl
@@ -111,7 +111,7 @@
[IL]: Error [StackUnexpected]: : Internal.Utilities.FSharpEnvironment::probePathForDotnetHost@320([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x0000002A][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.SimulatedMSBuildReferenceResolver+SimulatedMSBuildResolver@68::FSharp.Compiler.CodeAnalysis.ILegacyReferenceResolver.Resolve([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyResolutionEnvironment, [S.P.CoreLib]System.Tuple`2[], string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>)][offset 0x000002F5][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000B6][found Char] Unexpected type on the stack.
-[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@543::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method.
+[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@544::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method.
[IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000035][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000041][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : .$Internal.Utilities.XmlAdapters::.cctor()][offset 0x0000000A][found Char] Unexpected type on the stack.
From 09363e018420021def5490e2335b5bf60d6803ea Mon Sep 17 00:00:00 2001
From: Martin521 <29605222+Martin521@users.noreply.github.com>
Date: Tue, 19 Nov 2024 15:50:55 +0000
Subject: [PATCH 4/7] add release notes entry
---
docs/release-notes/.FSharp.Compiler.Service/9.0.200.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md b/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md
index 232853cfea5..b208d226ded 100644
--- a/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md
+++ b/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md
@@ -12,6 +12,7 @@
* Add warning when downcasting from nullable type to non-nullable ([PR #17965](https://github.com/dotnet/fsharp/pull/17965))
* Fix missing nullness warning in case of method resolution multiple candidates ([PR #17917](https://github.com/dotnet/fsharp/pull/17918))
* Fix failure to use bound values in `when` clauses of `try-with` in `seq` expressions ([# 17990](https://github.com/dotnet/fsharp/pull/17990))
+* Fix a race condition in file book keeping in the compiler service ([#18008](https://github.com/dotnet/fsharp/pull/18008))
### Added
From 1e554d6a817ee89ed0e9771ad2bda104201080e9 Mon Sep 17 00:00:00 2001
From: Martin521 <29605222+Martin521@users.noreply.github.com>
Date: Fri, 6 Dec 2024 17:34:06 +0000
Subject: [PATCH 5/7] FileToIndex: Added unlocked read so that lock is entered
for new files only
---
src/Compiler/Utilities/range.fs | 68 +++++++++++++++++----------------
1 file changed, 36 insertions(+), 32 deletions(-)
diff --git a/src/Compiler/Utilities/range.fs b/src/Compiler/Utilities/range.fs
index cece2c76648..09633136dbe 100755
--- a/src/Compiler/Utilities/range.fs
+++ b/src/Compiler/Utilities/range.fs
@@ -193,42 +193,46 @@ type FileIndexTable() =
//
// TO move forward we should eventually introduce a new type NormalizedFileName that tracks this invariant.
member t.FileToIndex normalize filePath =
- lock fileToIndexTable
- <| fun () ->
- match fileToIndexTable.TryGetValue filePath with
- | true, idx -> idx
- | _ ->
-
- // Try again looking for a normalized entry.
- let normalizedFilePath =
- if normalize then
- FileSystem.NormalizePathShim filePath
- else
- filePath
-
- match fileToIndexTable.TryGetValue normalizedFilePath with
- | true, idx ->
- // Record the non-normalized entry if necessary
- if filePath <> normalizedFilePath then
- fileToIndexTable[filePath] <- idx
-
- // Return the index
- idx
-
+ match fileToIndexTable.TryGetValue filePath with
+ | true, idx -> idx
+ | _ ->
+ // If a write operation can happen, we have to lock the whole read-check-write to avoid race conditions
+ lock fileToIndexTable
+ <| fun () ->
+ match fileToIndexTable.TryGetValue filePath with
+ | true, idx -> idx
| _ ->
- // Get the new index
- let idx = indexToFileTable.Count
- // Record the normalized entry
- indexToFileTable.Add normalizedFilePath
- fileToIndexTable[normalizedFilePath] <- idx
+ // Try again looking for a normalized entry.
+ let normalizedFilePath =
+ if normalize then
+ FileSystem.NormalizePathShim filePath
+ else
+ filePath
+
+ match fileToIndexTable.TryGetValue normalizedFilePath with
+ | true, idx ->
+ // Record the non-normalized entry if necessary
+ if filePath <> normalizedFilePath then
+ fileToIndexTable[filePath] <- idx
+
+ // Return the index
+ idx
+
+ | _ ->
+ // Get the new index
+ let idx = indexToFileTable.Count
+
+ // Record the normalized entry
+ indexToFileTable.Add normalizedFilePath
+ fileToIndexTable[normalizedFilePath] <- idx
- // Record the non-normalized entry if necessary
- if filePath <> normalizedFilePath then
- fileToIndexTable[filePath] <- idx
+ // Record the non-normalized entry if necessary
+ if filePath <> normalizedFilePath then
+ fileToIndexTable[filePath] <- idx
- // Return the index
- idx
+ // Return the index
+ idx
member t.IndexToFile n =
if n < 0 then
From f1abc28b49c54c53b8f3c483661a9cf3a80e49c1 Mon Sep 17 00:00:00 2001
From: Martin521 <29605222+Martin521@users.noreply.github.com>
Date: Fri, 6 Dec 2024 21:31:29 +0000
Subject: [PATCH 6/7] update ilverify baselines (changed line numbers only)
---
.../ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl | 2 +-
.../ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl | 2 +-
.../ilverify_FSharp.Compiler.Service_Release_net9.0.bsl | 2 +-
...lverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl | 4 ++--
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl
index 43e767c9438..b0992c3002b 100644
--- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl
+++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl
@@ -59,7 +59,7 @@
[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x0000000B][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000CD][found Char] Unexpected type on the stack.
-[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@544::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method.
+[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@548::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method.
[IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000037][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000043][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : .$Internal.Utilities.XmlAdapters::.cctor()][offset 0x0000000A][found Char] Unexpected type on the stack.
diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl
index fc69e4988de..9e5428620b7 100644
--- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl
+++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl
@@ -84,7 +84,7 @@
[IL]: Error [StackUnexpected]: : Internal.Utilities.FSharpEnvironment+probePathForDotnetHost@321::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000028][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.SimulatedMSBuildReferenceResolver+Pipe #6 input at line 68@68::FSharp.Compiler.CodeAnalysis.ILegacyReferenceResolver.Resolve([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyResolutionEnvironment, [S.P.CoreLib]System.Tuple`2[], string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>)][offset 0x0000034D][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000CD][found Char] Unexpected type on the stack.
-[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@544::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method.
+[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@548::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method.
[IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000037][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000043][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : .$Internal.Utilities.XmlAdapters::.cctor()][offset 0x0000000A][found Char] Unexpected type on the stack.
diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl
index 0b8ef2feb7f..d1f7525cef2 100644
--- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl
+++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl
@@ -85,7 +85,7 @@
[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x0000000B][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000B6][found Char] Unexpected type on the stack.
-[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@544::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method.
+[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@548::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method.
[IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000035][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000041][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : .$Internal.Utilities.XmlAdapters::.cctor()][offset 0x0000000A][found Char] Unexpected type on the stack.
diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl
index 44c2fffefdc..cd2141db471 100644
--- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl
+++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl
@@ -33,7 +33,7 @@
[IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+GetReferenceResolutionStructuredToolTipText@2205::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000076][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseMemberFunctionAndValues@176::Invoke([FSharp.Compiler.Service]FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue)][offset 0x0000002B][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseEntity@218::GenerateNext([S.P.CoreLib]System.Collections.Generic.IEnumerable`1&)][offset 0x000000BB][found Char] Unexpected type on the stack.
-[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.ParsedInput+visitor@1423-11::VisitExpr([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Compiler.Service]FSharp.Compiler.Syntax.SynExpr)][offset 0x00000620][found Char] Unexpected type on the stack.
+[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.ParsedInput+visitor@1423-11::VisitExpr([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Compiler.Service]FSharp.Compiler.Syntax.SynExpr)][offset 0x00000618][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-523::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000032][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-523::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x0000003B][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-523::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000064][found Char] Unexpected type on the stack.
@@ -111,7 +111,7 @@
[IL]: Error [StackUnexpected]: : Internal.Utilities.FSharpEnvironment::probePathForDotnetHost@320([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x0000002A][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.SimulatedMSBuildReferenceResolver+SimulatedMSBuildResolver@68::FSharp.Compiler.CodeAnalysis.ILegacyReferenceResolver.Resolve([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyResolutionEnvironment, [S.P.CoreLib]System.Tuple`2[], string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>)][offset 0x000002F5][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000B6][found Char] Unexpected type on the stack.
-[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@544::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method.
+[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@548::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method.
[IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000035][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000041][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : .$Internal.Utilities.XmlAdapters::.cctor()][offset 0x0000000A][found Char] Unexpected type on the stack.
From 932ad127c6453d5af9a15132a07a0049e757627e Mon Sep 17 00:00:00 2001
From: Vlad Zarytovskii
Date: Mon, 9 Dec 2024 17:41:41 +0100
Subject: [PATCH 7/7] Fix ILVerify
---
.../ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl
index cd2141db471..9de22b5cd79 100644
--- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl
+++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl
@@ -33,7 +33,7 @@
[IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+GetReferenceResolutionStructuredToolTipText@2205::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000076][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseMemberFunctionAndValues@176::Invoke([FSharp.Compiler.Service]FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue)][offset 0x0000002B][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseEntity@218::GenerateNext([S.P.CoreLib]System.Collections.Generic.IEnumerable`1&)][offset 0x000000BB][found Char] Unexpected type on the stack.
-[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.ParsedInput+visitor@1423-11::VisitExpr([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Compiler.Service]FSharp.Compiler.Syntax.SynExpr)][offset 0x00000618][found Char] Unexpected type on the stack.
+[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.ParsedInput+visitor@1423-11::VisitExpr([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Compiler.Service]FSharp.Compiler.Syntax.SynExpr)][offset 0x00000620][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-523::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000032][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-523::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x0000003B][found Char] Unexpected type on the stack.
[IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-523::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000064][found Char] Unexpected type on the stack.