在json对象上的linq查询中的StackOverflowException

时间:2013-10-09 01:42:56

标签: c# json linq stack-overflow

当我尝试对以下JSON对象运行以下linq查询时,我收到了StackOverflowException。据观察,当封闭此查询的静态函数在第一次运行时运行良好。但是下次它会给出错误。

异常消息

An unhandled exception of type 'System.StackOverflowException' occurred in System.Core.dll

这是查询

IEnumerable<long> iDs = = from p in jObject["response"]["docs"]
                              select Convert.ToInt64((string)p["id"]);

这是JSON对象

{
  "responseHeader": {
    "status": 0,
    "QTime": 4,
    "params": {
      "sort": "noofsales desc, score desc",
      "fl": "id",
      "indent": "false",
      "start": "0",
      "q": "texttags:baby romper  bodysuit jumpsuit unisex boy girl animal costume sizes clothes deal offer\r\ndealtitle:baby romper  bodysuit jumpsuit unisex boy girl animal costume sizes clothes deal offer\r\nwhatyouget:baby romper  bodysuit jumpsuit unisex boy girl animal costume sizes clothes deal offer\r\nalltags:baby romper  bodysuit jumpsuit unisex boy girl animal costume sizes clothes deal offer\r\ndealdescription:baby romper  bodysuit jumpsuit unisex boy girl animal costume sizes clothes deal offer^80\r\ndealcity:National",
      "wt": "json",
      "fq": [
        "dealendtime:[NOW TO NOW+100YEAR]",
        "IF alltags: Experiences THEN dealcity:national National ELSE dealcity:national",
        "soldout:0"
      ],
      "rows": "24"
    }
  },
  "response": {
    "numFound": 35,
    "start": 0,
    "docs": [
      {
        "id": "787"
      },
      {
        "id": "23867"
      },
      {
        "id": "920"
      },
      {
        "id": "22768"
      },
      {
        "id": "1018"
      },
      {
        "id": "695"
      },
      {
        "id": "22890"
      },
      {
        "id": "23866"
      },
      {
        "id": "22741"
      },
      {
        "id": "1654"
      },
      {
        "id": "22975"
      },
      {
        "id": "23870"
      },
      {
        "id": "972"
      },
      {
        "id": "974"
      },
      {
        "id": "12379"
      },
      {
        "id": "12201"
      },
      {
        "id": "12199"
      },
      {
        "id": "1261"
      },
      {
        "id": "12205"
      },
      {
        "id": "12198"
      },
      {
        "id": "12191"
      },
      {
        "id": "12209"
      },
      {
        "id": "22919"
      },
      {
        "id": "12203"
      }
    ]
  }
}

0 个答案:

没有答案