如何修复在mscorlib.dll中发生的“;stackoverflowexception”当比较2个LINQ列表

本文关键字:stackoverflowexception 比较 列表 LINQ 2个 mscorlib 何修复 dll | 更新日期: 2023-09-27 18:11:48

我有2个LINQ列表(定义为IQueryable)。它们只包含来自两个不同系统的用户名。第一个列表来自我们的ActiveDirectory服务器(来源是SQL server DB),第二个列表来自供应商应用程序(来源是Microsoft CRM 2011中内置的联系人实体)。

第一个列表大约有36K条记录,而第二个列表大约有43K条记录。每条记录最多8字节/字符。

我尝试使用Except函数点击这里的MS页面,当我尝试迭代结果时,我得到这个错误消息:

unhandled exception of type 'System.StackOverflowException' occured in mscorlib.dll

这是我正在运行的代码

        ADUserDataDAO _aduserDataDAO = new ADUserDataDAO();
        IQueryable<String> _adUserDatas = _aduserDataDAO.getADUserData();
        //int ctr = 0;
        //foreach (var record in _adUserDatas) { ++ctr; Console.WriteLine("username :'t{0}", _record); }
        //Console.WriteLine("total records: 't{0}", ctr);
        ContactsDAO _contactsDAO = new ContactsDAO();
        IQueryable<String> _contacts = _contactsDAO.GetContacts();
        //int ctr = 0;
        //foreach (var _record in _contacts) { ++ctr; Console.WriteLine("username :'t{0}", _record); }
        //Console.WriteLine("total records: 't{0}", ctr);
        IQueryable<String> _inADUserDatas = _adUserDatas.Except(_contacts);
        int ctr = 0;
        foreach (var _record in _inADUserDatas) { ++ctr; Console.WriteLine("username :'t{0}", _record); }
        Console.WriteLine("total records: 't{0}", ctr);

我可以使用上面的代码(参见注释代码)遍历每个列表,所以我知道我从get函数中得到了一些东西。

你知道有什么问题吗?谢谢大家

如何修复在mscorlib.dll中发生的“;stackoverflowexception”当比较2个LINQ列表

IQueryable接口上调用ToList(),然后比较列表,而不是通过IQueryable接口进行比较

相关文章:
  • 没有找到相关文章