I've a LINQ contains empty/null value that works on my local machine but not on my production box. This would be a where cla开发者_如何学Gouse.
Does this make any sense?
From the limited info you provided, my first guess is that the objects or entities your Linq statement is working against have some null values that you're not expecting when performing an operation within the WHERE lambda. Your test box has everything populated, but the production environment does not. For instance, referencing MyObject.ChildObject.ChildProperty when MyObject has no child will generate a NullReferenceException. If MyObject isn't required to have a ChildObject in some or all circumstances, you must perform simple null checks to handle this case safely.
精彩评论