-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The new TimeSpan FromMilliseconds overload breaks System.Linq.Expressions #109833
Comments
Tagging subscribers to this area: @cston |
Introduced with #93890 |
Tagging subscribers to this area: @dotnet/area-system-datetime |
Tagging subscribers to this area: @cston |
I was under the impression that exposing methods with default parameters in public APIs was frowned upon, and that it was best to just have multiple overloads instead. Does anybody know if that's not really the case, or if it still applies, why these new APIs for |
The approved API said
But the actual API missed the milliseconds overload and consequently didn't implement it in #98633. |
Tagging subscribers to this area: @dotnet/area-system-datetime |
Just to mention the other workaround can be providing the optional parameter: Expression<Action> a = () => TimeSpan.FromMilliseconds(1000, 0); Thanks @Tragetaschen for reporting the issue. |
Description
I have seen the breaking change notice with regards to F#, but migrating to .NET 9 has revealed a couple of places in our C# projects, where constructing a TimeSpan is part of a System.Linq.Expressions.Expression. These now don't compile with .NET 9
Reproduction Steps
Expected behavior
Code continues to compile
Actual behavior
Code breaks in .NET 9
Regression?
yes
Known Workarounds
You need to force the
double
overloador provide the optional parameter
Configuration
No response
Other information
The reason is that the optional parameters are not supported in expressions.
The text was updated successfully, but these errors were encountered: