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

Crash CollectionView EmptyView SelectionMode=Single on Android #9060

Closed
epsmae opened this issue Jul 29, 2022 · 8 comments
Closed

Crash CollectionView EmptyView SelectionMode=Single on Android #9060

epsmae opened this issue Jul 29, 2022 · 8 comments
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView fixed-in-6.0.540 Look for this fix in 6.0.540 SR5! fixed-in-7.0.0-rc.1.6683 platform/android 🤖 s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working
Milestone

Comments

@epsmae
Copy link

epsmae commented Jul 29, 2022

Description

If an empty view is used in a collection view with single selection mode and there is no Item in the list on startup the app crashes on Android. Works fine on Windows.

Steps to Reproduce

  1. Create new maui app
  2. Replace MainPage.xaml with the following content:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MauiApp1.MainPage">

    <ScrollView>
        <VerticalStackLayout
            Spacing="25"
            Padding="30,0"
            VerticalOptions="Center">

            <CollectionView Grid.Row="1" Margin="16,0,16,6" ItemsSource="{Binding Items}" SelectionMode="Single" SelectionChanged="OnSelectionChanged">
                <CollectionView.EmptyView>
                    <ContentView>
                        <Label Text="Empty" />
                    </ContentView>
                </CollectionView.EmptyView>

                <CollectionView.ItemTemplate>
                    <DataTemplate>
                        <Grid RowDefinitions="*" ColumnDefinitions="*" >
                            <Label Grid.Row="0" Grid.Column="0" Text="{Binding}" />
                        </Grid>
                    </DataTemplate>
                </CollectionView.ItemTemplate>
            </CollectionView>

            <Button
               Text="Add"
                Clicked="OnAddClicked"
                HorizontalOptions="Center" />

            <Button
               Text="Clear"
                Clicked="OnClearClicked"
                HorizontalOptions="Center" />

        </VerticalStackLayout>
    </ScrollView>

</ContentPage>
  1. Replace MainPage.xaml.cs with the following content:
public partial class MainPage : ContentPage
   {
       private ObservableCollection<string> _items = new ObservableCollection<string>()
           {
               // uncomment to avoid crash on startup
               //"Item_1",
               //"Item_2",
               //"Item_3",
           };

       public MainPage()
       {
           InitializeComponent();
          
           BindingContext = this;
       }

       public ObservableCollection<string> Items
       {
           get
           {
               return _items;
           }
       }


       private void OnAddClicked(object sender, EventArgs e)
       {
           _items.Add($"Item_{_items.Count}");
       }

       private void OnClearClicked(object sender, EventArgs e)
       {
           _items.Clear();
       }

       private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
       {

       }
   }
  1. Run on android to observe crash
  2. If you add some initial items, just uncomment the code, it does not crash

Version with bug

6.0.408 (current)

Last version that worked well

6.0.312

Affected platforms

Android

Affected platform versions

Only tested on Android 12

Did you find any workaround?

No

Relevant log output

Forwarding debugger port 8889
Detecting existing process
> am start -a "android.intent.action.MAIN" -c "android.intent.category.LAUNCHER" -n "com.companyname.mauiapp1/crc64e632a077a20c694c.MainActivity"
> Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.companyname.mauiapp1/crc64e632a077a20c694c.MainActivity }
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/MauiApp1.dll
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Mono.Android.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Runtime.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Java.Interop.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Collections.dll [External]
Resolved pending breakpoint for 'Android.Runtime.JNIEnv.RegisterJniNatives(System.IntPtr, System.Int32, System.IntPtr, System.IntPtr, System.Int32)' to /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNIEnv.cs:124 [0x00000].
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Threading.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Runtime.InteropServices.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Threading.Thread.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Diagnostics.StackTrace.dll [External]
Loaded assembly: data-0xb400007934c3b100 [External]
Loaded assembly: data-0xb400007934c59400 [External]
Loaded assembly: data-0xb400007934c6afc0 [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/netstandard.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Linq.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Collections.Concurrent.dll [External]
Resolved pending breakpoint for 'Xamarin.HotReload.HotReloadAgent.BreakpointSendToIde(System.String)' to D:\a\_work\1\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:419 [0x00000].
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Text.Json.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Text.Encodings.Web.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.ComponentModel.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Microsoft.Maui.Controls.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.ObjectModel.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Microsoft.Maui.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Microsoft.Maui.Graphics.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Microsoft.Maui.Essentials.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Microsoft.Extensions.Logging.Abstractions.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.ComponentModel.TypeConverter.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Private.Uri.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Runtime.Loader.dll [External]
Resolved pending breakpoint for 'Xamarin.HotReload.HotReloadAgent.BreakpointCheckpoint()' to D:\a\_work\1\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:414 [0x00000].
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Memory.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Reflection.Emit.Lightweight.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Reflection.Emit.ILGeneration.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Reflection.Primitives.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Runtime.CompilerServices.Unsafe.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Xamarin.AndroidX.Core.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Microsoft.Extensions.DependencyInjection.Abstractions.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Microsoft.Maui.Controls.Xaml.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Microsoft.Extensions.Configuration.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Microsoft.Extensions.Configuration.Abstractions.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Microsoft.Extensions.Logging.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Xamarin.AndroidX.AppCompat.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Xamarin.Google.Android.Material.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Xamarin.AndroidX.SwipeRefreshLayout.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Xamarin.AndroidX.Fragment.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Xamarin.AndroidX.Activity.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Xamarin.AndroidX.Lifecycle.ViewModel.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Xamarin.AndroidX.Lifecycle.Common.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Xamarin.AndroidX.SavedState.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Xamarin.AndroidX.DrawerLayout.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Xamarin.AndroidX.CustomView.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Xamarin.AndroidX.Navigation.Runtime.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Net.Primitives.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Microsoft.Extensions.DependencyInjection.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Diagnostics.Tracing.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Xml.ReaderWriter.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Private.Xml.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Text.Encoding.Extensions.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Text.RegularExpressions.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Numerics.Vectors.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Xamarin.AndroidX.RecyclerView.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Xamarin.AndroidX.CardView.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Xamarin.AndroidX.Loader.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Microsoft.Maui.Controls.Compatibility.dll [External]
Thread started:  #2
Thread started:  #3
Thread started:  #4
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Runtime.Serialization.Json.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Private.DataContractSerialization.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Runtime.Serialization.Xml.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Runtime.Serialization.Primitives.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Xamarin.AndroidX.CoordinatorLayout.dll [External]
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Xamarin.AndroidX.Lifecycle.LiveData.Core.dll [External]
[nyname.mauiapp] Late-enabling -Xcheck:jni
[USNET] USNET: appName: com.companyname.mauiapp1
[ProcessState] Binder ioctl to enable oneway spam detection failed: Invalid argument
[CompatibilityChangeReporter] Compat change id reported: 171979766; UID 10363; state: ENABLED
[GraphicsEnvironment] ANGLE Developer option for 'com.companyname.mauiapp1' set to: 'default'
[GraphicsEnvironment] App is not on the allowlist for updatable production driver.
[LoadedApk] LoadedApk::makeApplication() appContext.mOpPackageName=com.companyname.mauiapp1 appContext.mBasePackageName=com.companyname.mauiapp1
[NetworkSecurityConfig] No Network Security Config specified, using platform default
[NetworkSecurityConfig] No Network Security Config specified, using platform default
[debug-app-helper] Checking if libmonodroid was unpacked to /data/app/~~dLORmJDY5DAIyCgnAfFrZA==/com.companyname.mauiapp1-FiTgMNfzRLNBzIDyhoBLLw==/lib/arm64/libmonodroid.so
[debug-app-helper] Native libs extracted to /data/app/~~dLORmJDY5DAIyCgnAfFrZA==/com.companyname.mauiapp1-FiTgMNfzRLNBzIDyhoBLLw==/lib/arm64, assuming application/android:extractNativeLibs == true
[debug-app-helper] Setting up for DSO lookup in app data directories
[debug-app-helper] Added filesystem DSO lookup location: /data/app/~~dLORmJDY5DAIyCgnAfFrZA==/com.companyname.mauiapp1-FiTgMNfzRLNBzIDyhoBLLw==/lib/arm64
[debug-app-helper] Using runtime path: /data/app/~~dLORmJDY5DAIyCgnAfFrZA==/com.companyname.mauiapp1-FiTgMNfzRLNBzIDyhoBLLw==/lib/arm64
[debug-app-helper] checking directory: `/data/user/0/com.companyname.mauiapp1/files/.__override__/lib`
[debug-app-helper] directory does not exist: `/data/user/0/com.companyname.mauiapp1/files/.__override__/lib`
[debug-app-helper] Checking whether Mono runtime exists at: /data/user/0/com.companyname.mauiapp1/files/.__override__/libmonosgen-2.0.so
[debug-app-helper] Checking whether Mono runtime exists at: /data/app/~~dLORmJDY5DAIyCgnAfFrZA==/com.companyname.mauiapp1-FiTgMNfzRLNBzIDyhoBLLw==/lib/arm64/libmonosgen-2.0.so
[debug-app-helper] Mono runtime found at: /data/app/~~dLORmJDY5DAIyCgnAfFrZA==/com.companyname.mauiapp1-FiTgMNfzRLNBzIDyhoBLLw==/lib/arm64/libmonosgen-2.0.so
[nyname.mauiapp] Attempt to remove non-JNI local reference, dumping thread
[DOTNET] JNI_OnLoad: JNI_OnLoad in pal_jni.c
[monodroid] Creating public update directory: `/data/user/0/com.companyname.mauiapp1/files/.__override__`
[nyname.mauiapp] Attempt to remove non-JNI local reference, dumping thread
[monodroid-debug] Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=127.0.0.1:8889,server=y,embedding=1
[monodroid-assembly] open_from_bundles: failed to load assembly MauiApp1.dll
[monodroid-gc] GREF GC Threshold: 46080
[monodroid-assembly] open_from_bundles: failed to load assembly Mono.Android.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Java.Interop.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Collections.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Threading.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.InteropServices.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Threading.Thread.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Diagnostics.StackTrace.dll
[nyname.mauiapp] Attempt to remove non-JNI local reference, dumping thread
[monodroid-assembly] open_from_bundles: failed to load assembly netstandard.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Linq.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.VisualStudio.DesignTools.TapContract.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.VisualStudio.DesignTools.TapContract.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.HotReload.Contracts.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.HotReload.Contracts.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Collections.Concurrent.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Text.Json.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Text.Encodings.Web.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.ComponentModel.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.Controls.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.HotReload.Contracts.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.HotReload.Contracts.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.VisualStudio.DesignTools.TapContract.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.VisualStudio.DesignTools.TapContract.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.ObjectModel.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.Graphics.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.Essentials.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Logging.Abstractions.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.ComponentModel.TypeConverter.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Private.Uri.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.Loader.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Memory.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Reflection.Emit.Lightweight.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Reflection.Emit.ILGeneration.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Reflection.Primitives.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.CompilerServices.Unsafe.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Core.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.DependencyInjection.Abstractions.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.Controls.Xaml.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Configuration.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Configuration.Abstractions.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Logging.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.AppCompat.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.Google.Android.Material.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.SwipeRefreshLayout.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Fragment.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Activity.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Lifecycle.ViewModel.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Lifecycle.Common.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.SavedState.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.DrawerLayout.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.CustomView.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Navigation.Runtime.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Net.Primitives.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.DependencyInjection.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Diagnostics.Tracing.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Xml.ReaderWriter.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Private.Xml.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Text.Encoding.Extensions.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Text.RegularExpressions.dll
[monodroid-assembly] open_from_bundles: failed to load assembly de-CH/System.Private.CoreLib.resources.dll
[monodroid-assembly] open_from_bundles: failed to load assembly de-CH/System.Private.CoreLib.resources.dll
[monodroid-assembly] open_from_bundles: failed to load assembly de/System.Private.CoreLib.resources.dll
[monodroid-assembly] open_from_bundles: failed to load assembly de/System.Private.CoreLib.resources.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Numerics.Vectors.dll
[nyname.mauiapp] Explicit concurrent copying GC freed 468(61KB) AllocSpace objects, 0(0B) LOS objects, 50% free, 2019KB/4067KB, paused 20us,9us total 2.838ms
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.RecyclerView.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.CardView.dll
[OpenGLRenderer] RenderThread::requireGlContext()
[AdrenoGLES-0] QUALCOMM build                   : 193b2ee, I593c16c433
[AdrenoGLES-0] Build Date                       : 10/07/21
[AdrenoGLES-0] OpenGL ES Shader Compiler Version: EV031.32.02.10
[AdrenoGLES-0] Local Branch                     : Test-lib-SR05432264
[AdrenoGLES-0] Remote Branch                    : 
[AdrenoGLES-0] Remote Branch                    : 
[AdrenoGLES-0] Reconstruct Branch               : 
[AdrenoGLES-0] Build Config                     : S P 10.0.5 AArch64
[AdrenoGLES-0] Driver Path                      : /vendor/lib64/egl/libGLESv2_adreno.so
[AdrenoGLES-0] PFP: 0x016dd093, ME: 0x00000000
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Loader.dll
[OpenGLRenderer] RenderThread::setGrContext()
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.Controls.Compatibility.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.Serialization.Json.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Private.DataContractSerialization.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.Serialization.Xml.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.Serialization.Primitives.dll
[monodroid-assembly] open_from_bundles: failed to load assembly de-CH/System.Private.DataContractSerialization.resources.dll
[monodroid-assembly] open_from_bundles: failed to load assembly de-CH/System.Private.DataContractSerialization.resources.dll
[monodroid-assembly] open_from_bundles: failed to load assembly de/System.Private.DataContractSerialization.resources.dll
[monodroid-assembly] open_from_bundles: failed to load assembly de/System.Private.DataContractSerialization.resources.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.CoordinatorLayout.dll
[DecorView] [INFO] isPopOver=false, config=true
[DecorView] updateCaptionType >> DecorView@6e2ef62[], isFloating=false, isApplication=true, hasWindowControllerCallback=true, hasWindowDecorCaption=false
[DecorView] setCaptionType = 0, this = DecorView@6e2ef62[]
[DecorView] getCurrentDensityDpi: from real metrics. densityDpi=480 msg=resources_loaded
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Lifecycle.LiveData.Core.dll
[nyname.mauiapp] Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (unsupported, reflection, allowed)
[nyname.mauiapp] Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (unsupported, reflection, allowed)
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.ViewPager2.dll
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Xamarin.AndroidX.ViewPager2.dll [External]
[CompatibilityChangeReporter] Compat change id reported: 171228096; UID 10363; state: ENABLED
[TabLayout] MODE_SCROLLABLE + GRAVITY_FILL is not supported, GRAVITY_START will be used instead
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Lifecycle.Runtime.dll
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Xamarin.AndroidX.Lifecycle.Runtime.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.ViewPager.dll
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/Xamarin.AndroidX.ViewPager.dll [External]
Resolved pending breakpoint at 'MainPage.xaml.cs:44,1' to void MauiApp1.MainPage.OnSelectionChanged (object sender, Microsoft.Maui.Controls.SelectionChangedEventArgs e) [0x00001].
[NativeCustomFrequencyManager] [NativeCFMS] BpCustomFrequencyManager::BpCustomFrequencyManager()
[ViewRootImpl@e99b894[MainActivity]] setView = com.android.internal.policy.DecorView@6e2ef62 TM=true
Thread started: .NET Timers #5
[ViewRootImpl@e99b894[MainActivity]] Relayout returned: old=(0,0,1080,2400) new=(0,0,1080,2400) req=(1080,2400)0 dur=13 res=0x7 s={true -5476376628255993856} ch=true fn=-1
[hw-ProcessState] Binder ioctl to enable oneway spam detection failed: Invalid argument
[OpenGLRenderer] eglCreateWindowSurface
**System.NullReferenceException:** 'Object reference not set to an instance of an object.'

**System.NullReferenceException:** 'Object reference not set to an instance of an object.'

Thread started: <Thread Pool> #6
Thread started: .NET ThreadPool Gate #7
[nyname.mauiapp] Explicit concurrent copying GC freed 4024(992KB) AllocSpace objects, 0(0B) LOS objects, 64% free, 3371KB/9515KB, paused 57us,22us total 9.847ms
Thread started: <Thread Pool> #8
[monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.Intrinsics.dll
Loaded assembly: /data/data/com.companyname.mauiapp1/files/.__override__/System.Runtime.Intrinsics.dll [External]
[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object.
[mono-rt]    at Microsoft.Maui.Controls.Platform.RecyclerViewExtensions.UpdateSelection(RecyclerView recyclerView, SelectableItemsView selectableItemsView) in D:\a\_work\1\s\src\Controls\src\Core\Platform\Android\Extensions\RecyclerViewExtensions.cs:line 25
[mono-rt]    at Microsoft.Maui.Controls.Handlers.Items.SelectableItemsViewHandler`1[[Microsoft.Maui.Controls.ReorderableItemsView, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MapSelectedItem(SelectableItemsViewHandler`1 handler, SelectableItemsView itemsView) in D:\a\_work\1\s\src\Controls\src\Core\Handlers\Items\SelectableItemsViewHandler.Android.cs:line 11
[mono-rt]    at Microsoft.Maui.PropertyMapper`2.<>c__DisplayClass5_0[[Microsoft.Maui.Controls.CollectionView, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Controls.Handlers.Items.CollectionViewHandler, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<Add>b__0(IElementHandler h, IElement v) in D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:line 183
[mono-rt]    at Microsoft.Maui.PropertyMapper.UpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView) in D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:line 47
[mono-rt]    at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView) in D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:line 82
[mono-rt]    at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view) in D:\a\_work\1\s\src\Core\src\Handlers\Element\ElementHandler.cs:line 74
[mono-rt]    at Microsoft.Maui.Handlers.ViewHandler.SetVirtualView(IElement element) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandler.cs:line 125
[mono-rt]    at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.Controls.ReorderableItemsView, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[AndroidX.RecyclerView.Widget.RecyclerView, Xamarin.AndroidX.RecyclerView, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IView view) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 53
[mono-rt]    at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.Controls.ReorderableItemsView, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[AndroidX.RecyclerView.Widget.RecyclerView, Xamarin.AndroidX.RecyclerView, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IElement view) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 56
[mono-rt]    at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler) in D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:line 64
[mono-rt]    at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value) in D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:line 20
[mono-rt]    at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value) in D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\VisualElement\VisualElement.Impl.cs:line 299
[mono-rt]    at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context) in D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:line 96
[mono-rt]    at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context) in D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:line 127
[mono-rt]    at Microsoft.Maui.Handlers.LayoutHandler.SetVirtualView(IView view) in D:\a\_work\1\s\src\Core\src\Handlers\Layout\LayoutHandler.Android.cs:line 43
[mono-rt]    at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.ILayout, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.LayoutViewGroup, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IElement view) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 56
[mono-rt]    at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler) in D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:line 64
[mono-rt]    at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value) in D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:line 20
[mono-rt]    at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value) in D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\VisualElement\VisualElement.Impl.cs:line 299
[mono-rt]    at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context) in D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:line 96
[mono-rt]    at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context) in D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:line 127
[mono-rt]    at Microsoft.Maui.Handlers.ScrollViewHandler.UpdateInsetView(IScrollView scrollView, IScrollViewHandler handler) in D:\a\_work\1\s\src\Core\src\Handlers\ScrollView\ScrollViewHandler.Android.cs:line 175
[mono-rt]    at Microsoft.Maui.Handlers.ScrollViewHandler.MapContent(IScrollViewHandler handler, IScrollView scrollView) in D:\a\_work\1\s\src\Core\src\Handlers\ScrollView\ScrollViewHandler.Android.cs:line 109
[mono-rt]    at Microsoft.Maui.PropertyMapper`2.<>c__DisplayClass5_0[[Microsoft.Maui.IScrollView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Handlers.IScrollViewHandler, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<Add>b__0(IElementHandler h, IElement v) in D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:line 183
[mono-rt]    at Microsoft.Maui.PropertyMapper.UpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView) in D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:line 47
[mono-rt]    at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView) in D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:line 82
[mono-rt]    at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view) in D:\a\_work\1\s\src\Core\src\Handlers\Element\ElementHandler.cs:line 74
[mono-rt]    at Microsoft.Maui.Handlers.ViewHandler.SetVirtualView(IElement element) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandler.cs:line 125
[mono-rt]    at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.IScrollView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.MauiScrollView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IView view) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 53
[mono-rt]    at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.IScrollView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.MauiScrollView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IElement view) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 56
[mono-rt]    at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler) in D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:line 64
[mono-rt]    at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value) in D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:line 20
[mono-rt]    at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value) in D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\VisualElement\VisualElement.Impl.cs:line 299
[mono-rt]    at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context) in D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:line 96
[mono-rt]    at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context) in D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:line 127
[mono-rt]    at Microsoft.Maui.Handlers.ContentViewHandler.UpdateContent(IContentViewHandler handler) in D:\a\_work\1\s\src\Core\src\Handlers\ContentView\ContentViewHandler.Android.cs:line 44
[mono-rt]    at Microsoft.Maui.Handlers.ContentViewHandler.MapContent(IContentViewHandler handler, IContentView page) in D:\a\_work\1\s\src\Core\src\Handlers\ContentView\ContentViewHandler.Android.cs:line 49
[mono-rt]    at Microsoft.Maui.PropertyMapper`2.<>c__DisplayClass5_0[[Microsoft.Maui.IContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Handlers.IContentViewHandler, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<Add>b__0(IElementHandler h, IElement v) in D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:line 183
[mono-rt]    at Microsoft.Maui.PropertyMapper.UpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView) in D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:line 47
[mono-rt]    at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView) in D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:line 82
[mono-rt]    at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view) in D:\a\_work\1\s\src\Core\src\Handlers\Element\ElementHandler.cs:line 74
[mono-rt]    at Microsoft.Maui.Handlers.ViewHandler.SetVirtualView(IElement element) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandler.cs:line 125
[mono-rt]    at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.IContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.ContentViewGroup, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IView view) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 53
[mono-rt]    at Microsoft.Maui.Handlers.ContentViewHandler.SetVirtualView(IView view) in D:\a\_work\1\s\src\Core\src\Handlers\ContentView\ContentViewHandler.Android.cs:line 27
[mono-rt]    at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.IContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.ContentViewGroup, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IElement view) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 56
[mono-rt]    at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler) in D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:line 64
[mono-rt]    at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value) in D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:line 20
[mono-rt]    at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value) in D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\VisualElement\VisualElement.Impl.cs:line 299
[mono-rt]    at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context) in D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:line 96
[mono-rt]    at Microsoft.Maui.Platform.ViewExtensions.ToHandler(IView view, IMauiContext context) in D:\a\_work\1\s\src\Core\src\Platform\ViewExtensions.cs:line 44
[mono-rt]    at Microsoft.Maui.Controls.Platform.Compatibility.ShellFragmentContainer.OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) in D:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\Android\ShellFragmentContainer.cs:line 50
[mono-rt]    at AndroidX.Fragment.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_(IntPtr jnienv, IntPtr native__this, IntPtr native_inflater, IntPtr native_container, IntPtr native_savedInstanceState) in C:\a\_work\1\s\generated\androidx.fragment.fragment\obj\Release
et6.0-android\generated\src\AndroidX.Fragment.App.Fragment.cs:line 1999
[mono-rt]    at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPLLL_L(_JniMarshal_PPLLL_L callback, IntPtr jnienv, IntPtr klazz, IntPtr p0, IntPtr p1, IntPtr p2) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:line 352
@epsmae epsmae added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Jul 29, 2022
@anhvinh180594
Copy link

This is exactly the issue that I had when upgrade to 6.0.4xx.
App crash (both Android & IOS) when bind an empty List to ItemSource (It worked well on v6.0.3xx ), CollectionView have both EmptyView and SelectionMode.

image

@Eilon Eilon added the area-controls-collectionview CollectionView, CarouselView, IndicatorView label Jul 29, 2022
@FM1973
Copy link

FM1973 commented Jul 30, 2022

I can confirm this

@ryl
Copy link
Contributor

ryl commented Aug 2, 2022

I'm also having this problem.

@yurkinh
Copy link
Contributor

yurkinh commented Aug 5, 2022

I have made a repro sample for this
It crashes here:

adapter.MarkPlatformSelection(selectedItem);

@davidverriere
Copy link

I can reproduce the issue too.
Null reference without any information

@ericnev
Copy link

ericnev commented Aug 9, 2022

Ran into this one today, too.

rmarinho pushed a commit that referenced this issue Aug 11, 2022
#9215) Fixes #9060

* Fixed null reference when we have EmptyView and SelectionMode = signle

* Moved null check out of loop

* Moved adapter null check to the begging of the method
@rmarinho
Copy link
Member

Fixed by #9215

@epsmae
Copy link
Author

epsmae commented Aug 11, 2022

@rmarinho may you set the milestone so we know when to expect the fix?

@rmarinho rmarinho added this to the 6.0-sr5 milestone Aug 11, 2022
PureWeen pushed a commit that referenced this issue Aug 11, 2022
#9215) Fixes #9060

* Fixed null reference when we have EmptyView and SelectionMode = signle

* Moved null check out of loop

* Moved adapter null check to the begging of the method
@ghost ghost locked as resolved and limited conversation to collaborators Sep 10, 2022
@samhouts samhouts added the fixed-in-6.0.540 Look for this fix in 6.0.540 SR5! label Feb 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView fixed-in-6.0.540 Look for this fix in 6.0.540 SR5! fixed-in-7.0.0-rc.1.6683 platform/android 🤖 s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants