Open jp-fournier-dev opened 2 years ago
To add some context :
.End
property that results in the value ()
. This isn't amazing code, but it does provide some level of clarity better than having ignore
This seems more like and edge case, but still offers plenty of surprise when it happens
It seems that this function is not even called. state machine's MoveNext method from original code:
when that line is changed to someFunctionWithReturnType() |> ignore
Please provide a succinct description of the issue.
When executing inside a
task
, a function that raises an exception is not called if the resulting expression ends in a property that has a unit value.Provide the steps required to reproduce the problem:
failwith
using :dotnet run --configuration Debug
dotnet run --configuration Release
Provide a description of the expected behavior.
In both
debug
andrelease
, the program fails after the exception is raisedProvide a description of the actual behavior observed.
In
release
, the exception is essentially ignored and nothing happens. Program exits successfully Indebug
, the exception is raised and the program failsProvide a description of any known workarounds.
You can pretty easily change this by switching it to being a function like so :
member x.End = ignore
and calling said function. Using`member x.End() = ()
will not workDoing so inside an
async
computation expression will result in the expected behavior with the original codeProvide any related information:
Operating system: Windows 10 NET Runtime kind : .NET 6.0.201