You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
get exception: An item with the same key has already been added. Key: 1, An item with the same key has already been added. Key: 20
What is the expected behavior or new feature?
no exception
Is this a regression from the previous version?
No
Reproducibility
Code to reproduce problem:
publicvoidMain(){varx=newClosedXML.Excel.XLWorkbook();vars=x.AddWorksheet();varr=s.Row(1);System.Threading.Tasks.Parallel.For(1,1000000, i =>{varc1=r.Cell(20);c1.SetValue(i);});Console.ReadLine();}
the stack trace from inner exception:
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 ClosedXML.Excel.XLCellsCollection.IncrementUsage(Dictionary`2 dictionary, Int32 key) in C:\projects\closedxml\ClosedXML\Excel\Cells\XLCellsCollection.cs:line 54
at ClosedXML.Excel.XLCellsCollection.Add(Int32 row, Int32 column, XLCell cell) in C:\projects\closedxml\ClosedXML\Excel\Cells\XLCellsCollection.cs:line 33
at ClosedXML.Excel.XLRangeBase.Cell(XLAddress& cellAddressInRange) in C:\projects\closedxml\ClosedXML\Excel\Ranges\XLRangeBase.cs:line 920
at ClosedXML.Excel.XLRangeBase.Cell(Int32 row, Int32 column) in C:\projects\closedxml\ClosedXML\Excel\Ranges\XLRangeBase.cs:line 848
at ClosedXML.Excel.XLRow.Cell(Int32 columnNumber) in C:\projects\closedxml\ClosedXML\Excel\Rows\XLRow.cs:line 144
Suggestion: Add “ClosedXML is not thread-safe” to a “Limitations” section of the project readme.
@igitur@Pankraty thank you for your ongoing efforts on this awesome project
igitur
changed the title
get exception: "An item with the same key has already been added." when Parallel code
"An item with the same key has already been added." when Parallel code
May 1, 2021
Read and complete the full issue template
Do not randomly delete sections. They are here for a reason.
Do you want to request a feature or report a bug?
Did you test against the latest CI build?
If you answered
No
, please test with the latest development build first.Version of ClosedXML
0.95.4 and latest CI build (0.95.999.2311)
What is the current behavior?
get exception:
An item with the same key has already been added. Key: 1
,An item with the same key has already been added. Key: 20
What is the expected behavior or new feature?
no exception
Is this a regression from the previous version?
No
Reproducibility
Code to reproduce problem:
the stack trace from inner exception:
lead me to:
ClosedXML/ClosedXML/Excel/Cells/XLCellsCollection.cs
Line 54 in 78150ef
The text was updated successfully, but these errors were encountered: