Skip to content

[android] improve FormattedString performance #21712

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

Merged
merged 1 commit into from
Apr 9, 2024

Conversation

jonathanpeppers
Copy link
Member

@jonathanpeppers jonathanpeppers commented Apr 8, 2024

Context: https://github.com/Redth/MauiCollectionViewGallery
Fixes #14222

This depends on changes in:

(as both of these would conflict with each other)

Profiling the above sample while scrolling on a Pixel 5, a lot of time is spent in FormattedStringExtensions.RecalculateSpanPositions():

(20%) Microsoft.Maui.Controls!Microsoft.Maui.Controls.Platform.FormattedStringExtensions.RecalculateSpanPositions(Android.Widget.TextView,Microsoft.Maui.Controls.Label,Android.Text.SpannableString,Microsoft.Maui.SizeRequest)
(11%) Microsoft.Maui.Controls!Microsoft.Maui.Controls.Platform.FormattedStringExtensions.FontSpan.UpdateDrawState(Android.Text.TextPaint)
(11%) Microsoft.Maui.Controls!Microsoft.Maui.Controls.Platform.FormattedStringExtensions.FontSpan.Apply(Android.Text.TextPaint)
(6.3%) MauiCollectionViewGallery!PoolMathApp.Helpers.FormattedTextExtensions.ToFormattedString(PoolMathApp.Models.FormattedTex

The key contributors are FontSpan and LineHeightSpan which:

  • Implement MetricAffectingSpan, an abstract class that allows to change the metrics of the text.

  • Implement UpdateDrawState() and Apply() methods that are called during draw. Causing frequent Java -> C# interop.

To fix this, let's move the following types from C# to Java:

  • FontSpan -> PlatformFontSpan
  • LetterSpacingSpan -> PlatformFontSpan (use different ctor)
  • LineHeightSpan -> PlatformLineHeightSpan

PlatformLineHeightSpan is similar, as it is an implementation of the LineHeightSpan interface.

With these changes, I see a nice improvement while scrolling:

(5.5%) Microsoft.Maui.Controls!Microsoft.Maui.Controls.Platform.FormattedStringExtensions.RecalculateSpanPositions(Android.Widget.TextView,Microsoft.Maui.Controls.Label,Android.Text.SpannableString,Microsoft.Maui.SizeRequest)
(4.0%) MauiCollectionViewGallery!PoolMathApp.Helpers.FormattedTextExtensions.ToFormattedString(PoolMathApp.Models.FormattedText

RecalculateSpanPositions overall, went from 20% to 5.5%!

Comparing the new types, the times spent calling the constructors are also improved:

Before:
(1.1%) Microsoft.Maui.Controls!Microsoft.Maui.Controls.Platform.FormattedStringExtensions.FontSpan..ctor(Microsoft.Maui.Font,M
(1.5%) Microsoft.Maui.Controls!Microsoft.Maui.Controls.Platform.FormattedStringExtensions.LetterSpacingSpan..ctor(double)
After:
(1.0%) Microsoft.Maui!Microsoft.Maui.PlatformFontSpan..ctor(Android.Content.Context,Android.Graphics.Typeface,bool,single)
(0.82%) Microsoft.Maui!Microsoft.Maui.PlatformFontSpan..ctor(single)

This should be reasonable for .NET 8servicing, as there should be no behavior changes and no API changes.

In a future PR, it looks like FormattedStringExtensions could be improved further, but this is a decent starting point that makes it a lot better.

Context: https://github.com/Redth/MauiCollectionViewGallery
Fixes: #14222

This will conflict with:

* #20352

But I will rework this after it is merged.

Profiling the above sample while scrolling on a Pixel 5, a lot of time
is spent in `FormattedStringExtensions.RecalculateSpanPositions()`:

    (20%) Microsoft.Maui.Controls!Microsoft.Maui.Controls.Platform.FormattedStringExtensions.RecalculateSpanPositions(Android.Widget.TextView,Microsoft.Maui.Controls.Label,Android.Text.SpannableString,Microsoft.Maui.SizeRequest)
    (11%) Microsoft.Maui.Controls!Microsoft.Maui.Controls.Platform.FormattedStringExtensions.FontSpan.UpdateDrawState(Android.Text.TextPaint)
    (11%) Microsoft.Maui.Controls!Microsoft.Maui.Controls.Platform.FormattedStringExtensions.FontSpan.Apply(Android.Text.TextPaint)
    (6.3%) MauiCollectionViewGallery!PoolMathApp.Helpers.FormattedTextExtensions.ToFormattedString(PoolMathApp.Models.FormattedTex

The key contributors are `FontSpan` and `LineHeightSpan` which:

* Implement `MetricAffectingSpan`, an abstract class that allows to
  change the metrics of the text.

* Implement `UpdateDrawState()` and `Apply()` methods that are called
  during draw. Causing frequent Java -> C# interop.

To fix this, let's move the following types from C# to Java:

* `FontSpan` -> `PlatformFontSpan`
* `LetterSpacingSpan` -> `PlatformFontSpan` (use different ctor)
* `LineHeightSpan` -> `PlatformLineHeightSpan`

`PlatformLineHeightSpan` is similar, as it is an implementation of the
`LineHeightSpan` interface.

With these changes, I see a nice improvement while scrolling:

    (5.5%) Microsoft.Maui.Controls!Microsoft.Maui.Controls.Platform.FormattedStringExtensions.RecalculateSpanPositions(Android.Widget.TextView,Microsoft.Maui.Controls.Label,Android.Text.SpannableString,Microsoft.Maui.SizeRequest)
    (4.0%) MauiCollectionViewGallery!PoolMathApp.Helpers.FormattedTextExtensions.ToFormattedString(PoolMathApp.Models.FormattedText

`RecalculateSpanPositions` overall, went from 20% to 5.5%!

Comparing the new types, the times spent calling the constructors are
also improved:

    Before:
    (1.1%) Microsoft.Maui.Controls!Microsoft.Maui.Controls.Platform.FormattedStringExtensions.FontSpan..ctor(Microsoft.Maui.Font,M
    (1.5%) Microsoft.Maui.Controls!Microsoft.Maui.Controls.Platform.FormattedStringExtensions.LetterSpacingSpan..ctor(double)
    After:
    (1.0%) Microsoft.Maui!Microsoft.Maui.PlatformFontSpan..ctor(Android.Content.Context,Android.Graphics.Typeface,bool,single)
    (0.82%) Microsoft.Maui!Microsoft.Maui.PlatformFontSpan..ctor(single)

This should be reasonable for .NET 8servicing, as there should be no
behavior changes and no API changes.

In a future PR, it looks like `FormattedStringExtensions` could be
improved further, but this is a decent starting point that makes it a
lot better.
@jonathanpeppers jonathanpeppers requested a review from a team as a code owner April 8, 2024 21:39
@jonathanpeppers jonathanpeppers requested review from jsuarezruiz and tj-devel709 and removed request for a team April 8, 2024 21:39
@mattleibow
Copy link
Member

/azp run

Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@jsuarezruiz jsuarezruiz added platform/android legacy-area-perf Startup / Runtime performance area-controls-label Label, Span labels Apr 9, 2024
@dotnet-policy-service dotnet-policy-service bot added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Apr 9, 2024
@mattleibow
Copy link
Member

/azp run MAUI-UITests-public

Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

Copy link
Member

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point, this whole method can go into Java code. We can pass in all the values as some sort of parameter list and then no interop at all.

@rmarinho rmarinho merged commit 4aec060 into release/8.0.1xx-sr4 Apr 9, 2024
@rmarinho rmarinho deleted the dev/peppers/FormattedString branch April 9, 2024 10:25
@mfeingol
Copy link

mfeingol commented May 1, 2024

@jonathanpeppers:

Seeing an odd exception with MAUI 8.0.21 on Android 13. Not seeing this on Android 14. Seems maybe related to your changes here?

**Java.Lang.ClassNotFoundException:** 'Didn't find class "com.microsoft.maui.PlatformFontSpan" on path: DexPathList[[zip file "/data/app/~~tkOQN3Wonatt6TCbe0utjA==/com.Backroads.Android-Fo7Ncpx4zIZErEBcne04UQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~tkOQN3Wonatt6TCbe0utjA==/com.Backroads.Android-Fo7Ncpx4zIZErEBcne04UQ==/lib/x86_64, /data/app/~~tkOQN3Wonatt6TCbe0utjA==/com.Backroads.Android-Fo7Ncpx4zIZErEBcne04UQ==/base.apk!/lib/x86_64, /system/lib64, /system_ext/lib64]]'
 	0xFFFFFFFFFFFFFFFF in Android.Runtime.RuntimeNativeMethods.monodroid_debugger_unhandled_exception	C#
 	0x1A in Android.Runtime.JNINativeWrapper._unhandled_exception at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:13,5	C#
 	0x23 in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPLLL_L at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:368,26	C#
 	0x168 in Java.Interop.JniEnvironment.Types.TryFindClass at /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniEnvironment.Types.cs:89,5	C#
 	0x2 in Java.Interop.JniEnvironment.Types.FindClass at /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniEnvironment.Types.cs:37,5	C#
 	0x7 in Java.Interop.JniType..ctor at /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniType.cs:51,4	C#
 	0x19 in Java.Interop.JniType.GetCachedJniType at /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniType.cs:106,4	C#
 	0xC in Java.Interop.JniPeerMembers.get_JniPeerType at /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.cs:83,5	C#
 	0x17 in Java.Interop.JniPeerMembers.JniInstanceMethods.get_JniPeerType at /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods.cs:37,9	C#
 	0x3F in Java.Interop.JniPeerMembers.JniInstanceMethods.StartCreateInstance at /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods.cs:139,4	C#
 	0x48 in Microsoft.Maui.PlatformFontSpan..ctor at D:\a\_work\1\s\src\Core\src\obj\Release\net8.0-android\generated\src\Microsoft.Maui.PlatformFontSpan.cs:85,5	C#
 	0x18C in Microsoft.Maui.Controls.Platform.FormattedStringExtensions.ToSpannableStringNewWay at D:\a\_work\1\s\src\Controls\src\Core\Platform\Android\Extensions\FormattedStringExtensions.cs:112,6	C#
 	0x5D in Microsoft.Maui.Controls.Platform.FormattedStringExtensions.ToSpannableString at D:\a\_work\1\s\src\Controls\src\Core\Platform\Android\Extensions\FormattedStringExtensions.cs:17,7	C#
 	0x19 in Microsoft.Maui.Controls.Platform.TextViewExtensions.UpdateText at D:\a\_work\1\s\src\Controls\src\Core\Platform\Android\Extensions\TextViewExtensions.cs:18,7	C#
 	0x7 in Microsoft.Maui.Controls.Label.MapText at D:\a\_work\1\s\src\Controls\src\Core\Label\Label.Android.cs:41,4	C#
 	0x8 in Microsoft.Maui.PropertyMapperExtensions.<>c__DisplayClass2_0<Microsoft.Maui.Controls.Label,Microsoft.Maui.Handlers. at D:\a\_work\1\s\src\Core\src\PropertyMapperExtensions.cs:66,79	C#
 	0x2D in Microsoft.Maui.PropertyMapperExtensions.<>c__DisplayClass1_0<Microsoft.Maui.Controls.Label,Microsoft.Maui.Handlers. at D:\a\_work\1\s\src\Core\src\PropertyMapperExtensions.cs:46,6	C#
 	0x21 in Microsoft.Maui.PropertyMapper<Microsoft.Maui.ILabel,Microsoft.Maui.Handlers.ILabelHandler>. at D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:172,6	C#
 	0x17 in Microsoft.Maui.PropertyMapper.UpdatePropertyCore at D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:47,4	C#
 	0x8 in Microsoft.Maui.PropertyMapper.UpdateProperty at D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:72,4	C#
 	0x1C in Microsoft.Maui.Handlers.ElementHandler.UpdateValue at D:\a\_work\1\s\src\Core\src\Handlers\Element\ElementHandler.cs:87,4	C#
 	0xE in Microsoft.Maui.Controls.Label.MapFont at D:\a\_work\1\s\src\Controls\src\Core\Label\Label.Mapper.cs:137,5	C#
 	0x2D in Microsoft.Maui.PropertyMapperExtensions.<>c__DisplayClass1_0<Microsoft.Maui.Controls.Label,Microsoft.Maui.Handlers. at D:\a\_work\1\s\src\Core\src\PropertyMapperExtensions.cs:46,6	C#
 	0x21 in Microsoft.Maui.PropertyMapper<Microsoft.Maui.ILabel,Microsoft.Maui.Handlers.ILabelHandler>. at D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:172,6	C#
 	0x17 in Microsoft.Maui.PropertyMapper.UpdatePropertyCore at D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:47,4	C#
 	0x1D in Microsoft.Maui.PropertyMapper.UpdateProperties at D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:82,5	C#
 	0xCB in Microsoft.Maui.Handlers.ElementHandler.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\Element\ElementHandler.cs:79,4	C#
 	0x2 in Microsoft.Maui.Handlers.ViewHandler<Microsoft.Maui.ILabel,AndroidX.AppCompat.Widget.AppCompatTextView>.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:53,4	C#
 	0x7 in Microsoft.Maui.Handlers.ViewHandler<Microsoft.Maui.ILabel,AndroidX.AppCompat.Widget.AppCompatTextView>.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:56,4	C#
 	0x8B in Microsoft.Maui.Controls.Element.SetHandler at D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:922,6	C#
 	0x2 in Microsoft.Maui.Controls.Element.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:864,11	C#
 	0x18 in Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\VisualElement\VisualElement.cs:2061,5	C#
 	0xB0 in Microsoft.Maui.Platform.ElementExtensions.ToHandler at D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:96,4	C#
 	0x2 in Microsoft.Maui.Platform.ElementExtensions.ToPlatform at D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:127,4	C#
 	0x83 in Microsoft.Maui.Handlers.LayoutHandler.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\Layout\LayoutHandler.Android.cs:41,5	C#
 	0x7 in Microsoft.Maui.Handlers.ViewHandler<Microsoft.Maui.ILayout,Microsoft.Maui.Platform.LayoutViewGroup>.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:56,4	C#
 	0x8B in Microsoft.Maui.Controls.Element.SetHandler at D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:922,6	C#
 	0x2 in Microsoft.Maui.Controls.Element.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:864,11	C#
 	0x18 in Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\VisualElement\VisualElement.cs:2061,5	C#
 	0xB0 in Microsoft.Maui.Platform.ElementExtensions.ToHandler at D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:96,4	C#
 	0x2 in Microsoft.Maui.Platform.ElementExtensions.ToPlatform at D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:127,4	C#
 	0x83 in Microsoft.Maui.Handlers.LayoutHandler.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\Layout\LayoutHandler.Android.cs:41,5	C#
 	0x7 in Microsoft.Maui.Handlers.ViewHandler<Microsoft.Maui.ILayout,Microsoft.Maui.Platform.LayoutViewGroup>.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:56,4	C#
 	0x8B in Microsoft.Maui.Controls.Element.SetHandler at D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:922,6	C#
 	0x2 in Microsoft.Maui.Controls.Element.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:864,11	C#
 	0x18 in Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\VisualElement\VisualElement.cs:2061,5	C#
 	0xB0 in Microsoft.Maui.Platform.ElementExtensions.ToHandler at D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:96,4	C#
 	0x2 in Microsoft.Maui.Platform.ElementExtensions.ToPlatform at D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:127,4	C#
 	0x1D in Microsoft.Maui.Handlers.ScrollViewHandler.UpdateInsetView at D:\a\_work\1\s\src\Core\src\Handlers\ScrollView\ScrollViewHandler.Android.cs:180,4	C#
 	0x1F in Microsoft.Maui.Handlers.ScrollViewHandler.MapContent at D:\a\_work\1\s\src\Core\src\Handlers\ScrollView\ScrollViewHandler.Android.cs:114,4	C#
 	0x21 in Microsoft.Maui.PropertyMapper<Microsoft.Maui.IScrollView,Microsoft.Maui.Handlers.IScrollViewHandler>. at D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:172,6	C#
 	0x17 in Microsoft.Maui.PropertyMapper.UpdatePropertyCore at D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:47,4	C#
 	0x1D in Microsoft.Maui.PropertyMapper.UpdateProperties at D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:82,5	C#
 	0xCB in Microsoft.Maui.Handlers.ElementHandler.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\Element\ElementHandler.cs:79,4	C#
 	0x2 in Microsoft.Maui.Handlers.ViewHandler<Microsoft.Maui.IScrollView,Microsoft.Maui.Platform.MauiScrollView>.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:53,4	C#
 	0x7 in Microsoft.Maui.Handlers.ViewHandler<Microsoft.Maui.IScrollView,Microsoft.Maui.Platform.MauiScrollView>.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:56,4	C#
 	0x8B in Microsoft.Maui.Controls.Element.SetHandler at D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:922,6	C#
 	0x2 in Microsoft.Maui.Controls.Element.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:864,11	C#
 	0x18 in Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\VisualElement\VisualElement.cs:2061,5	C#
 	0xB0 in Microsoft.Maui.Platform.ElementExtensions.ToHandler at D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:96,4	C#
 	0x2 in Microsoft.Maui.Platform.ElementExtensions.ToPlatform at D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:127,4	C#
 	0x83 in Microsoft.Maui.Handlers.LayoutHandler.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\Layout\LayoutHandler.Android.cs:41,5	C#
 	0x7 in Microsoft.Maui.Handlers.ViewHandler<Microsoft.Maui.ILayout,Microsoft.Maui.Platform.LayoutViewGroup>.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:56,4	C#
 	0x8B in Microsoft.Maui.Controls.Element.SetHandler at D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:922,6	C#
 	0x2 in Microsoft.Maui.Controls.Element.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:864,11	C#
 	0x18 in Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\VisualElement\VisualElement.cs:2061,5	C#
 	0xB0 in Microsoft.Maui.Platform.ElementExtensions.ToHandler at D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:96,4	C#
 	0x2 in Microsoft.Maui.Platform.ElementExtensions.ToPlatform at D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:127,4	C#
 	0x60 in Microsoft.Maui.Handlers.ContentViewHandler.UpdateContent at D:\a\_work\1\s\src\Core\src\Handlers\ContentView\ContentViewHandler.Android.cs:42,5	C#
 	0x1 in Microsoft.Maui.Handlers.ContentViewHandler.MapContent at D:\a\_work\1\s\src\Core\src\Handlers\ContentView\ContentViewHandler.Android.cs:47,4	C#
 	0x21 in Microsoft.Maui.PropertyMapper<Microsoft.Maui.IContentView,Microsoft.Maui.Handlers.IContentViewHandler>. at D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:172,6	C#
 	0x17 in Microsoft.Maui.PropertyMapper.UpdatePropertyCore at D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:47,4	C#
 	0x1D in Microsoft.Maui.PropertyMapper.UpdateProperties at D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:82,5	C#
 	0xCB in Microsoft.Maui.Handlers.ElementHandler.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\Element\ElementHandler.cs:79,4	C#
 	0x2 in Microsoft.Maui.Handlers.ViewHandler<Microsoft.Maui.IContentView,Microsoft.Maui.Platform.ContentViewGroup>.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:53,4	C#
 	0x2 in Microsoft.Maui.Handlers.ContentViewHandler.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\ContentView\ContentViewHandler.Android.cs:26,4	C#
 	0x7 in Microsoft.Maui.Handlers.ViewHandler<Microsoft.Maui.IContentView,Microsoft.Maui.Platform.ContentViewGroup>.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:56,4	C#
 	0x8B in Microsoft.Maui.Controls.Element.SetHandler at D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:922,6	C#
 	0x2 in Microsoft.Maui.Controls.Element.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:864,11	C#
 	0x18 in Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\VisualElement\VisualElement.cs:2061,5	C#
 	0xB0 in Microsoft.Maui.Platform.ElementExtensions.ToHandler at D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:96,4	C#
 	0x2 in Microsoft.Maui.Platform.ElementExtensions.ToPlatform at D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:127,4	C#
 	0x5A in Microsoft.Maui.Platform.MauiContextExtensions.ToPlatform at D:\a\_work\1\s\src\Core\src\Platform\Android\MauiContextExtensions.cs:96,4	C#
 	0x2B in Microsoft.Maui.Controls.Platform.FragmentContainer.OnCreateView at D:\a\_work\1\s\src\Controls\src\Core\Platform\Android\FragmentContainer.cs:41,4	C#
 	0x24 in AndroidX.Fragment.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ at C:\a\_work\2\s\generated\androidx.fragment.fragment\obj\Release\net7.0-android\generated\src\AndroidX.Fragment.App.Fragment.cs:2045,4	C#
 	0xD in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPLLL_L at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:367,5	C#

@jonathanpeppers
Copy link
Member Author

@mfeingol did you already try a rebuild?

If I download:

I see the file inside:

image

So you might also check your NuGet cache, to see if something inside is malformed.

@mfeingol
Copy link

mfeingol commented May 1, 2024

@jonathanpeppers: okay, yeah, I had to do some cleanup but now it's working without issues so it was probably a bad build artifact. Sorry for the noise!

@Eilon Eilon added perf/general The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf) and removed legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor legacy-area-perf Startup / Runtime performance labels May 10, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jun 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-label Label, Span fixed-in-8.0.21 fixed-in-9.0.0-preview.4.10690 perf/general The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf) platform/android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants