From c9bfdd7f9ed90e5d53255d035c68765b4b7ec714 Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Thu, 15 Sep 2022 11:39:29 -0700 Subject: [PATCH 1/3] Fix shadowcopyduringdebug --- src/fsi/fsimain.fs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/fsi/fsimain.fs b/src/fsi/fsimain.fs index 57aee5ca360..fb502d3cec5 100644 --- a/src/fsi/fsimain.fs +++ b/src/fsi/fsimain.fs @@ -394,14 +394,24 @@ let MainMain argv = || x = "/shadowcopyreferences+" || x = "--shadowcopyreferences+") + let executeFsi shadowCopyFiles = + if shadowCopyFiles then + let setupInformation = AppDomain.CurrentDomain.SetupInformation + setupInformation.ShadowCopyFiles <- "true" + let helper = AppDomain.CreateDomain("FSI_Domain", null, setupInformation) + helper.ExecuteAssemblyByName(Assembly.GetExecutingAssembly().GetName()) + else + evaluateSession (argv) + if AppDomain.CurrentDomain.IsDefaultAppDomain() && argv |> Array.exists isShadowCopy then - let setupInformation = AppDomain.CurrentDomain.SetupInformation - setupInformation.ShadowCopyFiles <- "true" - let helper = AppDomain.CreateDomain("FSI_Domain", null, setupInformation) - helper.ExecuteAssemblyByName(Assembly.GetExecutingAssembly().GetName()) + try + executeFsi true + with + | :? FileLoadException -> + executeFsi false else evaluateSession (argv) #else From 62a6edae19e2c0ad6d7c9ecb919bd595f0472dc8 Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Thu, 15 Sep 2022 12:13:28 -0700 Subject: [PATCH 2/3] tweaks --- src/fsi/fsimain.fs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/fsi/fsimain.fs b/src/fsi/fsimain.fs index fb502d3cec5..768b5b0aea1 100644 --- a/src/fsi/fsimain.fs +++ b/src/fsi/fsimain.fs @@ -403,17 +403,15 @@ let MainMain argv = else evaluateSession (argv) - if - AppDomain.CurrentDomain.IsDefaultAppDomain() - && argv |> Array.exists isShadowCopy - then - try - executeFsi true - with - | :? FileLoadException -> - executeFsi false - else - evaluateSession (argv) + let tryShadowCopy = + AppDomain.CurrentDomain.IsDefaultAppDomain() && argv + |> Array.exists isShadowCopy + + try + executeFsi tryShadowCopy + with + | :? FileLoadException -> + executeFsi false #else evaluateSession (argv) #endif From 576e5a47b3865ea2a4b7044b8816d389ada00778 Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Thu, 15 Sep 2022 12:17:05 -0700 Subject: [PATCH 3/3] fantomas --- src/Microsoft.FSharp.Compiler/Program.fs | 2 +- src/fsi/fsimain.fs | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.FSharp.Compiler/Program.fs b/src/Microsoft.FSharp.Compiler/Program.fs index 0a254518203..051a8f6f309 100644 --- a/src/Microsoft.FSharp.Compiler/Program.fs +++ b/src/Microsoft.FSharp.Compiler/Program.fs @@ -1,2 +1,2 @@ [] -let main _ = 0 \ No newline at end of file +let main _ = 0 diff --git a/src/fsi/fsimain.fs b/src/fsi/fsimain.fs index 768b5b0aea1..d4394269ff4 100644 --- a/src/fsi/fsimain.fs +++ b/src/fsi/fsimain.fs @@ -404,13 +404,12 @@ let MainMain argv = evaluateSession (argv) let tryShadowCopy = - AppDomain.CurrentDomain.IsDefaultAppDomain() && argv - |> Array.exists isShadowCopy + AppDomain.CurrentDomain.IsDefaultAppDomain() + && argv |> Array.exists isShadowCopy try executeFsi tryShadowCopy - with - | :? FileLoadException -> + with :? FileLoadException -> executeFsi false #else evaluateSession (argv)