dotnet / dotnet/fsharp

Emit a warning when referencing console applications exe's without a main

Open
#602 5 comments 0 reactions 0 assignees View on GitHub
Area-Diagnostics Bug Impact-Medium Theme-Simple-F#
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

Create a solution with two Console Application projects:

ConsoleApplication1\Program.fs:

``` f#
module SharedValue
let hello = "Hello" |> id
```

ConsoleApplication2\Program.fs (references ConsoleApplication1)

``` f#
match SharedValue.hello with
| null -> printfn "SharedValue.hello is null!"
| _ -> printfn "all good"
```

Expected output: `all good`
Actual output: `SharedValue.hello is null!`

needless to say, getting a null value from an F# project is quite surprising.

Changing the type of ConsoleApplication1 to a Library fixes this.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.