Avoid GetShapeRenderer Exception - A value with the specified key has already been added | C# .NET Parallel Threading

Hi Aspose team!

Aspose.Words 20.12, 21.4 .net40
There is exception when we try to convert SmartArts in parallel. Each document in own thread. It can be reproduced with attached example and documents.
example.7z (38.6 KB)

System.InvalidOperationException: A value with the specified key has already been added.
  at ♫? .♠ (Int32 ☻, ☻ ♥, Boolean ♣)
  at ♣?? .☻()
  at ♣?? .♥(♥?   ☻)
  at ☻ ? .☻(☼    ☻, Boolean ♥)
  at ♣ ? .☻(☼    ☻, SizeF ♥, ♠?   ♣, ♫?  , ♫ ?  ♠,??  ♫)
  at ♠ ? .☻(☼    ☻, ♣ ? ♥,??  ♣)
  at ♥ ? .♫?? ?  ☻(☻ ?  ☻)
  at ♣?? .☻(☻ ?  ☻, ShapeBase ♥, Boolean ♣)
  at ♣ ? .☻(ShapeBase ☻)
  at ☻?? .☻(ShapeBase ☻,??  ♥)
  at ☻?? .☻??  ☻, Boolean ♥)
  at Aspose.Words.Rendering.ShapeRenderer..ctor(ShapeBase shape)
  at Aspose.Words.Drawing.ShapeBase.GetShapeRenderer()
  at Atest.MyTestClass.ReplaceShapes(String fileName) in C:\work\projects\Atest\Atest\Program.cs:line 41

Can be fixed by wrapping “shape.GetShapeRenderer();” under lock or mutex, also is it a safe to do that?

@licenses,

After an initial test with the licensed latest (21.4) version of Aspose.Words for .NET, we were unable to reproduce this exception on our end. Can you please also create a standalone simple Console application (source code without compilation errors) that helps us to reproduce your current problem on our end and attach it here for testing? Please do not include Aspose.Words DLL files in it to reduce the file size. We will then start further investigation into your issue and provide you more information.

Hi @awais.hafeez!

Run ATest.sln and debug it several times, nuget will be installed automatically. This issue occurs 9/10 times on my laptop.
Atest.7z (40.3 KB)

@licenses,

We have logged this problem in our issue tracking system. Your ticket number is WORDSNET-22165. We will further look into the details of this problem and will keep you updated here on the status of the linked issue. We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-22165) have been fixed in this Aspose.Words for .NET 21.5 update and this Aspose.Words for Java 21.5 update.