Program stuck when using an async/task operation before an `EntryPoint` instruction
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
Please provide a succinct description of the issue.
**Repro steps**
Provide the steps required to reproduce the problem:
1. Create an `Build.fsproj` file with the following content
```xml
Exe
net6.0
```
2. Create a `Build.fs` file with the following content
```fs
open System.IO
let deployPath = Path.GetFullPath "deploy"
printfn "1"
async {
printfn "2 %s" deployPath
}
|> Async.RunSynchronously
[]
let main args =
printfn "3"
0
```
3. Run `dotnet run` and see that the program print `1` and then get stuck.
Here is a zip, with the everything already set up. You can unzip it and run `dotnet run`
[Reproduction.zip](https://github.com/dotnet/fsharp/files/12092846/Reproduction.zip)
**Expected behavior**
We should see:
```
1
2 XXXX
3
```
**Actual behavior**
Program get stuck after printing `1`
**Known workarounds**
Move the `async` instruction inside the `EntryPoint`
Remove the `EntryPoint` instruction.
**Related information**
Provide any related information (optional):
* Operating system: macOS 13.4.1 (c) (22F770820d)
* .NET Runtime kind (.NET Core, .NET Framework, Mono) .NET Core 6 or 8 preview
* Editing Tools (e.g. Visual Studio Version, Visual Studio)
Contributor guide
Assessment
This issue has not been assessed yet.