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.