toptensoftware / RichTextKit

Rich text rendering for SkiaSharp
Other
366 stars 73 forks source link

Possible bug - BadImageFormatException #10

Closed vchelaru closed 4 years ago

vchelaru commented 4 years ago

I don't have good repro on this because it was reported on AppCenter, but here's the callstack:

Xamarin Exception Stack:
System.BadImageFormatException: Method has zero rva
  at Topten.RichTextKit.TextShaper.GetHarfBuzzBlob (SkiaSharp.SKStreamAsset asset) [0x00045] in <48c43bfd31714027914cbea8c298ec38>:0
  at Topten.RichTextKit.TextShaper..ctor (SkiaSharp.SKTypeface typeface) [0x00015] in <48c43bfd31714027914cbea8c298ec38>:0
  at Topten.RichTextKit.TextShaper.ForTypeface (SkiaSharp.SKTypeface typeface) [0x0001f] in <48c43bfd31714027914cbea8c298ec38>:0
  at Topten.RichTextKit.TextBlock.CreateFontRun (Topten.RichTextKit.StyleRun styleRun, Topten.RichTextKit.Utils.Slice`1[T] codePoints, Topten.RichTextKit.TextDirection direction, Topten.RichTextKit.IStyle style, SkiaSharp.SKTypeface typeface, SkiaSharp.SKTypeface asFallbackFor) [0x00000] in <48c43bfd31714027914cbea8c298ec38>:0
  at Topten.RichTextKit.TextBlock.AddFontRun (Topten.RichTextKit.StyleRun styleRun, System.Int32 start, System.Int32 length, Topten.RichTextKit.TextDirection direction, Topten.RichTextKit.IStyle style, SkiaSharp.SKTypeface typeface, SkiaSharp.SKTypeface asFallbackFor) [0x0000e] in <48c43bfd31714027914cbea8c298ec38>:0
  at Topten.RichTextKit.TextBlock.AddDirectionalRun (Topten.RichTextKit.StyleRun styleRun, System.Int32 start, System.Int32 length, Topten.RichTextKit.TextDirection direction, Topten.RichTextKit.IStyle style) [0x00030] in <48c43bfd31714027914cbea8c298ec38>:0
  at Topten.RichTextKit.TextBlock.BuildFontRuns () [0x002db] in <48c43bfd31714027914cbea8c298ec38>:0
  at Topten.RichTextKit.TextBlock.Layout () [0x000d8] in <48c43bfd31714027914cbea8c298ec38>:0
  at Topten.RichTextKit.TextBlock.get_MeasuredWidth () [0x00000] in <48c43bfd31714027914cbea8c298ec38>:0

This was on Android using Topten.RichTextKit v0.1.118

I do realize this is somewhat of an old version, and we may upgrade just to be safe, but I also wanted to bring this up in case it wasn't a known issue.

toptensoftware commented 4 years ago

Thanks for reporting. I've not tried RichTextKit on Android so I'm not really sure, but this sounds more like an issue with the HarfBuzzSharp installation. I'm guessing the wrong version of libHarfBuzSharp.so and so it's just not loading it. I see similar exceptions on Windows when running x64 edition but the x86 .dll file is there.

I recommend reporting this to the HarfBuzzSharp devs.