Closed Junjun-zhao closed 7 months ago
This is a bug in the FreeSql library. This line is expecting there to only be one overload of TimeSpan.FromSeconds, but there are now multiple overloads, which leads to GetMethod throwing an ambiguity exception because it doesn't know which method to bind to: https://github.com/dotnetcore/FreeSql/blob/e1f91ef361ca4a6eac7f217bd4a474047597e4e3/FreeSql/Internal/UtilsExpressionTree.cs#L2172
This is a bug in the FreeSql library. This line is expecting there to only be one overload of TimeSpan.FromSeconds, but there are now multiple overloads, which leads to GetMethod throwing an ambiguity exception because it doesn't know which method to bind to: https://github.com/dotnetcore/FreeSql/blob/e1f91ef361ca4a6eac7f217bd4a474047597e4e3/FreeSql/Internal/UtilsExpressionTree.cs#L2172
Thank you @stephentoub for looking into this issue so quickly. We've filed an Freesql issue to notify the owner about this issue. Closing this issue.
FreeSql.3.2.816-preview20240314
Description
When running 3rd party application with the latest .NET 9 build, it stops working after launching. After investigation, we found it is caused by FreeSql. The exception from Visual Studio output window is: Ambiguous match found for 'System.TimeSpan System.TimeSpan FromSeconds(Int64)'.
Reproduction Steps
Minimal Repro steps (Demo attached:ConsoleDemo.zip): The machine has dotnet-sdk-9.0.100-preview.3.24160.1 installed. 1.Create a new net8.0 Console project. 2.Copy the following code to Program.cs.
3.Install FreeSql.Provider.SqlServer nuget package. 4.Build the app. 5.Change the runtime.config file to let the app run against with dotnet-sdk-9.0.100-preview.3.24160.1.
Expected behavior
Launch successfully.
Actual behavior
System.TypeInitializationException: 'The type initializer for 'FreeSql.Internal.Utils' threw an exception.' AmbiguousMatchException: Ambiguous match found for 'System.TimeSpan System.TimeSpan FromSeconds(Int64)'.
Regression?
Yes Verify Scenarios: 1). Windows 10 21H2 AMD64 + dotnet-sdk-8.0.101: Pass 2). Windows 10 21H2 AMD64 + dotnet-sdk-9.0.100-preview.2.24129.7: Pass 3). Windows 10 21H2 AMD64 + dotnet-sdk-9.0.100-preview.3.24160.1: Fail
Known Workarounds
No response
Configuration
Application Name: EasyCMS,CastIt,HyggeImaotai OS: Windows 10 21H2 CPU: X64 .NET Build Number: dotnet-sdk-9.0.100-preview.3.24160.1 App & Source Location checking at: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1992393 Github Link: https://github.com/yushuo1990/EasyCMS https://github.com/Wolfteam/CastIt https://github.com/lisongkun/HyggeImaotai
Other information
Dotnet Info:
@dotnet-actwx-bot @dotnet/compat