Skip to content
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

[6.0.x] Add [DynamicDependency] on DateOnly/TimeOnly for trimming #27910

Merged
merged 1 commit into from
May 6, 2022

Conversation

roji
Copy link
Member

@roji roji commented Apr 28, 2022

Description

Due to EF Core using wrappers to look up methods via reflection (GetRequiredRuntimeMethod), the linker cannot see the dependency on those methods, and trimmed applications fail.

Customer impact

It isn't possible to use EF Core's SQLite provider in a trimmed application.

How found

Customer report on 6.0

Regression

Yes, from 5.0. Although EF Core 5.0 was never officially trimming-compatible, at least basic scenarios were possible.

Testing

Coverage will be added in 7.0, where trimming will be a focus. The fix was verified manually.

Note that EF Core 6.0 still won't be fully trimming-compatible, but this unlocks at least the basic SQLite scenarios which customers were asking for.

Risk

Very low - the fix only adds an attribute which is meaningful only to the linker.

Details

This uses the [DynamicDependency] attribute to make sure System.DateOnly and TimeOnly aren't trimmed when using EF Core.

Fixes #27311
Similar to #27098

Allows SQLite to be used when trimming.

Fixes dotnet#27311
@roji roji changed the base branch from main to release/6.0 April 28, 2022 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SQLite doesn't work when trimming
3 participants