From 05b831982d39377a1b30017e0196b24d1543d29a Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Wed, 25 Feb 2026 18:58:37 +0100 Subject: [PATCH] DotNetBuildUseMonoRuntime stackguard --- azure-pipelines-PR.yml | 3 +++ .../Driver/GraphChecking/FileContentMapping.fs | 15 ++++++++++++++- src/Compiler/FSharp.Compiler.Service.fsproj | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/azure-pipelines-PR.yml b/azure-pipelines-PR.yml index d775d9ed907..3c13a6899bf 100644 --- a/azure-pipelines-PR.yml +++ b/azure-pipelines-PR.yml @@ -207,6 +207,9 @@ stages: - name: 'Managed' container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9' buildArguments: '--source-build' + - name: 'Managed_MonoRuntime' + container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9' + buildArguments: '--source-build /p:DotNetBuildUseMonoRuntime=true' enableTelemetry: true helixRepo: dotnet/fsharp jobs: diff --git a/src/Compiler/Driver/GraphChecking/FileContentMapping.fs b/src/Compiler/Driver/GraphChecking/FileContentMapping.fs index 12881a8dbe2..26c73f8e96f 100644 --- a/src/Compiler/Driver/GraphChecking/FileContentMapping.fs +++ b/src/Compiler/Driver/GraphChecking/FileContentMapping.fs @@ -2,6 +2,7 @@ open FSharp.Compiler.Syntax open FSharp.Compiler.SyntaxTreeOps +open FSharp.Compiler.DiagnosticsLogger type Continuations = ((FileContentEntry list -> FileContentEntry list) -> FileContentEntry list) list @@ -362,7 +363,16 @@ let (|NameofExpr|_|) (e: SynExpr) : NameofResult voption = | _ -> ValueNone let visitSynExpr (e: SynExpr) : FileContentEntry list = +#if BUILD_USING_MONO + let rec visitGuarded + (sg: StackGuard) + (e: SynExpr) + (continuation: FileContentEntry list -> FileContentEntry list) + : FileContentEntry list = + let visit e c = sg.Guard(fun () -> visitGuarded sg e c) +#else let rec visit (e: SynExpr) (continuation: FileContentEntry list -> FileContentEntry list) : FileContentEntry list = +#endif match e with | NameofExpr nameofResult -> continuation [ visitNameofResult nameofResult ] | SynExpr.Const _ -> continuation [] @@ -559,8 +569,11 @@ let visitSynExpr (e: SynExpr) : FileContentEntry list = | SynExpr.Dynamic(funcExpr, _, argExpr, _) -> let continuations = List.map visit [ funcExpr; argExpr ] Continuation.concatenate continuations continuation - +#if BUILD_USING_MONO + visitGuarded (StackGuard(nameof (FileContentMapping))) e id +#else visit e id +#endif /// Special case of `| nameof Module ->` type of pattern [] diff --git a/src/Compiler/FSharp.Compiler.Service.fsproj b/src/Compiler/FSharp.Compiler.Service.fsproj index cc8865d2578..5b1d11f9242 100644 --- a/src/Compiler/FSharp.Compiler.Service.fsproj +++ b/src/Compiler/FSharp.Compiler.Service.fsproj @@ -14,6 +14,7 @@ FSharp.Compiler.Service true $(DefineConstants);COMPILER + $(DefineConstants);BUILD_USING_MONO enable