You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ValueOption optional parameters cannot be passed as ValueOptions #19711
Optional arguments using F# 10 ValueOption parameters cannot be passed using the question-mark syntax: SomeMethodWithValueOptionOptionalParameter(?parameter = valueOptionValueHere) does not work.
Repro steps
typeOptionalArguments()=member_.NoProblem(?number :int32)=()member_.Problem([<Struct>]?number :int32)=()memberthis.Test()=
this.NoProblem 123// Works
this.NoProblem (number =123)// Works
this.NoProblem (?number = None)// Works
this.NoProblem (?number = Some 123)// Works
this.NoProblem (?number = Unchecked.defaultof<_>)// Works
this.Problem 123// Works
this.Problem (number =123)// Works
this.Problem (?number = ValueNone)// Does not work
this.Problem (?number = ValueSome 123)// Does not work
this.Problem (?number = Unchecked.defaultof<_>)// Does not work// Type constraint mismatch. The type ''a option' is not compatible with type 'int32 voption'
Expected behavior
All the cases above should work.
Actual behavior
The optional ValueOption parameter cannot be passed explicitly using the question-mark syntax.
Known workarounds
Remove the [<Struct>] attribute to transform the parameter into a reference-type optional parameter.
Related information
Ubuntu 24.04
.NET Runtime: Core 10.0.107 [/usr/lib/dotnet/sdk]
F# Interactive: Microsoft (R) F# Interactive version 14.0.107.0 for F# 10.0
Activity
Fix ValueOption optional args via ?param caller syntax (#19711)
brianrourkeboll commentedon May 15, 2026
Duplicate of #19074.
Fix ValueOption optional args via ?param caller syntax (#19711) (#19742)
Fix ValueOption optional args via ?param caller syntax (#19711) (#19742)
[feature/net11-scouting] Update dependencies from dotnet/arcade (#19874)
[feature/net11-scouting] Update dependencies from dotnet/arcade (#19910)