Skip to content

Commit 24c055d

Browse files
authored
No STAThread on coreclr build of fsi. (#10122)
1 parent 20dec2a commit 24c055d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/fsharp/fsi/fsimain.fs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,13 @@ let evaluateSession(argv: string[]) =
302302
| e -> eprintf "Exception by fsi.exe:\n%+A\n" e; 1
303303

304304
// Mark the main thread as STAThread since it is a GUI thread
305+
// We only set this for the desktop build of fsi.exe. When we run on the coreclr we choose not to rely
306+
// On apartment threads. A windows NanoServer docker container does not support apartment thread
307+
#if !FX_NO_WINFORMS
308+
[<STAThread()>]
309+
#endif
305310
[<EntryPoint>]
306-
[<STAThread()>]
307-
[<LoaderOptimization(LoaderOptimization.MultiDomainHost)>]
311+
[<LoaderOptimization(LoaderOptimization.MultiDomainHost)>]
308312
let MainMain argv =
309313
ignore argv
310314
let argv = System.Environment.GetCommandLineArgs()

0 commit comments

Comments
 (0)