InvalidCastException after upgrading to EF Core 5.0

时光总嘲笑我的痴心妄想 提交于 2021-01-29 07:05:28

问题


I've just upgraded my project from .NET Core 3.1 to .NET 5.0 and updating all packages to the latest version. All built fine, but now I'm having trouble loading some entities, getting this error:

Unable to cast object of type 'Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader' to type 'Microsoft.Data.SqlClient.SqlDataReader'.'

I'm not certain, but I have a couple of entities which have an Address property which is an[Owned] type which has a NetTopologySuite.Geometries.Point property, and I suspect perhaps this is the culprit.

I'm sorry that this question is so vague but I'm pretty stumped on what's wrong here, or how to diagnose it any further, if anyone has any ideas or pointers I'd be very grateful to hear them!

Edit: It's definitely an issue with NetTopologySuite. Barebones project here demonstrating the error

来源:https://stackoverflow.com/questions/64779031/invalidcastexception-after-upgrading-to-ef-core-5-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!