uno: [net7.0-ios] crash with SamplesApp

Current behavior

Building and running SamplesApp with net7.0-ios often crash at startup. This happens on both simulators and devices.

In case where it does not crash the screen remains black.

This works when using net6.0-ios.

Expected behavior

No crash

How to reproduce it (as minimally and precisely as possible)

  • Clone uno
  • Inside src/crosstargeting_override.props set <UnoTargetFrameworkOverride>net7.0-ios</UnoTargetFrameworkOverride>
  • On a Mac open src/Uno.UI-netcoremobile-only.slnf with VSfM
  • Build for iOS (simulator or device)
  • Run the application

Workaround

No response

Works on UWP/WinUI

None

Environment

No response

NuGet package version(s)

main / 4.7.0-dev

Affected platforms

iOS

IDE

Visual Studio for Mac

IDE version

Version 17.4.1 (build 28)

Relevant plugins

none

Anything else we need to know?

Running on device gave an additional hint with the log

2022-12-09 19:45:29.980 SamplesApp[4235:553886] error: no object of size 103788564432404912d

This would be quite a large object and it’s likely an invalid/corrupted value.

Crash report (device)

34  SamplesApp                    	       0x1047a8b7c SamplesApp_netcoremobile_BindableMetadataProvider_GetBindableTypeByType_System_Type + 28953468 (BindableMetadata.g.cs:85519)

This is also the location where the app can freeze (black screen) when a crash does not occur.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 21 (19 by maintainers)

Commits related to this issue

Most upvoted comments

It’s the same method identified earlier.

However it’s not the huge method. This one simply call the huge switch version with

var bindableType = GetBindableTypeByFullName(type.FullName);

Now GetBindableTypeByFullName does have more than 2000 locals (mostly bool) but it did not seem to be reached (and I doubt it was inlined).

OTOH it would not be hard to replace the latter with a different implementation but it might just hide the real issue. The fact that MacCatalyst worked fine hints that small differences have impact.

f42b59cf2e367a07ad5e3640670bae1875f6b5ff works (re-confirmed above)

6d26427b3dd071e20d487ee449141f24c326b350 crash (re-confirmed above)

6d26427b3dd071e20d487ee449141f24c326b350 w/o UITests.Shared.projitems changes -> works 6d26427b3dd071e20d487ee449141f24c326b350 w/o TextBox.cs changes -> crash

so we can resume (for how long?) the binary search if we remove the changes to UITests.Shared.projitems

af120dee6d6f3c75668345b48854db1cacefa3e4 works acd28c3ad679040b75efaf9bfcfbb65219db1f64 works 12e4c66ff5fb5f587fdd02f41ad52d7102f93e6d works f395100f8b8b3cdbea1641ea22d2036e4f103f62 build errors

Local changes to get SamplesApp working. Now we need to figure out what those changes triggers…

diff --git a/src/SamplesApp/UITests.Shared/UITests.Shared.projitems b/src/SamplesApp/UITests.Shared/UITests.Shared.projitems
index 19db85277d..e553f750d3 100644
--- a/src/SamplesApp/UITests.Shared/UITests.Shared.projitems
+++ b/src/SamplesApp/UITests.Shared/UITests.Shared.projitems
@@ -2313,10 +2313,6 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
-    <Page Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\TextBox\TextBox_ClipboardMethods.xaml">
-      <SubType>Designer</SubType>
-      <Generator>MSBuild:Compile</Generator>
-    </Page>
     <Page Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\TextBox\TextBox_CharacterCasing.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -6545,9 +6541,6 @@
     <Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\TextBox\TextBox_Binding_Null.xaml.cs">
       <DependentUpon>TextBox_Binding_Null.xaml</DependentUpon>
     </Compile>
-    <Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\TextBox\TextBox_ClipboardMethods.xaml.cs">
-      <DependentUpon>TextBox_ClipboardMethods.xaml</DependentUpon>
-    </Compile>
     <Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\TextBox\TextBox_CharacterCasing.xaml.cs">
       <DependentUpon>TextBox_CharacterCasing.xaml</DependentUpon>
     </Compile>
diff --git a/src/Uno.UI/UI/Xaml/Controls/RichEditBox/RichEditBox.cs b/src/Uno.UI/UI/Xaml/Controls/RichEditBox/RichEditBox.cs
index 38be9f4e55..5fca7e5384 100644
--- a/src/Uno.UI/UI/Xaml/Controls/RichEditBox/RichEditBox.cs
+++ b/src/Uno.UI/UI/Xaml/Controls/RichEditBox/RichEditBox.cs
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
 
 namespace Windows.UI.Xaml.Controls
 {
-	public partial class RichEditBox : Control
+	public partial class RichEditBox
 	{
 	}
 }

a860abff881e4a88888eb1bee1be5d03ca59e9b7 crash a860abff881e4a88888eb1bee1be5d03ca59e9b7 works (with :Control removal)

b9c5fc266fb50832a14f4e9738a61b889dcea741 works (with :Control removal) b0ba0a83e212bdff74e255ad4f11d445f6524aae works (with :Control removal) aba453015cbe3a48b5a8fe86d9ce0093fbd5ce25 works (with :Control removal) f42b59cf2e367a07ad5e3640670bae1875f6b5ff works (with :Control removal) 4934a0c52adac36184837a389b74aa85261d0367 build failure (with :Control removal) <<< 6d26427b3dd071e20d487ee449141f24c326b350 crash (with :Control removal)

44b839733820e0fdf3c05d4383d428cf3685f64e crash (with :Control removal) afc81e08a7cc1b6f887f000e367f8603454c4076 crash (with :Control removal)

So 4934a0c52adac36184837a389b74aa85261d0367 with the fix from the next commit is the next crasher. Again nothing obvious from the change itself 😦

Since I do everything manually I noticed several failures while trying to install the .app, trying again (without rebuilding) eventually installed the app properly.

This is new… I’ve never seen deployment issues fixed by just trying again. My guess is that it’s a problem with this device (or maybe cable?) in particular.

Again, doing a git clean -xfd, avoiding VSfM and deleting the app from the phone each time

3c308bb18e18cc5a1155104f1518f213d266a840 works (that’s current 4.6.19 stable release) 2d870f78f45ce0eb9b7aacac5d8d772f1db95b0b works dd9296501cef4821ad5218b8610c3872fe02b16f works e127d30a26e65ee91d06c424042a66ab778dd9c7 works eabf4ade7f691369099526060e31313dd5a6a84d works d923d64ce158777a351528e6c81ed4e07546c271 works 6aaba0e16c34fe5aa8b0aacf4e04ac6b8d2bdab1 works 81dc019d647bd12aab6de11a8e5297b0017e1a40 works 2427d280d01d85910f7b546dfd84bffacd44f5d8 works eabf4ade7f691369099526060e31313dd5a6a84d works (repetitively) a9d1394aaf3b51336ff26bce6e7f760622597130 crash (next revision, re-confirmed twice) f06c5fe51fc36b7fb0eafddb79e4cb2e3f2f5162 crash 25217eae2789d468b57f61561e387558bf10c6db crash

If I checkout HEAD and revert a9d1394aaf3b51336ff26bce6e7f760622597130 then the app works again, c.c. @jeromelaban

update: splitting a9d1394aaf3b51336ff26bce6e7f760622597130 crashed, going back to HEAD (without a9d1394aaf3b51336ff26bce6e7f760622597130) crashed ?!? which it did not earlier. It’s possible that something more is at play here (maybe just to make me lie again) and that some builds are randomly affected (so not all works above might always be working).

update 2: I suspect another, more recent(s), similar commit(s) hit the same issue and since it’s not 100% reproducible that can lead to happy (but wrong) conclusions.

Note

Since I do everything manually I noticed several failures while trying to install the .app, trying again (without rebuilding) eventually installed the app properly. c.c. @rolfbjarne

$ /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch --installdev ./bin/Debug/net7.0-ios/ios-arm64/SamplesApp.app

...

Installing application bundle 'com.companyname.SamplesApp' on 'Mercure (2)'
error MT1006: Could not install the application './bin/Debug/net7.0-ios/ios-arm64/SamplesApp.app' on the device: EOF Error (error: 0xe800000e).

It might be something with my phone, which is randomly saving the crash reports. I guess I should reboot it 😃

29d0e1b crash different

error: Failed to load AOT module ‘SkiaSharp.Views.UWP’ while running in aot-only mode because a dependency cannot be found or it is out of date.

that might have been a stale build.

The app starts normally when net7.0-maccatalyst with either maccatalyst-x64 and maccatalyst-arm64, which should be very similar (e.g. mono runtime and AOT) to the code executed for iOS on devices.