逛逛逛 发表于 2024-7-19 10:01:38

10.2 项目设计预览时错误 An item with the same key has already been added

项目预览时错误,蒙了,啥情况?我怎样排查呢



## Overview
- Version: 10.0.2.0
- Exception: `System.ArgumentException`
- DateTime: 2024/7/19 8:50:13
- Email:
- Tags: #CN

## Exception
```json
{
"ClassName": "System.ArgumentException",
"Message": "An item with the same key has already been added. Key: 392d0d05-0a72-4e93-8b5f-34326e2d172c",
"Data": {
    "$type": "System.Collections.ListDictionaryInternal, System.Private.CoreLib",
    "System.Object": null
},
"InnerException": null,
"HelpURL": null,
"StackTraceString": "   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at System.Linq.Enumerable.ToDictionary(TSource[] source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at mt.GenerateShareCommandMetadata()
   at mu.cdb(PublishType a, TaskInfo b, PublishSettingsViewModel c)
   at mu.GenerateAllPagesAsync(PublishType publishType, TaskInfo taskInfo, PublishSettingsViewModel settings)
   at mu.GenerateAllPagesAsync(PublishType publishType, TaskInfo taskInfo, PublishSettingsViewModel settings)
   at Forguncy.Views.RibbonView.BrowserHomeExecutedWithProgressbarAsync(IBrowser browser, TaskInfo taskInfo)
   at Forguncy.Views.RibbonView.<>c__DisplayClass412_0.<<BrowserHomeExecutedWithProgressbarAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at WPFBase.Common.TaskInfoHelper.CreateAThreadCrossedAutoClosedWindowAsync(TaskInfo taskInfo, Window owner, Func`1 action)
   at Forguncy.Views.RibbonView.BrowserHomeExecutedWithProgressbarAsync(IBrowser browser, TaskInfo taskInfo)
   at Forguncy.Views.RibbonView.BrowserHome_Click(Object sender, RoutedEventArgs routedEventArgs)
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": null,
"HResult": -2147024809,
"Source": "System.Private.CoreLib",
"WatsonBuckets": null,
"ParamName": null
}
```

## EventLog
- 08:50:04 `MouseL`:Window:恒立_生产管理.fgcc - 活字格 (10.0.2.0)->RibbonView->RibbonGroupBox:在浏览器中打开->MenuItem:Forguncy.Views.RunMenuItemDisplay->MenuItem:Google Chrome->Google Chrome
- 08:50:03 `MouseL`:Window:恒立_生产管理.fgcc - 活字格 (10.0.2.0)->RibbonView->RibbonGroupBox:在浏览器中打开
- 08:50:02 `MouseL`:Window:命令窗口->Button:确定->确定
- 08:50:01 `MouseL`:CommandItemMenuItem:禁用此命令->禁用此命令
- 08:49:58 `MouseR`:Window:命令窗口->MyTreeViewItem:Forguncy.HelpForm.Commands.NormalCommandItemViewModel
- 08:49:58 `MouseL`:Window:命令窗口->MyTreeViewItem:Forguncy.HelpForm.Commands.NormalCommandItemViewModel
- 08:49:26 `MouseL`:Window:恒立_生产管理.fgcc - 活字格 (10.0.2.0)->Tab:单元格设置->编辑命令...
- 08:49:25 `MouseL`:Window:恒立_生产管理.fgcc - 活字格 (10.0.2.0)->Spread:R2 ,C22,Page=D_04004_21_主任务管理,CellType=Forguncy.ButtonCellType
- 08:47:51 `MouseL`:Window:恒立_生产管理.fgcc - 活字格 (10.0.2.0)->RibbonView->RibbonGroupBox:在浏览器中打开->MenuItem:Forguncy.Views.RunMenuItemDisplay->MenuItem:Google Chrome->Google Chrome
- 08:47:50 `MouseL`:Window:恒立_生产管理.fgcc - 活字格 (10.0.2.0)->RibbonView->RibbonGroupBox:在浏览器中打开

## ActionList
- SetCommandAction



Shawn.Liu 发表于 2024-7-19 10:01:39

大佬,这个报错您可以参考下面这篇帖子,区别在后面的提示上,大多数时候会提示对象管理器下某个元素等,从帖子中看是一个GUID,请教一下在预览之前我们有什么特别的操作吗?这个问题可能需要获取您的工程这边找我们开发同事分析一下工程。

您这边如果是fgcc工程,可以在默认的备份目录找一下,看下历史工程在预览时是否也会存在相同的问题;

an item with the same key has already been added.key
https://gcdn.grapecity.com.cn/showtopic-164423-1-1.html
(出处: 葡萄城开发者社区)

逛逛逛 发表于 2024-7-19 11:25:59

Shawn.Liu 发表于 2024-7-19 11:10
大佬,这个报错您可以参考下面这篇帖子,区别在后面的提示上,大多数时候会提示对象管理器下某个元素等,从 ...

查了备份,只有昨天中午那个是好的,其他的都不行。我慢慢再回忆改了一些啥。

Shawn.Liu 发表于 2024-7-19 13:33:15

好的大佬,收到

小萝卜David 发表于 2024-7-21 09:15:58

图文列表,图文列表,图文列表。
有一个版本,从一个页面复制图文列表到另一个页面,会有问题。可以从这个角度,想一下。

逛逛逛 发表于 2024-7-22 08:44:08

小萝卜David 发表于 2024-7-21 09:15
图文列表,图文列表,图文列表。
有一个版本,从一个页面复制图文列表到另一个页面,会有问题。可以从这个 ...

谢谢!

最近没有用过图文列表。也懒得想了。在上次的备份文件基础上重写里这几天的功能。现在每天下班手工再备份一次。

小萝卜David 发表于 2024-7-22 08:55:26

嗯,好像模版命令也是一个随机字符串。

Shawn.Liu 发表于 2024-7-22 11:39:23

{:5_114:}
页: [1]
查看完整版本: 10.2 项目设计预览时错误 An item with the same key has already been added