Giraffe: Awaiting non-generic task

Created on 14 Feb 2018  路  4Comments  路  Source: giraffe-fsharp/Giraffe

According to the latest blog post, Giraffe now has a dependency on TaskBuilder. After upgrading to Giraffe 1.0 the compiler complains with the following error:

image

This is because CreateDB returns Task instead of Task<unit> which makes sense because it belongs to a C# project. However, if I replace the open Giraffe statement with open FSharp.Control.Tasks then it works. In other files were I only await generic tasks opening Giraffe is enough and I didn't need to touch anything.

Do you know why this happens (the task builder is exposed by Giraffe but it doesn't work with non-generic tasks)? Can it be fixed?

documentation

All 4 comments

open FSharp.Control.Tasks.ContextInsensitive

I'll put a big note in the docs so it's more obvious.

Thanks for the tip, as commented above just open FSharp.Control.Tasks works for me.

BTW, I also took a while until I discover you need to do services.AddGiraffe() now or you'll get a NRE whenever you use the negotiation helpers, like OK, etc... It'll be nice to make that prominent in the docs too.

Agreed, have another issues for this already open! Will do in a bit as well!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

panesofglass picture panesofglass  路  4Comments

dustinmoris picture dustinmoris  路  7Comments

Lanayx picture Lanayx  路  4Comments

Disco-Dave picture Disco-Dave  路  4Comments

dustinmoris picture dustinmoris  路  5Comments