Using the Region & Language Settings set to English (United States) my code is working perfectly fine, however a user reported the following error.
System.ArgumentException: An item with the same key has already been added.
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at OfficeOpenXml.Packaging.ZipPackagePart.CreateRelationship(Uri targetUri, TargetMode targetMode, String relationshipType)
at OfficeOpenXml.ExcelWorkbook.Save()
at OfficeOpenXml.ExcelPackage.Save()
at OfficeOpenXml.ExcelPackage.SaveAs(Stream OutputStream)
After investigating more I found this is directly tied to the Date/Time Format of their System being set to Turkish (Turkey) I have tried changing a whole bunch of the Formatting settings to further isolate the issue however was unsuccessful in doing so. I was able to reproduce this by closing the application and setting the Format to Turkish then reopening the application. Hope this helps someone else and hope you guys can figure out what's causing it.
Comments: In case anyone else is running into this error as a Temporary workaround I have added the following to my Form Load and it will force a locale so the error isn't generated. Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
System.ArgumentException: An item with the same key has already been added.
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at OfficeOpenXml.Packaging.ZipPackagePart.CreateRelationship(Uri targetUri, TargetMode targetMode, String relationshipType)
at OfficeOpenXml.ExcelWorkbook.Save()
at OfficeOpenXml.ExcelPackage.Save()
at OfficeOpenXml.ExcelPackage.SaveAs(Stream OutputStream)
After investigating more I found this is directly tied to the Date/Time Format of their System being set to Turkish (Turkey) I have tried changing a whole bunch of the Formatting settings to further isolate the issue however was unsuccessful in doing so. I was able to reproduce this by closing the application and setting the Format to Turkish then reopening the application. Hope this helps someone else and hope you guys can figure out what's causing it.
Comments: In case anyone else is running into this error as a Temporary workaround I have added the following to my Form Load and it will force a locale so the error isn't generated. Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");