LINQ problem on remote machine
I am using LINQ expressions in my code
like this
var obj = Collection.Single(collection => (collection.ShortName.Equals("AAA")));
The problem is that this line works fine for me, no problems.
But when I upload开发者_如何学C the same executable to some remote machine with same 32 bit Windows XP. The code execution is just stopping at this line of source.
Can anyone help me.
You say that the thread is "stopping". If an exception is thrown in a thread it will terminate, is this what you mean by "stopping"? Single() will throw if either none or more than one element is present, and i think that this might be what is going on..
Are you certain that the collection contains exactly one matching element at all times?
Note: Read Eric Lipperts link. If possible, you could run it on a BackgroundWorker, and check the Error property of the eventargs when the thread exits.
http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx
精彩评论