开发者

Getting different results on Windows Phone 7 Device vs Emulator

开发者 https://www.devze.com 2023-03-12 21:53 出处:网络
I\'m getting different results from the emulator vs what is actually on the device. I\'m making a Linq-to-XML filtering query and the one on the emulator is returning correct results while the device

I'm getting different results from the emulator vs what is actually on the device.

I'm making a Linq-to-XML filtering query and the one on the emulator is returning correct results while the device one is return 0 results.

var result = (from p in xmlDoc.Descendants("Item")
    where p.Element("Version").Value != "NA" 
          && p.Element("Release").Value != String.Empty
          && DateTimeOffset.UtcNow.Subtract(DateTimeOffset.ParseExact(p.Element("Release").Value, "yyyy-MM-dd hh:mm:ssZ", cultureInfo)).TotalDays <= 30
          && DateTimeOffset.UtcNow.Subtract(DateTimeOffset.ParseExact(p.Element("Release").Value, "yyyy-MM-dd hh:mm:ssZ", cultureInfo)).TotalDays > 0
    orderby DateTimeOffset.ParseExact(p.Element("Release").Value, "yyyy-MM-dd hh:mm:ssZ", cultureInfo) descending
    group 开发者_开发问答p by p.Element("Id").Value into Items
    select Items).ToList();

I've set a breakpoint on both instances and culture is the same.

What gives?

UPDATE:

XML document returned is exactly the same.


Stupid me, Windows Phone 7 has automatic date and time set. (Time was correct but date was wrong!) But of course, with no actual SIM Card, the datetime was incorrectly set. Therefore, it is giving me different results.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号