Question: How do you resolve the Entity Framework Error that says, InvalidCastException: Unable to cast object of type
Microsoft EntityFrameworkCore Query Internal EntityQueryable
System Threading Tasks.Task 1[System Collections Generic IEnumerable]
'Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1[ClassName]' to type 'System.Threading.Tasks.Task`1[System.Collections.Generic.IEnumerable`1[ClassName]]'
Solution: When this error happens, chances are that you have created a function in the Repository Class without specifying the function as "async" and/or you might have attempted to cast the whole result set from the database into an IEnumerable because that is what the IntelliSense recommended you.
Login to Continue, We will bring you back to this content 0