开发者

WPF "object reference not set to an instance of an object" on client machine only

开发者 https://www.devze.com 2023-02-24 05:56 出处:网络
I built a WPF application on my m/c and passed on the executable to a client. The application works perfectly well on my machine but throws an error on the client machine. My Logger picked up the foll

I built a WPF application on my m/c and passed on the executable to a client. The application works perfectly well on my machine but throws an error on the client machine. My Logger picked up the following.

Message :Object reference not set to an instance of an object.
Source :App.Feeds
Stack Trace :   at App.Feeds.Port
<AdjustWeights>b__1(KeyValuePair`2 item) in
C:\App\1.0.1\App.Feeds\Port\IPort.cs:line 42
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.Sum(IEnumerable`1 source)
at System.Linq.Enumerable.Sum[TSource](IEnumerable`1 source, Func`2 selector)
at App.Feeds.Port.Port.AdjustWeights() in
C:\App\1.0.1\App.Feeds\Port\IPort.cs:line 42
at App.Feeds.Port.Port.BuildPort(String 
fileName) in C:\App\1.0.1\App.Feeds\Port\IPort.cs:line 153

The strange thing I noticed is that the logger ref开发者_运维问答ers to a path C:\App\1.0.1\App.Feeds\Port\IPort.cs I use on the development machine. Is there something wrong with that?

What could be going wrong?


I'm guessing the Where clause is returning null and when you do a sum on that, it breaks. May be you need to check if the result of the where clause has any items before you do the sum.

0

精彩评论

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

关注公众号