-
Notifications
You must be signed in to change notification settings - Fork 833
Description
A project that is part of a reasonably complex solution is failing to build in 2022 due to the compiler crashing. I've managed to boil things down to a simple, standalone repro shown below.
Repro steps
The following simplified code typifies that which is causing the compiler to crash:
module repro_fscanycpu_failure
//
// This builds fine in VS2019, but fails under VS2022 with:
//
// 1> Process is terminated due to StackOverflowException.
// 1> C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\CommonExtensions\Microsoft\FSharp\Tools\Microsoft.FSharp.Targets(317,9): error MSB6006: "fscAnyCpu.exe" exited with code -1073741571.
//
// Opening this file in the VS2022 editor will also crash, presumably for the same underlying reason.
//
type ReproBuilder () =
member _.Delay x = x ()
member _.Yield (x) = x
member _.Combine (x, y) = x + y
let repro = ReproBuilder ()
let callSite () =
repro {
// Commenting out some of the below is enough to avoid StackOverflow on my machine.
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
}Expected behavior
It should build in 2022 as it does in 2019.
Actual behavior
It fails with:
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\CommonExtensions\Microsoft\FSharp\Tools\Microsoft.FSharp.Targets(317,9): error MSB6006: "fscAnyCpu.exe" exited with code -1073741571.
Known workarounds
-
Short-term fix: Use VS2019.
-
Recommended: Make your inputs smaller, probably half the size will do, divide your large expressions into two
Related information
Provide any related information (optional):
- Windows 10
- .NET Core