dotnet / dotnet/fsharp

dotnet fsi command line: -- has no effect

Open
#18,983 1 comment 1 reaction 0 assignees View on GitHub
Area-FSI Bug
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

It should be possible to pass a command line argument without trying to run it. I'm just now migrating from framework and I can't find any way to pass an argument to my script.

**Repro steps**

```
printfn "fsi.CommandLineArgs.Length = %d" fsi.CommandLineArgs.Length
fsi.CommandLineArgs |> Array.iteri (fun i arg -> printfn " [%d] = %s" i arg)
```

>dotnet fsi --use:test_args.fsx -- myarg

**Expected behavior**
(as seen with the Framework: fsi --use:test_args.fsx -- myarg)

> fsi.CommandLineArgs.Length = 2
[0] = test_args.fsx
[1] = myarg

**Actual behavior**
> fsi.CommandLineArgs.Length = 1
[0] = myarg

stdin(0,1): error FS0078: Unable to find the file 'myarg' in any of
C:\

**Known workarounds**

None

**Related information**

* Windows 11
* .NET Core (Microsoft (R) F# Interactive version 13.9.303.0 for F# 9.0)

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.