We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

ShapeRenderer crashes when rendering Emoji on macOS

When I call Save() on a ShapeRenderer belonging to a shape of a text box in a Word document containing an emoji character it crashes. Any other regular character works fine.

try
        {
            var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ShapeRenderer.Shape.docx");

            var document = new Document(stream);
            var shape = document.GetChildNodes(NodeType.Shape, true).ToArray().First() as Shape;
            var shapeRenderer = shape.GetShapeRenderer();
            var imageSaveOptions = new ImageSaveOptions(SaveFormat.Png)
            {
                Resolution = 96.0f, DmlRenderingMode = DmlRenderingMode.Fallback, UseGdiEmfRenderer = false,
                UseAntiAliasing = true, UseHighQualityRendering = true, DmlEffectsRenderingMode = DmlEffectsRenderingMode.Fine,
                MetafileRenderingOptions = {RenderingMode = MetafileRenderingMode.VectorWithFallback}
            };
            var renderedFileName = $"/tmp/shape_{shape.Name}.png";
            shapeRenderer.Save(renderedFileName, imageSaveOptions); // This crashes

            Console.WriteLine($"Rendered shape can be found at {renderedFileName}");
        }
        catch (Exception exception)
        {
            Console.WriteLine($"Cannot render image: {exception.Message}");
        }

My system:
macOS 10.14.3, dotnet 2.2, Aspose.Words 19.2.0

The stacktrace:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.apple.CoreFoundation 0x00007fff4b3addad CFStringGetLength + 10
1 libSkiaSharp.dylib 0x0000000105f9303b 0x105dc4000 + 1896507
2 ??? 0x0000000109ba016d 0 + 4458152301
3 ??? 0x0000000109b9ff5d 0 + 4458151773
4 ??? 0x0000000109b9faa3 0 + 4458150563
5 ??? 0x0000000109b9e5b0 0 + 4458145200
6 ??? 0x0000000109b9e462 0 + 4458144866
7 ??? 0x0000000109b99f59 0 + 4458127193
8 ??? 0x0000000109b78540 0 + 4457989440
9 ??? 0x0000000109b78540 0 + 4457989440
10 ??? 0x0000000109b78540 0 + 4457989440
11 ??? 0x0000000109b77fba 0 + 4457988026
12 ??? 0x0000000109b78540 0 + 4457989440
13 ??? 0x0000000109b77fba 0 + 4457988026
14 ??? 0x0000000109b78540 0 + 4457989440
15 ??? 0x0000000109b78540 0 + 4457989440
16 ??? 0x0000000109b77fba 0 + 4457988026
17 ??? 0x0000000109b78540 0 + 4457989440
18 ??? 0x0000000109b77fba 0 + 4457988026
19 ??? 0x0000000109b95b66 0 + 4458109798
20 ??? 0x0000000109b93b73 0 + 4458101619
21 ??? 0x0000000109b88762 0 + 4458055522
22 ??? 0x0000000109b88298 0 + 4458054296
23 ??? 0x0000000109b879b2 0 + 4458052018
24 ??? 0x0000000109b8727a 0 + 4458050170
25 ??? 0x00000001083c4638 0 + 4433135160
26 libcoreclr.dylib 0x000000010169d2a7 CallDescrWorkerInternal + 124
27 libcoreclr.dylib 0x0000000101503471 MethodDescCallSite::CallTargetWorker(unsigned long const*, unsigned long*, int) + 945
28 libcoreclr.dylib 0x00000001013d6016 RunMain(MethodDesc*, short, int*, PtrArray**) + 694
29 libcoreclr.dylib 0x00000001013d6382 Assembly::ExecuteMainMethod(PtrArray**, int) + 402
30 libcoreclr.dylib 0x0000000101416db4 CorHost2::ExecuteAssembly(unsigned int, char16_t const*, int, char16_t const**, unsigned int*) + 436
31 libcoreclr.dylib 0x0000000101347fb6 coreclr_execute_assembly + 230
32 libhostpolicy.dylib 0x0000000101292388 0x101209000 + 562056
33 libhostpolicy.dylib 0x000000010127b7df 0x101209000 + 468959
34 libhostpolicy.dylib 0x0000000101282089 0x101209000 + 495753
35 libhostfxr.dylib 0x00000001011a48a3 0x10111a000 + 567459
36 libhostfxr.dylib 0x00000001011c45ee 0x10111a000 + 697838
37 libhostfxr.dylib 0x00000001011c71c2 0x10111a000 + 709058
38 libhostfxr.dylib 0x00000001011c5678 0x10111a000 + 702072
39 libhostfxr.dylib 0x00000001011a5919 0x10111a000 + 571673
40 dotnet 0x00000001010ea052 0x1010dd000 + 53330
41 dotnet 0x00000001010ea645 0x1010dd000 + 54853
42 libdyld.dylib 0x00007fff786c9ed9 start + 1

Attached you will find a test project and the Microsoft Word document.
ShapeRenderer.zip (18.3 KB)

Thanks for your help.

@ATLAS.ti_dev

Thanks for your inquiry. Please uninstall Aspose.Words for .NET and install it through NuGet. Hope this helps you.

Please let us know if you still face problem.

Tahir,
thanks for the quick reply. As you can see in the attached project I am already using Aspose.Words from NuGet.

Greetings.

@ATLAS.ti_dev

Thanks for your inquiry.

We are setting up the same environment as of yours at our end and will test this case. We will share our findings with you soon. Thanks for your cooperation.

@ATLAS.ti_dev

Thanks for your patience. We have tested the scenario using the latest version of Aspose.Words for .NET 19.2 and have not found the shared issue. Please check the attached image for detail.

Could you please share the steps that you are using to reproduce this issue at our end? Thanks for your cooperation.

But your test app also crashes with exit code 11 (same as mine).

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [70823]

@ATLAS.ti_dev

Unfortunately, we missed the crash exit code. We have logged this problem in our issue tracking system as WORDSNET-18159. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

No problem. It is quite a nasty bug, since the whole app will crash, even if you wrap the statement in a try/catch block.
You can also notice it when you step with the debugger through your code. As soon as the Save() function is being called the app is crashing.

@ATLAS.ti_dev

Thanks for sharing the detail. We will inform you via this forum thread once there is an update available on it. Please let us know if you have any more queries.

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