dotnet / dotnet/fsharp

fsi reference order matter

Open
#3,600 7 comments 0 reactions 0 assignees View on GitHub
Area-FSI Bug Impact-Low
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

## scenario

User has a working project, and try to run some part in fsi, so:

1. send the references to fsi, correctly
2. evaluate some code => error

```
stdin(7,5): error FS0074: The type referenced through '' is defined in an assembly that is not referenced. You must add a reference to assembly ''.
```

but was already sent to fsi and referenced correctly.

The error happen if:
- exists `Assembly1` and `Assembly2`
- `Assembly2` depend on `Assembly1`
- the `Assembly2` is `#r`'d before `Assembly1` . both #r are correct. (`--> Referenced 'Assembly' (file may be locked by F# Interactive process) `)

### Repro

based on detailed repro of @chanjunweimy in https://github.com/ionide/ionide-vscode-fsharp/issues/539

- clone https://github.com/chanjunweimy/fsi-issue
- restore it

```fsharp
#r @"\mathnet.numerics.fsharp\3.20.0\lib\net40\MathNet.Numerics.FSharp.dll"
#r @"\mathnet.numerics\3.20.0\lib\net40\MathNet.Numerics.dll"
```

if i try to

```fsharp
open MathNet.Numerics.LinearAlgebra;

let MatrixToRowSeqSeq matrix1 =
Matrix.toRowArrays matrix1
|> Array.map Array.toSeq
|> Array.toSeq
```

then fails.

If i invert the order or loading, so first `MathNet.Numerics.dll` and after `MathNet.Numerics.FSharp.dll` it succed.

As a note, `fsc` with same order build correctly

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.