These are chat archives for Microsoft/visualfsharp

11th
Sep 2017
Mark Vincze
@markvincze
Sep 11 2017 08:14

Hey folks,
I have a question about async workflows in .NET Core 2.0:
In one of my projects I had this line in the code:

async {
  ...
  do! tran.CommitAsync()
}

Where CommitAsync() returns a Task. After upgrading to .NET Core 2.0, it gives a build error saying This expression was expected to have type 'Async<unit>', and I have to change it to this to make it compile:

async {
  ...
  do! tran.CommitAsync() |> Async.AwaitIAsyncResult |> Async.Ignore
}

Do you know what's the reason for this? Was something changed in the compiler?

Mark Vincze
@markvincze
Sep 11 2017 14:09

It turns out this wasn't caused by the .NET Core 2.0 updgrade, but by changing the first line of the fsproj from

<Project Sdk="FSharp.NET.Sdk;Microsoft.NET.Sdk">

to this:

<Project Sdk="Microsoft.NET.Sdk">

I'm still investigating why this is causing this issue.