Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Regression] System.ExecutionEngineException: Attempting to JIT compile method 'bool Topten.RichTextKit.FontFallback/<GetFontRuns>d__2:MoveNext ()' #11219

Closed
janusw opened this issue Apr 15, 2021 · 9 comments
Labels
need-info Waiting for more information before the bug can be investigated
Milestone

Comments

@janusw
Copy link

janusw commented Apr 15, 2021

This one is a regression that I observed when switching from VS for Mac 8.8 to 8.9. It was confirmed to work with Xamarin.iOS 14.10.0.4, but not with 14.14.2.5.
See also:

Steps to Reproduce

  1. Checkout https://github.com/Mapsui/Mapsui (master branch).
  2. Build and run the project Mapsui.Samples.Forms.iOS.
  3. Select the sample "Add Pin Sample" from the category "Forms".
  4. Tap on the map repeatedly.
  5. Observe pins appearing without a callout.
  6. Watch the debugger console for messages like this:
Error: Unexpected error in skia renderer, System.ExecutionEngineException: Attempting to JIT compile method 'bool Topten.RichTextKit.FontFallback/<GetFontRuns>d__2:MoveNext ()' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.

  at Topten.RichTextKit.TextBlock.AddDirectionalRun (Topten.RichTextKit.StyleRun styleRun, System.Int32 start, System.Int32 length, Topten.RichTextKit.TextDirection direction, Topten.RichTextKit.IStyle style) [0x00050] in <d19d2006976348d1b164d2aaf9ad9acd>:0 
  at Topten.RichTextKit.TextBlock.BuildFontRuns () [0x002e6] in <d19d2006976348d1b164d2aaf9ad9acd>:0 
  at Topten.RichTextKit.TextBlock.Layout () [0x000df] in <d19d2006976348d1b164d2aaf9ad9acd>:0 
  at Mapsui.Rendering.Skia.CalloutStyleRenderer.UpdateContent (Mapsui.Rendering.Skia.CalloutStyle callout) [0x0019a] in /Users/janus/github/Mapsui/Mapsui.Rendering.Skia/SkiaStyles/CalloutStyleRenderer.cs:199 
  at Mapsui.Rendering.Skia.CalloutStyleRenderer.Draw (SkiaSharp.SKCanvas canvas, Mapsui.IReadOnlyViewport viewport, System.Single opacity, Mapsui.Geometries.Point destination, Mapsui.Rendering.Skia.CalloutStyle calloutStyle) [0x0004c] in /Users/janus/github/Mapsui/Mapsui.Rendering.Skia/SkiaStyles/CalloutStyleRenderer.cs:21 
  at Mapsui.Rendering.Skia.PointRenderer.Draw (SkiaSharp.SKCanvas canvas, Mapsui.IReadOnlyViewport viewport, Mapsui.Styles.IStyle style, Mapsui.Providers.IFeature feature, Mapsui.Geometries.IGeometry geometry, Mapsui.Rendering.Skia.SymbolCache symbolCache, System.Single opacity) [0x00021] in /Users/janus/github/Mapsui/Mapsui.Rendering.Skia/PointRenderer.cs:19 
  at Mapsui.Rendering.Skia.MapRenderer.RenderFeature (SkiaSharp.SKCanvas canvas, Mapsui.IReadOnlyViewport viewport, Mapsui.Layers.ILayer layer, Mapsui.Styles.IStyle style, Mapsui.Providers.IFeature feature, System.Single layerOpacity) [0x0006e] in /Users/janus/github/Mapsui/Mapsui.Rendering.Skia/MapRenderer.cs:165 
  at Mapsui.Rendering.Skia.MapRenderer+<>c__DisplayClass18_0.<Render>b__0 (Mapsui.IReadOnlyViewport v, Mapsui.Layers.ILayer l, Mapsui.Styles.IStyle s, Mapsui.Providers.IFeature f, System.Single o) [0x00001] in /Users/janus/github/Mapsui/Mapsui.Rendering.Skia/MapRenderer.cs:110 
  at Mapsui.Rendering.VisibleFeatureIterator.IterateLayer (Mapsui.IReadOnlyViewport viewport, Mapsui.Layers.ILayer layer, System.Action`5[T1,T2,T3,T4,T5] callback) [0x0017d] in /Users/janus/github/Mapsui/Mapsui/Rendering/VisibleFeatureIterator.cs:63 
  at Mapsui.Rendering.VisibleFeatureIterator.IterateLayers (Mapsui.IReadOnlyViewport viewport, System.Collections.Generic.IEnumerable`1[T] layers, System.Action`5[T1,T2,T3,T4,T5] callback) [0x0004c] in /Users/janus/github/Mapsui/Mapsui/Rendering/VisibleFeatureIterator.cs:22 
  at Mapsui.Rendering.Skia.MapRenderer.Render (SkiaSharp.SKCanvas canvas, Mapsui.IReadOnlyViewport viewport, System.Collections.Generic.IEnumerable`1[T] layers) [0x0001e] in /Users/janus/github/Mapsui/Mapsui.Rendering.Skia/MapRenderer.cs:110 

Expected Behavior

All pins should have a callout label. There should be no errors reported in the Debugger console.

Actual Behavior

Most pins miss a callout. The error mentioned above appears.

Environment

=== Visual Studio Community 2019 for Mac ===

Version 8.9.6 (build 6)
Installation UUID: e5fb32f5-a2b0-4b30-a1b4-543017d8caaf
	GTK+ 2.24.23 (Raleigh theme)
	Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

	Package version: 612000125

=== Mono Framework MDK ===

Runtime:
	Mono 6.12.0.125 (2020-02/8c552e98bd6) (64-bit)
	Package version: 612000125

=== Roslyn (Language Service) ===

3.9.0-6.21152.10+c10f884b30737542ddd84ca889a4aad9281ce210

=== NuGet ===

Version: 5.8.0.6860

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/5.0.202/Sdks
SDK Versions:
	5.0.202
	5.0.201
	5.0.103
	5.0.102
	5.0.101
	5.0.100
	3.1.408
	3.1.407
	3.1.406
	3.1.405
	3.1.404
	3.1.403
	3.1.402
	3.1.302
	3.1.301
	3.1.300
	3.1.200
	3.1.102
	3.1.101
	3.1.100
	3.0.101
	3.0.100
	2.1.700
	2.1.505
	2.1.504
	2.1.503
	2.1.302
	2.1.301
	2.1.4
MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	5.0.5
	5.0.4
	5.0.3
	5.0.2
	5.0.1
	5.0.0
	5.0.0-rc.1.20451.14
	5.0.0-preview.7.20364.11
	3.1.14
	3.1.13
	3.1.12
	3.1.11
	3.1.10
	3.1.9
	3.1.8
	3.1.6
	3.1.5
	3.1.4
	3.1.2
	3.1.1
	3.1.0
	3.0.1
	3.0.0
	2.1.23
	2.1.22
	2.1.21
	2.1.20
	2.1.19
	2.1.18
	2.1.17
	2.1.16
	2.1.15
	2.1.14
	2.1.13
	2.1.11
	2.1.9
	2.1.8
	2.1.7
	2.1.2
	2.1.1
	2.0.5

=== .NET Core 3.1 SDK ===

SDK: 3.1.408

=== Xamarin.Profiler ===

Version: 1.6.15.68
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Apple Developer Tools ===

Xcode 12.4 (17801)
Build 12D4e

=== Xamarin.Mac ===

Version: 7.8.2.5 (Visual Studio Community)
Hash: 3836759d4
Branch: d16-9
Build date: 2021-02-10 17:56:43-0500

=== Xamarin.iOS ===

Version: 14.14.2.5 (Visual Studio Community)
Hash: 3836759d4
Branch: d16-9
Build date: 2021-02-10 17:56:44-0500

=== Xamarin Designer ===

Version: 16.9.0.323
Hash: 1b4790c08
Branch: remotes/origin/d16-9
Build date: 2021-03-31 05:12:20 UTC

=== Xamarin.Android ===

Version: 11.2.2.1 (Visual Studio Community)
Commit: xamarin-android/d16-9/877f572
Android SDK: /Users/janus/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		6.0 (API level 23)
		7.0 (API level 24)
		7.1 (API level 25)
		8.0 (API level 26)
		8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 31.0.1
SDK Build Tools Version: 30.0.2

Build Information: 
Mono: 5e9cb6d
Java.Interop: xamarin/java.interop/d16-9@54f8c24
ProGuard: Guardsquare/proguard/v7.0.1@912d149
SQLite: xamarin/sqlite/3.34.1@daff8f4
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-9@d210f11

=== Microsoft OpenJDK for Mobile ===

Java SDK: /Users/janus/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 16.9.0.22
Hash: a391de2
Branch: remotes/origin/d16-9~2
Build date: 2021-03-24 08:30:26 UTC

=== Android Device Manager ===

Version: 16.9.0.17
Hash: fc2b3db
Branch: remotes/origin/dev/jmt/d16-9bump~1
Build date: 2021-03-24 08:30:44 UTC

=== Build Information ===

Release ID: 809060006
Git revision: 47cf16e38721a785b8e2296ce6716502f34261ac
Build date: 2021-04-07 07:23:18-04
Build branch: release-8.9
Xamarin extensions: 47cf16e38721a785b8e2296ce6716502f34261ac

=== Operating System ===

Mac OS X 10.16.0
Darwin 20.3.0 Darwin Kernel Version 20.3.0
    Thu Jan 21 00:07:06 PST 2021
    root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64

Build Logs

--

Example Project (If Possible)

https://github.com/Mapsui/Mapsui/blob/master/Mapsui.sln

@mandel-macaque
Copy link
Member

Hello,

I have been trying to repro the issue, but I load the solution and I have some compilation errors (which I am not surprised):

Error: NuGet packages need to be restored before building. NuGet MSBuild targets are missing and are needed for building. The NuGet MSBuild targets are generated when the NuGet packages are restored. (Mapsui.Geometries)

Yet I don't know if I am doing this correctly. Can you share with me a set of command line steps to repro the build?

Thanks in advance (Sorry if the question is stupid, but we get a lot of samples and is hard to know how to build everything).

@mandel-macaque mandel-macaque added this to the Future milestone Apr 20, 2021
@mandel-macaque mandel-macaque added the need-info Waiting for more information before the bug can be investigated label Apr 20, 2021
@janusw
Copy link
Author

janusw commented Apr 21, 2021

Thanks for looking into this, @mandel-macaque!

I have been trying to repro the issue, but I load the solution and I have some compilation errors (which I am not surprised):

Error: NuGet packages need to be restored before building. NuGet MSBuild targets are missing and are needed for building. The NuGet MSBuild targets are generated when the NuGet packages are restored. (Mapsui.Geometries)

What exactly did you do? I've never seen these errors.

Yet I don't know if I am doing this correctly. Can you share with me a set of command line steps to repro the build?

I think the easiest way is to open Mapsui.sln in VS (or VS for Mac) and from there build and run the project Mapsui.Samples.Forms.iOS.

@pauldendulk, can you help here?

@janusw
Copy link
Author

janusw commented Apr 28, 2021

Recently upgraded to XCode 12.5, with these results:

  • the bug is still there
  • my workaround is gone (Xamarin.iOS 14.10.0.4 does not work any more: error HE0004: Could not load the framework 'DVTAnalytics')

Life's not fair 🙈

I guess I'll back down to XCode 12.4 again ...

@janusw
Copy link
Author

janusw commented May 4, 2021

Just tried Xamarim.iOS 14.16.0.5 (together with VS4Mac 8.9.8 and XCode 12.5). Unsurprisingly, the bug is still present.

@spouliot
Copy link
Contributor

This looks very similar to mono/mono#20805 (comment)

There's a workaround in that issue.

Updating to the latest (4.5.4) version of System.Memory nuget also fixed this issue in another case, see #11691 (comment)

@spouliot
Copy link
Contributor

I cannot confirm this myself. Like @mandel-macaque I get nuget errors while restoring

Error: NuGet packages need to be restored before building. NuGet MSBuild targets are missing and are needed for building. The NuGet MSBuild targets are generated when the NuGet packages are restored. (Mapsui.Geometries)

while building the XI/iOS project.

I think the easiest way is to open Mapsui.sln in VS (or VS for Mac) and from there build and run the project Mapsui.Samples.Forms.iOS.

and this is exactly what I did :)

There were some other warnings while opening the solution - but they looked Windows specific (and I ignored them as I only wanted to build the iOS on the Mac). They might (or not) be related to the nuget error.

@janusw
Copy link
Author

janusw commented May 26, 2021

This looks very similar to mono/mono#20805 (comment)

There's a workaround in that issue.

It also looks similar to #5687, where the same workaround is given. The workaround does indeed fix the issue here. But the issue really deserves a proper fix (wherever appropriate, in xamarin-macios or mono), not just a workaround.

@janusw
Copy link
Author

janusw commented May 26, 2021

I think the easiest way is to open Mapsui.sln in VS (or VS for Mac) and from there build and run the project Mapsui.Samples.Forms.iOS.

and this is exactly what I did :)

There were some other warnings while opening the solution - but they looked Windows specific (and I ignored them as I only wanted to build the iOS on the Mac).

On Mac you should actually use Mapsui.Mac.sln instead, which does not contain the Windows-specific stuff. HTH.

@rolfbjarne
Copy link
Member

The workaround does indeed fix the issue here.

Great!

That means that this is a duplicate of that issue, so I'm closing this one.

@ghost ghost locked as resolved and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need-info Waiting for more information before the bug can be investigated
Projects
None yet
Development

No branches or pull requests

4 participants