Repository navigation
chore: build & run SamplesApp.Skia.netcoremobile with CoreCLR on Android - #21477
Conversation
|
It's possible that this will require .NET 10 RC2; local testing on an x86-64 emulator immediately crashes at startup with: We'll see if CI behaves the same way. |
|
For expository purposes, to turn the above crash into more useful filename and line numbers:
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21477/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21477/docs/index.html |
cc8682f to
cd76c5f
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21477/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21477/docs/index.html |
|
This PR also fails on CI, but differently so: After applying After my experience with dotnet/android#10463, I wonder if it's because % grep -ril AndroidCryptoNative_InitLibraryOnLoad .
./libSystem.Security.Cryptography.Native.Android.so🧐 Indeed, (*gJvm)->GetEnv(gJvm, (void**)&env, JNI_VERSION_1_6);i.e. gJvm = vm; |
|
If I use dotnet/android@f4c6455 to build the test app on dotnet/android#10463 for CoreCLR, then the app does not crash on my x64 emulator, which is an improvement over .NET 10 RC1. Additionally, if I unzip the % grep -ril InitLibraryOnLoad .
./libassemblies.x86_64.blob.so
./libSystem.Security.Cryptography.Native.Android.soCompare and contrast with .NET 10 RC1 build with % grep -ril InitLibraryOnLoad .
./libassemblies.x86_64.blob.so
./libSystem.Security.Cryptography.Native.Android.soCompare and contrast with the Which I find to be fascinating. Why would the CI build not have More investigation required. |
|
The build 176153 found UI Test snapshots differences: Details
|
|
|
This was PEBKAC: the project I was using had a P/Invoke to Comment out the P/Invoke and call sites, and Grendel says that this should be fixed in RC2: https://discord.com/channels/732297728826277939/732297837953679412/1417401914584465499
Though I suspect that the workaround of "just P/Invoke it manually!" used on NativeAOT will also work for CoreCLR… |
cd76c5f to
ad2685e
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21477/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21477/docs/index.html |
ad2685e to
7820f90
Compare
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21477/docs/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21477/wasm-skia-net9/index.html |
|
All tests except one pass: Fails with: I am not sure why this assertion would fail because of CoreCLR… |
|
The build 176225 found UI Test snapshots differences: Details
|
|
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21477/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21477/docs/index.html |
|
|
ee099ff to
9e166f4
Compare
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21477/docs/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21477/wasm-skia-net9/index.html |
9e166f4 to
86f966c
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21477/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21477/docs/index.html |
|
The build 176359 found UI Test snapshots differences: Details
|
Context: https://github.com/dotnet/core/blob/4c489a6ae54f71c30c1d21f2fe0ebb3489482e92/release-notes/10.0/preview/rc1/dotnetmaui.md#experimental-coreclr Context: dotnet/android#10463 Context: dotnet/runtime#119821 .NET 10 RC1 adds: > **(Experimental) CoreCLR** > > Enables Android apps to run on the CoreCLR runtime (instead of Mono). > To use it [set the `$(UseMonoRuntime)` MSBuild property to `false`]. As building `SamplesApp.Skia.netcoremobile.csproj` with CoreCLR can take a significant amount of time and disk space, we've decided to introduce a new `Tests - Android+CoreCLR Skia` stage to build and run these unit tests within an Android+CoreCLR environment. To help reduce disk usage, after building the `.apk` we delete the `obj` directory. Update `src/SamplesApp/SamplesApp.Skia.netcoremobile` so that `$(ApplicationId)` can be overridden via the new `$(SkiaApplicationId)` MSBuild property. This allows CoreCLR builds to have distinct package names vs. default (MonoVM) builds, and allows them to be installed side-by-side (disk space pemitting). Additionally, crypto is not initialized when using CoreCLR under .NET 10 RC1, which resembles dotnet/android#10463. Add a call to `System.loadLibrary("System.Security.Cryptography.Native.Android")` to load and initialize Crypto support. Update `android-run-skia-runtime-tests.sh` so that `UNO_UITEST_APP_ID` can be overridden. This allows `uno.platform.samplesapp.skia.coreclr` to be launched. Finally, the behavior around storing `int.MaxValue` within a `float` differs between MonoVM and CoreCLR; see dotnet/runtime#119821. Update `AndroidSkiaNativeElementHostingExtension.MeasureNativeElement()` to use [`Android.Views.View.MeasureSpec.MakeMeasureSpec()`][0] instead of `(int)availablePhysical.Height`, as `.Height` will hold a `float` containing `int.MaxValue` if/when `availableSize.Height` is Infinite, which triggers differing behavior between MonoVM & CoreCLR. Using `MakeMeasureSpec()` fixes this inconsistency. [0]:https://developer.android.com/reference/android/view/View.MeasureSpec#makeMeasureSpec(int,%20int)
86f966c to
41a5796
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21477/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21477/docs/index.html |
|
|
|
The build 176380 found UI Test snapshots differences: Details
|
Context: 41a5796 Context: #21477 (comment) Context: https://dev.azure.com/xamarin/public/_artifacts/feed/SkiaSharp/NuGet/_SymbolsPreview/overview/0.0.0-branch.release.3.119.2-preview.1.2266 After CoreCLR tests were merged (41a5796), we started seeing occasional flakiness on CI, in which `SamplesApp.Skia.netcoremobile` would *crash* within SkiaSharp: F DEBUG : Cause: null pointer dereference F DEBUG : rax 00000000000001a9 rbx 00007259ee698820 rcx 0000000000000000 rdx 0000000000000275 F DEBUG : r8 4d1f000000050005 r9 0000000000000000 r10 000072592e679b24 r11 0000000000000001 F DEBUG : r12 0000000000000330 r13 0000000000000033 r14 0000725a3e6f7670 r15 000072170df19fd8 F DEBUG : rdi 0000000000000330 rsi 000072170df19fd8 F DEBUG : rbp 0000000000000000 rsp 000072170df19f30 rip 00007217123b06b7 F DEBUG : 7 total frames F DEBUG : backtrace: F DEBUG : #00 pc 00000000003056b7 /data/app/~~MTMdmfvAFJoDhk7yNyJTzA==/uno.platform.samplesapp.skia.coreclr-qeZLZ4L2cypBk9-ouYLb1Q==/lib/x86_64/libSkiaSharp.so F DEBUG : #1 pc 00000000003052be /data/app/~~MTMdmfvAFJoDhk7yNyJTzA==/uno.platform.samplesapp.skia.coreclr-qeZLZ4L2cypBk9-ouYLb1Q==/lib/x86_64/libSkiaSharp.so F DEBUG : #2 pc 00000000002e4b64 /data/app/~~MTMdmfvAFJoDhk7yNyJTzA==/uno.platform.samplesapp.skia.coreclr-qeZLZ4L2cypBk9-ouYLb1Q==/lib/x86_64/libSkiaSharp.so F DEBUG : #3 pc 0000000000274884 /data/app/~~MTMdmfvAFJoDhk7yNyJTzA==/uno.platform.samplesapp.skia.coreclr-qeZLZ4L2cypBk9-ouYLb1Q==/lib/x86_64/libSkiaSharp.so F DEBUG : #4 pc 000000000027469d /data/app/~~MTMdmfvAFJoDhk7yNyJTzA==/uno.platform.samplesapp.skia.coreclr-qeZLZ4L2cypBk9-ouYLb1Q==/lib/x86_64/libSkiaSharp.so F DEBUG : #5 pc 000000000024f28f /data/app/~~MTMdmfvAFJoDhk7yNyJTzA==/uno.platform.samplesapp.skia.coreclr-qeZLZ4L2cypBk9-ouYLb1Q==/lib/x86_64/libSkiaSharp.so (sk_canvas_draw_picture+95) F DEBUG : #6 pc 000000000010897e /memfd:doublemapper (deleted) (offset 0x3181000) @jonpryor suspects that this is because the GC is collecting *something*, which causes whatever SkiaSharp is attempting to use to be `null`. The question is, *what* is SkiaSharp attempting to use that triggers the SIGSEGV? Answering this requires debug symbols for SkiaSharp, which did not exist. Enter [SkiaSharp 3.119.2-preview.1][0], which *has* symbols, though it takes a bit of work to obtain them: 1. Go to <https://dev.azure.com/xamarin/public/_artifacts/feed/SkiaSharp/NuGet/_SymbolsPreview/overview/0.0.0-branch.release.3.119.2-preview.1.2266> 2. Click **↓ Download** 3. `unzip _SymbolsPreview.0.0.0-branch.release.3.119.2-preview.1.2266.nupkg` 4. `unzip -d _t tools/SkiaSharp.NativeAssets.Android.3.119.2-preview.1.symbols.nupkg` Then e.g. `_t/runtimes/android-x64/native/libSkiaSharp.so.dbg` contains debug symbols for `libSkiaSharp.so`. Bump `$(SkiaSharpVersion)` to 3.119.2-preview.1, so that when `SamplesApp.Skia.netcoremobile` crashes in the future, we can better investigate the native side of the crash. [0]: https://www.nuget.org/packages/SkiaSharp/3.119.2-preview.1
Context: 41a5796 Context: #21477 (comment) Context: https://dev.azure.com/xamarin/public/_artifacts/feed/SkiaSharp/NuGet/_SymbolsPreview/overview/0.0.0-branch.release.3.119.2-preview.1.2266 After CoreCLR tests were merged (41a5796), we started seeing occasional flakiness on CI, in which `SamplesApp.Skia.netcoremobile` would *crash* within SkiaSharp: F DEBUG : Cause: null pointer dereference F DEBUG : rax 00000000000001a9 rbx 00007259ee698820 rcx 0000000000000000 rdx 0000000000000275 F DEBUG : r8 4d1f000000050005 r9 0000000000000000 r10 000072592e679b24 r11 0000000000000001 F DEBUG : r12 0000000000000330 r13 0000000000000033 r14 0000725a3e6f7670 r15 000072170df19fd8 F DEBUG : rdi 0000000000000330 rsi 000072170df19fd8 F DEBUG : rbp 0000000000000000 rsp 000072170df19f30 rip 00007217123b06b7 F DEBUG : 7 total frames F DEBUG : backtrace: F DEBUG : #00 pc 00000000003056b7 /data/app/~~MTMdmfvAFJoDhk7yNyJTzA==/uno.platform.samplesapp.skia.coreclr-qeZLZ4L2cypBk9-ouYLb1Q==/lib/x86_64/libSkiaSharp.so F DEBUG : #1 pc 00000000003052be /data/app/~~MTMdmfvAFJoDhk7yNyJTzA==/uno.platform.samplesapp.skia.coreclr-qeZLZ4L2cypBk9-ouYLb1Q==/lib/x86_64/libSkiaSharp.so F DEBUG : #2 pc 00000000002e4b64 /data/app/~~MTMdmfvAFJoDhk7yNyJTzA==/uno.platform.samplesapp.skia.coreclr-qeZLZ4L2cypBk9-ouYLb1Q==/lib/x86_64/libSkiaSharp.so F DEBUG : #3 pc 0000000000274884 /data/app/~~MTMdmfvAFJoDhk7yNyJTzA==/uno.platform.samplesapp.skia.coreclr-qeZLZ4L2cypBk9-ouYLb1Q==/lib/x86_64/libSkiaSharp.so F DEBUG : #4 pc 000000000027469d /data/app/~~MTMdmfvAFJoDhk7yNyJTzA==/uno.platform.samplesapp.skia.coreclr-qeZLZ4L2cypBk9-ouYLb1Q==/lib/x86_64/libSkiaSharp.so F DEBUG : #5 pc 000000000024f28f /data/app/~~MTMdmfvAFJoDhk7yNyJTzA==/uno.platform.samplesapp.skia.coreclr-qeZLZ4L2cypBk9-ouYLb1Q==/lib/x86_64/libSkiaSharp.so (sk_canvas_draw_picture+95) F DEBUG : #6 pc 000000000010897e /memfd:doublemapper (deleted) (offset 0x3181000) @jonpryor suspects that this is because the GC is collecting *something*, which causes whatever SkiaSharp is attempting to use to be `null`. The question is, *what* is SkiaSharp attempting to use that triggers the SIGSEGV? Answering this requires debug symbols for SkiaSharp, which did not exist. Enter [SkiaSharp 3.119.2-preview.1][0], which *has* symbols, though it takes a bit of work to obtain them: 1. Go to <https://dev.azure.com/xamarin/public/_artifacts/feed/SkiaSharp/NuGet/_SymbolsPreview/overview/0.0.0-branch.release.3.119.2-preview.1.2266> 2. Click **↓ Download** 3. `unzip _SymbolsPreview.0.0.0-branch.release.3.119.2-preview.1.2266.nupkg` 4. `unzip -d _t tools/SkiaSharp.NativeAssets.Android.3.119.2-preview.1.symbols.nupkg` Then e.g. `_t/runtimes/android-x64/native/libSkiaSharp.so.dbg` contains debug symbols for `libSkiaSharp.so`. Update `.azure-devops-tests-android-coreclr-skia-build.yml` and `.azure-devops-tests-android-nativeaot-skia-build.yml` to override the `$(SkiaSharpVersion)` MSBuild property to 3.119.2-preview.1 so that the CoreCLR and NativeAOT builds of SamplesApp.Skia.netcoremobile are built using SkiaSharp 3.119.2-preview.1, so that when `SamplesApp.Skia.netcoremobile` crashes in the future, we can better investigate the native side of the crash. [0]: https://www.nuget.org/packages/SkiaSharp/3.119.2-preview.1
chore: build & run SamplesApp.Skia.netcoremobile with CoreCLR on Android
Context: https://github.com/dotnet/core/blob/4c489a6ae54f71c30c1d21f2fe0ebb3489482e92/release-notes/10.0/preview/rc1/dotnetmaui.md#experimental-coreclr
Context: dotnet/android#10463
Context: dotnet/runtime#119821
.NET 10 RC1 adds:
As building
SamplesApp.Skia.netcoremobile.csprojwith CoreCLR cantake a significant amount of time and disk space, we've decided to
introduce a new
Tests - Android+CoreCLR Skiastage to build andrun these unit tests within an Android+CoreCLR environment.
To help reduce disk usage, after building the
.apkwe delete theobjdirectory.Update
src/SamplesApp/SamplesApp.Skia.netcoremobileso that$(ApplicationId)can be overridden via the new$(SkiaApplicationId)MSBuild property. This allows CoreCLR builds to have distinct package
names vs. default (MonoVM) builds, and allows them to be installed
side-by-side (disk space pemitting).
Additionally, crypto is not initialized when using CoreCLR under
.NET 10 RC1, which resembles dotnet/android#10463. Add a call to
System.loadLibrary("System.Security.Cryptography.Native.Android")to load and initialize Crypto support.
Update
android-run-skia-runtime-tests.shso thatUNO_UITEST_APP_IDcan be overridden. This allows
uno.platform.samplesapp.skia.coreclrto be launched.
Finally, the behavior around storing
int.MaxValuewithin afloatdiffers between MonoVM and CoreCLR; see dotnet/runtime#119821.
Update
AndroidSkiaNativeElementHostingExtension.MeasureNativeElement()to use
Android.Views.View.MeasureSpec.MakeMeasureSpec()insteadof
(int)availablePhysical.Height, as.Heightwill hold afloatcontainingint.MaxValueif/whenavailableSize.HeightisInfinite, which triggers differing behavior between MonoVM & CoreCLR.
Using
MakeMeasureSpec()fixes this inconsistency.GitHub Issue: closes #
PR Type:
What is the current behavior? 🤔
What is the new behavior? 🚀
PR Checklist ✅
Please check if your PR fulfills the following requirements:
Screenshots Compare Test Runresults.Other information ℹ️