Closed
Description
The following code:
open System
type T2 () =
member this.f b =
if b = Unchecked.defaultof<Guid> then
failwith "Houlala gross problem!"
else
hash(b)
[<EntryPoint>]
let main args =
try
T2().f (Guid.NewGuid()) |> ignore
with e -> printfn "%s" e.Message
0
in the following project:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.fs" />
</ItemGroup>
</Project>
gives an incorrect output when compiled in release. The exception is thrown.
The correct output is given when program is compiled in debug (eixt status of 0 without any output) or when compiled targeting .NET 5.
dotnet info output is:
dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.100
Commit: 9e8b04bbff
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.100\
Host (useful for support):
Version: 6.0.0
Commit: 4822e3c