-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
SQLite doesn't work when trimming #27311
Comments
Duplicate of #26288 |
This comment was marked as spam.
This comment was marked as spam.
EF Core 6.0 isn't yet compatible for trimming friendliness, so errors such as the above may occur. Trimming friendliness is a goal for 7.0, in the meantime you should be able to work around this by specifying DateOnly.AddYears (and other missing APIs) in a root descriptor file. @ajcvickers we could patch 6.0 with a low-risk hack to unblock this, much like we did in #27098 for Math, though we can also wait for more feedback. |
Note from triage: workaround is sufficient for now. We may patch if we get more reports. |
Reopening to rediscuss patching this as per #27474 (comment) (this would be very low-risk, similar to #27098). |
This comment was marked as spam.
This comment was marked as spam.
Note for triage: bring to Tactics to patch for MAUI experience. |
Allows SQLite to be used when trimming. Fixes dotnet#27311
Submitted #27910 for patching this in 6.0. Manually verified that before the fix a minimal trimmed EF SQLite fails with the above error (missing DateOnly method), and after the fix the application works. |
Description
当我使用asp.net webapi在构建一个服务时,使用了efcore,数据库使用的是sqlite,但我在debug模式下进行调试开发的时候api接口可以正常调用,但是当我release之后(单文件single file),接口就无法调用,无论我通过visual
studio进行publish还是通过dotnet publish -c Release -r win-x64 --self-contained -p:PublishSingleFile=True -p:IncludeNativeLibrariesForSelfExtract=true -p:PublishTrimmed=True
-p:ReadyToRun=True进行打包发布,接口调用都无法执行,根据错误日志System.InvalidOperationException: Could not find method 'AddYears' on type 'System.DateOnly'
中的提示,我没有找到我的应用程序中sqlite中有datetime或者dateonly类型的实体model,我的dbcontext中也没有对应datetime的字段或者dateonly的字段没所以我不清楚这个问题是从何而来Configuration
.net6.0.1
win10 1836
x64
blazorwasm in nginx Error 403
Regression?
The text was updated successfully, but these errors were encountered: