求解释一个蛋疼的bug
大婶儿们出来解决个问题,看看有碰见过的没
截图中的
if (order.EShopOrder_PayStatus == 0 && order.EShopOrder_Status == 0 &&
totalFee >= order.EShopOrder_OrderPrice)条件判断
是不满足这个条件的,但只是为了测试,跳过该条件继续往下走(拖动断点),这时List<EShop_UserSell> list = AddUserSell(order, detaliList);
private List<EShop_UserSell> AddUserSell(EShop_Order order, IEnumerable<EShop_OrderDetails> list) { List<EShop_UserSell> rtnList = new List<EShop_UserSell>(); foreach (var d in list) { EShop_UserSell usersell = new EShop_UserSell(); usersell.EShopOrder_OrderCode = d.EShopOrderCode; usersell.Erp_ColorID = d.Erp_ColorID; usersell.Erp_SizeID = d.Erp_SizeID; usersell.ProducPicUrl = d.EShopOrderDetails_ProducPicUrl; usersell.ProductHTML_Code = d.Product_Code; usersell.ProductHTML_FormatShowName = d.EShopOrderDetails_ProductName; usersell.Sell_AddDate = DateTime.Now; usersell.Sell_ColorName = d.EShopOrderDetails_ColorName; usersell.Sell_ID = 0; usersell.Sell_Price = d.EShopOrderDetails_Prices; usersell.Sell_PriceSum = d.EShopOrderDetails_PricesSum; usersell.Sell_Quantity = d.EShopOrderDetails_Quantity; usersell.Sell_SizeName = d.EShopOrderDetails_SizeName; usersell.UserCode = order.EShopOrder_UserCode; rtnList.Add(usersell); } return rtnList; }
方法很简单,也调试进去了,完全没有问题,但是调用完成后会报空引用异常。
注释掉if的判断,则完全正常。求解释
1(猜测是不是拖动断点会有什么影响,没查到相关信息,感觉不科学啊)