2013年5月14日 星期二

[Windows 8] To fix error: Additional information: Cannot perform runtime binding on a null reference

Recently, in the study the Facebook API, try to find a feed/data, but I feed data no contents, run the following program, there will be the Additional Information: Can not perform runtime binding on a null reference ":
  dynamic feeds = await fbClient.GetTaskAsync(strID + "?fields=feed");
  foreach (var data in feeds.feed.data)
  {
     ...
  }
Later changed to:
  dynamic feeds = await fbClient.GetTaskAsync(strID + "/feed");
  if (feeds != null)
  {
    foreach (var data in feeds.data)
    {
       ...
    }
  }
The problem is solved.

沒有留言:

張貼留言