函数“MoveNext”中发生未处理的异常

杰弗里DRL

有谁知道此错误消息的原因是什么?这是我认为触发该错误的代码。(这是来自我们的定制项目),当我选择超过 1 个项目时会触发错误。

        foreach (InventoryItem line in soinvlineview.Cache.Cached)
        {
            if (line.Selected == true)
            {
                StyleColorSelected newline = PXCache<StyleColorSelected>.CreateCopy(styleselected.Insert(new StyleColorSelected()));
                newline.InventoryID = line.InventoryID;
                newline = PXCache<StyleColorSelected>.CreateCopy(styleselected.Update(newline));
                styleselected.Update(newline);
            }
        }

在此处输入图片说明

在此处输入图片说明

鲁斯兰德夫

首先,CreateCopy 方法对于 ver 是强制性的。4.0 及更早版本。开始版本。4.1,你根本不需要使用它。这是您的代码可以简化的方式:

foreach (InventoryItem line in soinvlineview.Cache.Cached)
{
    if (line.Selected == true)
    {
        StyleColorSelected newline = styleselected.Insert(new StyleColorSelected());
        newline.InventoryID = line.InventoryID;
        styleselected.Update(newline);
    }
}

我怀疑,您的自定义 StyleColorSelected DAC 要么没有指定关键字段,要么在关键字段上使用的属性不生成唯一值 - 这导致没有记录插入 PXCache(插入方法返回 null 而不是插入的值)和大多数可能导致函数“MoveNext”中发生报告的未处理异常。请您仔细检查 StyleColorSelected DAC 的实现,并更新您的代码,如下所示,以验证关键字段是否设置了唯一值,并且记录始终插入到 PXCache 中。

foreach (InventoryItem line in soinvlineview.Cache.Cached)
{
    if (line.Selected == true)
    {
        StyleColorSelected newline = new StyleColorSelected();
        // if necessary assign unique values to key field(s) here
        newline = styleselected.Insert(newline);
        if (newline == null) throw PXException("StyleColorSelected was not inserted in the cache!");

        newline.InventoryID = line.InventoryID;
        styleselected.Update(newline);
    }
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

发生未处理的异常

来自分类Dev

TPL.Dataflow-防止在ActionBlock <T>中发生未处理的异常时挂起

来自分类Dev

错误“ mscorlib.dll中发生类型'System.IO.IOException'的未处理的异常”

来自分类Dev

在会话上“ mscorlib.dll中发生类型'System.StackOverflowException'的未处理的异常”

来自分类Dev

mscorlib.dll中发生了类型为'System.ServiceModel.CommunicationException'的未处理异常

来自分类Dev

错误:mscorlib.dll中发生了'System.StackOverflowException'类型的未处理异常

来自分类Dev

错误:mscorlib.dll中发生了类型为'System.UnauthorizedAccessException'的未处理异常

来自分类Dev

Microsoft.WindowsAzure.Storage.dll中发生了类型为'System.StackOverflowException'的未处理异常

来自分类Dev

沉默“未知模块中发生类型'System.ExecutionEngineException'的未处理的异常”错误

来自分类Dev

错误“ mscorlib.dll中发生类型'System.IO.IOException'的未处理的异常”

来自分类Dev

沉默“未知模块中发生类型'System.ExecutionEngineException'的未处理的异常”错误

来自分类Dev

VS2012中的Xamarin Android中的TabView中发生未处理的异常

来自分类Dev

exe中发生类型为'System.IO.FileLoadException'的未处理异常

来自分类Dev

System.Data.dll中发生了'System.ArgumentException'类型的未处理异常

来自分类Dev

在System.Drawing.dll中发生了'System.ArgumentException'类型的未处理异常,用于灰度

来自分类Dev

BLL.dll中发生了'System.ArgumentException'类型的未处理异常

来自分类Dev

Microsoft.WindowsAzure.Storage.dll中发生了类型为'System.StackOverflowException'的未处理异常

来自分类Dev

在application.exe中发生了'System.StackOverflowException'类型的未处理异常

来自分类Dev

Windows 窗体“System.Data.dll 中发生类型为‘System.ArgumentException’的未处理异常”

来自分类Dev

MySql - System.Data.dll 中发生类型为“System.InvalidOperationException”的未处理异常

来自分类Dev

未知模块中发生类型为“System.TypeInitializationException”的未处理异常

来自分类Dev

选择查询 C# 中发生类型为“System.Data.OleDb.OleDbException”的未处理异常

来自分类Dev

Fody:发生了未处理的异常

来自分类Dev

System.Data.dll C#中发生类型为'System.Data.OleDb.OleDbException'的未处理异常

来自分类Dev

DevExpress-设置单元格值-mscorlib.dll中发生类型为'System.StackOverflowException'的未处理异常

来自分类Dev

错误:System.Windows.Forms.dll中发生了类型为'System.BadImageFormatException'的未处理异常

来自分类Dev

Microsoft.Dynamic.dll意外令牌“ part”中发生了类型为“ Microsoft.Scripting.SyntaxErrorException”的未处理异常

来自分类Dev

VB中的错误:language.exe中发生了类型为'System.IndexOutOfRangeException'的未处理异常

来自分类Dev

为什么我在System.Core.dll中发生类型为'System.ArgumentNullException'的未处理异常

Related 相关文章

  1. 1

    发生未处理的异常

  2. 2

    TPL.Dataflow-防止在ActionBlock <T>中发生未处理的异常时挂起

  3. 3

    错误“ mscorlib.dll中发生类型'System.IO.IOException'的未处理的异常”

  4. 4

    在会话上“ mscorlib.dll中发生类型'System.StackOverflowException'的未处理的异常”

  5. 5

    mscorlib.dll中发生了类型为'System.ServiceModel.CommunicationException'的未处理异常

  6. 6

    错误:mscorlib.dll中发生了'System.StackOverflowException'类型的未处理异常

  7. 7

    错误:mscorlib.dll中发生了类型为'System.UnauthorizedAccessException'的未处理异常

  8. 8

    Microsoft.WindowsAzure.Storage.dll中发生了类型为'System.StackOverflowException'的未处理异常

  9. 9

    沉默“未知模块中发生类型'System.ExecutionEngineException'的未处理的异常”错误

  10. 10

    错误“ mscorlib.dll中发生类型'System.IO.IOException'的未处理的异常”

  11. 11

    沉默“未知模块中发生类型'System.ExecutionEngineException'的未处理的异常”错误

  12. 12

    VS2012中的Xamarin Android中的TabView中发生未处理的异常

  13. 13

    exe中发生类型为'System.IO.FileLoadException'的未处理异常

  14. 14

    System.Data.dll中发生了'System.ArgumentException'类型的未处理异常

  15. 15

    在System.Drawing.dll中发生了'System.ArgumentException'类型的未处理异常,用于灰度

  16. 16

    BLL.dll中发生了'System.ArgumentException'类型的未处理异常

  17. 17

    Microsoft.WindowsAzure.Storage.dll中发生了类型为'System.StackOverflowException'的未处理异常

  18. 18

    在application.exe中发生了'System.StackOverflowException'类型的未处理异常

  19. 19

    Windows 窗体“System.Data.dll 中发生类型为‘System.ArgumentException’的未处理异常”

  20. 20

    MySql - System.Data.dll 中发生类型为“System.InvalidOperationException”的未处理异常

  21. 21

    未知模块中发生类型为“System.TypeInitializationException”的未处理异常

  22. 22

    选择查询 C# 中发生类型为“System.Data.OleDb.OleDbException”的未处理异常

  23. 23

    Fody:发生了未处理的异常

  24. 24

    System.Data.dll C#中发生类型为'System.Data.OleDb.OleDbException'的未处理异常

  25. 25

    DevExpress-设置单元格值-mscorlib.dll中发生类型为'System.StackOverflowException'的未处理异常

  26. 26

    错误:System.Windows.Forms.dll中发生了类型为'System.BadImageFormatException'的未处理异常

  27. 27

    Microsoft.Dynamic.dll意外令牌“ part”中发生了类型为“ Microsoft.Scripting.SyntaxErrorException”的未处理异常

  28. 28

    VB中的错误:language.exe中发生了类型为'System.IndexOutOfRangeException'的未处理异常

  29. 29

    为什么我在System.Core.dll中发生类型为'System.ArgumentNullException'的未处理异常

热门标签

归档