Skip to content

GraphBasedChecking fails when exceptions are defined #17262

@Smaug123

Description

@Smaug123

Enabling GraphBasedChecking can cause compilation to fail.

Repro steps

Create Repro.fsproj:

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

    <PropertyGroup>
        <TargetFramework>net8.0</TargetFramework>
        <OtherFlags>$(OtherFlags) --test:GraphBasedChecking --warnaserror-:75 --nowarn:75</OtherFlags>
    </PropertyGroup>

    <ItemGroup>
        <Compile Include="Blah.fs" />
        <Compile Include="Program.fs"/>
    </ItemGroup>

</Project>

Create Blah.fs:

namespace Foo

exception internal Blah

Create Program.fs:

namespace Foo

module Program =

    [<EntryPoint>]
    let main _ =
        raise Blah
        0

Expected behavior

Build succeeds.

Actual behavior

0>Program.fs(7,15): Error FS0039 : The value or constructor 'Blah' is not defined.
0>------- Finished building project: Repro. Succeeded: False. Errors: 1. Warnings: 0

Known workarounds

Disable GraphBasedChecking.

Related information

Provide any related information (optional):

dotnet --info                                                                                                                                                                                                                ~/Documents/GitHub/Repro
.NET SDK:
 Version:           8.0.300
 Commit:            326f6e68b2
 Workload version:  8.0.300-manifests.c1c70047
 MSBuild version:   17.10.4+10fbfbf2e

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  14.5
 OS Platform: Darwin
 RID:         osx-arm64
 Base Path:   /nix/store/cjfvjcg710nrihrcprxfa9rnxgdy2d24-dotnet-sdk-8.0.300/sdk/8.0.300/

.NET workloads installed:
There are no installed workloads to display.

Host:
  Version:      8.0.5
  Architecture: arm64
  Commit:       087e15321b

.NET SDKs installed:
  8.0.300 [/nix/store/cjfvjcg710nrihrcprxfa9rnxgdy2d24-dotnet-sdk-8.0.300/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.5 [/nix/store/cjfvjcg710nrihrcprxfa9rnxgdy2d24-dotnet-sdk-8.0.300/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.5 [/nix/store/cjfvjcg710nrihrcprxfa9rnxgdy2d24-dotnet-sdk-8.0.300/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions