Conversation
❗ Release notes requiredCaution No release notes found for the changed paths (see table below). Please make sure to add an entry with an informative description of the change as well as link to this pull request, issue and language suggestion if applicable. Release notes for this repository are based on Keep A Changelog format. The following format is recommended for this repository:
If you believe that release notes are not necessary for this PR, please add NO_RELEASE_NOTES label to the pull request. You can open this PR in browser to add release notes: open in github.dev
|
Add StackGuard for
visitSynExprunder Mono runtime + source-build CI for Mono configurationProblem
The
visitSynExprfunction inFileContentMapping.fsuses deep recursion through a continuation-passing stylevisitfunction. On Mono-based .NET runtimes (used in certain VMR source-build configurations), the default stack size is smaller, which can lead toStackOverflowExceptionwhen processing deeply nested syntax trees.Changes
Compiler: StackGuard for Mono runtime (
FileContentMapping.fs)When building with
DotNetBuildUseMonoRuntime=true, the recursivevisitfunction invisitSynExpris replaced with avisitGuardedvariant that usesStackGuardto check remaining stack space and spill to a new thread when needed. This is gated behind#if BUILD_USING_MONOso the CoreCLR path remains unchanged.open FSharp.Compiler.DiagnosticsLoggerforStackGuardaccess.BUILD_USING_MONO:visitGuardedtakes aStackGuardparameter; each recursivevisitcall goes throughsg.Guard(...).visitfunction is kept as-is with no overhead.Project: conditional
BUILD_USING_MONOdefine (FSharp.Compiler.Service.fsproj)Added
<DefineConstants>that setsBUILD_USING_MONOwhenDotNetBuildUseMonoRuntimeistrue, matching the convention used by the VMR (dotnet/dotnet) for Mono source-build scenarios.CI: second source-build platform for Mono configuration (
azure-pipelines-PR.yml)Added a
Managed_MonoRuntimesource-build platform that passes/p:DotNetBuildUseMonoRuntime=truealongside--source-build. This exercises the Mono code paths in PR CI. The property flows throughbuild.sh->eng/build.sh-> MSBuild via the existing/p:*pass-through mechanism.