生成CIL的问题

时间:2023-03-09 23:56:36
生成CIL的问题
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 * (-);
}

就OK了

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