Evaluation of method System.Linq.Enumerable.ToList() calls into native method Interop+Kernel32.FindStringOrdinal() in QuickWatch

こ雲淡風輕ζ 提交于 2021-02-19 03:42:51

问题


I have a list of posts that i get from DB like that:

 var iQueryablePost= from p in context.Posts
                     select new Post
                     {
                       Id=p.id,
                       Label=p.label
                     };
 var posts = new List<Post>();
 posts = await iQueryablePost.ToListAsync();

I wanna filter my posts after getting all from DB, if i add where to my iQueryable it works just fine but i need to get all post from DB.

That's what i did and the message I see in QuickWatch :

posts = !string.IsNullOrWhiteSpace(query.PdcIdSITiers) ? 
        posts.Where(c => c.Label.ToLower().Contains(query.label.ToLower())).ToList() : 
        posts;

QuickWatch message:

Evaluation of method System.Linq.Enumerable.ToList() calls into native method Interop+Kernel32.FindStringOrdinal(). Evaluation of native methods in this context is not supported. System.Collections.Generic.List

The project is based in a CQRS design-pattern


回答1:


The probleme comes from a Label that is Null After deleting this row from my list the code work just fine.

Thanks for all your comments



来源:https://stackoverflow.com/questions/54197842/evaluation-of-method-system-linq-enumerable-tolist-calls-into-native-method-in

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