✅ System.NotSupportedException with EF Core
quick question:
gives me a NotSupportedException but how do i fix that?
dataclass:
15 Replies
what are the details of the exception?
i suspect it's because you modeled your navigation as
IEnumerable<T>
when EF requires a type implementing ICollection<T>
give me a second
i have a hard time already getting the inner exception as its only shown in debugger but not triggerd by a try catch
the inner exception equals to "null"
Try an ICollection or List instead of IEnumerable as the navigation property.
do i need to remigrate the db for that?
i doubt it
then i have the same error with the ICollection too
that screenshot from before doesn't look like you are inspecting an exception, it looks like you are trying to inspect the dbset, which then is giving an exception when you access a certian property within it
yeah, pretty sure the red highlight means it's an error coming from the IDE
well otherwise i dont get any exception
and the frontend just freezes
try to make a minimum reproduction of the issue
get rid of the async, test the database access by itself instead of through your repository/frontend/etc
if it starts working, add things back one by one until it breaks again
i wouldnt even know where to start that as the other tables work
i probs gonna refactor the entire db access stuff once more
and just screw everything over
or you could do what i suggested
take a methodical approach to reducing the surface area to check for bugs
i found it out now
my entire db just had with 5 tables the ability to create 23 circular references XD
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.