private void testILMethod()
{
    InventCountPlanLine     planLine;
    ;
    update_recordSet planLine 
    setting CountCuttingTimes = -planLine.CountCuttingTimesDiff;
}

上面的代码生成CIL的时候会有如下错误:

Finished pass 1 at 2016/5/28 20:07:22

Finished pass 2 at 2016/5/28 20:07:23

Error 1. Class: Class1, Method: testILMethod, Exception: System.NotSupportedException: Line Number 5 - Error during dispatch of Expr. ---> System.NotSupportedException: Error during dispatch of Expr. ---> System.Reflection.TargetInvocationException: 调用的目标发生了异常。 ---> System.NotSupportedException: Error during dispatch of SymWhere. ---> System.Reflection.TargetInvocationException: 调用的目标发生了异常。 ---> System.ArgumentOutOfRangeException: 索引超出范围。必须为非负值并小于集合大小。

改成

private void testILMethod()
{
    InventCountPlanLine     planLine;
    ;
    update_recordSet planLine 
    setting CountCuttingTimes = planLine.CountCuttingTimesDiff * (-1);
}

就OK了

搞不懂生成CIL的时候有什么限制导致的。

相关文章:

  • 2021-08-11
  • 2021-07-29
  • 2021-06-07
  • 2021-07-01
  • 2022-12-23
  • 2022-01-25
  • 2022-12-23
  • 2021-07-14
猜你喜欢
  • 2021-08-08
  • 2022-02-18
  • 2022-12-23
  • 2022-02-19
  • 2022-02-27
  • 2022-12-23
  • 2021-04-01
相关资源
相似解决方案