-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
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.
using FreeSql;
string ConnetionString = "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=Demo;";
var freeBuilder = new FreeSqlBuilder().UseConnectionString(DataType.SqlServer, ConnetionString).Build();
Console.WriteLine(freeBuilder);
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.
"framework": {
"name": "Microsoft.NETCore.App",
"version": "9.0.0-preview.3.24157.12"
}
- Launch the app.
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:
.NET SDK:
Version: 9.0.100-preview.3.24160.1
Commit: 232d2df252
Workload version: 9.0.100-manifests.9f73df61
MSBuild version: 17.10.0-preview-24127-03+6f44380e4
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.100-preview.3.24160.1\
.NET workloads installed:
There are no installed workloads to display.
Host:
Version: 9.0.0-preview.3.24157.12
Architecture: x64
Commit: da781b3aab
.NET SDKs installed:
9.0.100-preview.3.24160.1 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 9.0.0-preview.3.24157.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 9.0.0-preview.3.24157.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 9.0.0-preview.3.24158.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
@dotnet-actwx-bot @dotnet/compat