0

我们正在使用 SoftArtisans ExcelWriter 来打开和处理来自各种 excel 文件的数据。一个文件最近开始给我们以下错误: An item with the same key has already been added.

我已尝试使用 Excel 修复选项来修复文件和提取数据,但修复后的文件和原始文件都继续返回相同的错误。

堆栈跟踪,正如承诺的那样:

System.ArgumentException was unhandled by user code
HResult=-2147024809
Message=An item with the same key has already been added.
Source=mscorlib
StackTrace:
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at SoftArtisans.OfficeWriter.ExcelWriter.XMLModel.᝜.ᜀ()
   at SoftArtisans.OfficeWriter.ExcelWriter.XMLModel.᝜..ctor(᜴ A_0, ᝉ A_1)
   at SoftArtisans.OfficeWriter.ExcelWriter.XMLModel.ᝂ.ᜀ()
   at SoftArtisans.OfficeWriter.ExcelWriter.Model.ᜉ..ctor(ល A_0, រ A_1, ᝣ A_2, ᡆ A_3)
   at SoftArtisans.OfficeWriter.ExcelWriter.Model.ល..ctor(ᝣ A_0, ᠐ A_1)
   at SoftArtisans.OfficeWriter.ExcelWriter.Model.ោ..ctor(ᝣ A_0, IEnumerable`1 A_1)
   at SoftArtisans.OfficeWriter.ExcelWriter.XMLModel.᝚..ctor(᜔ A_0, ᝘ A_1, ᝂ A_2, ឤ A_3)
   at SoftArtisans.OfficeWriter.ExcelWriter.XMLModel.᝘.ᜄ()
   at SoftArtisans.OfficeWriter.ExcelWriter.XMLModel.᜔.ᜀ()
   at SoftArtisans.OfficeWriter.ExcelWriter.XMLModel.᜔..ctor(Stream A_0, String A_1, ᝻ A_2)
   at SoftArtisans.OfficeWriter.ExcelWriter.ᜊ.ᜀ(Stream A_0, String A_1, Boolean A_2)
   at SoftArtisans.OfficeWriter.ExcelWriter.ᜊ.ᜀ(Stream A_0, Boolean A_1)
   at SoftArtisans.OfficeWriter.ExcelWriter.ExcelApplication.Open(Stream stream)
4

1 回答 1

0

听起来您或 SoftArtisan 的代码中的某处有一个System.Collections.Generic.Dictionary,其中添加了两个具有相同键的对象。

于 2016-01-15T19:40:29.710 回答