Closed as not planned
Closed as not planned
Description
If users were to use the trimming option in .NET 6, one might face this exception if they used Migrate() or MigrateAsync() API.
Could not find method 'AddYears' on type 'System.DateOnly' at System.SharedTypeExtensions.GetRequiredRuntimeMethod(Type type, String name, Type[] parameters)
For now, it can be workaround with adding a line of code (preferably in main class) or using rd.xml
/// <summary>
/// FIXME: This is required for EF Core 6.0 as it is not compatible with trimming.
/// </summary>
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]
private static Type _keepDateOnly = typeof(DateOnly);
Include provider and version information
EF Core version: 6.0.0
Database provider: Microsoft.EntityFrameworkCore.Sqlite
Target framework: .NET 6.0
Operating system: Windows 10
IDE: Visual Studio 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment