c# - Entity Framework NullReferenceException in Where -
i have following line of code calls entity framework , returning null reference exception.
list<fieldgroup> fieldgroups = datacontext.fieldgroups.where(fieldgroup => fieldgroup.field_catalog_id == fieldversion.fieldcatalogid && fieldgroup.field_catalog_version == fieldversion.fieldcatalogversion).tolist();
fieldversion
being generated earlier in method , have confirmed it, , fields fieldcatalogid
, fieldcatalogversion
not null , have proper values.
my context, datacontext
, while poorly named connecting database , have rows in fieldgroups table. have confirmed row field_catalog_id
, field_catalog_version
matching values being requested in exist should able find rows return.
i can't determine why line throwing nullreferenceexception. ideas appreciated. let me know if can provide more useful info.
edit: did take @ locals when exception being thrown , nothing being referenced showing null.
i added in debug.assert check datacontext
, datacontext.fieldgroups
, fieldversion
, fieldversion.fieldcatalogid
, , fieldversion.fieldcatalogversion
not null before problem line. code got past 5 of asserts , still threw nullreferenceexception. can't find within fields null causing exception.
Comments
Post a Comment