Since adding the Telerik date picker control - we are getting an intermittent error:
System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Android.Widget.PopupWindow'.
Call Stack below:
JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self)
JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters)
PopupWindow.set_ContentView (Android.Views.View value)
RadPopup.ClearAndroidContext ()
RadPopup.UpdatePopupContext ()
RadPopup.OnPlacementTargetRendererChanged ()
PopupBase.PlacementTarget_PropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e)
PopupBase+<>c.<AttachWeakEventListenerForPlacementTargetPropertyChanged>b__99_0 (Telerik.XamarinForms.Primitives.PopupBase listener, System.Object sender, System.ComponentModel.PropertyChangedEventArgs eventArgs)
WeakEventListener`3[TListener,TEventSource,TEventArgs].OnEvent (System.Object sender, TEventArgs eventArgs)
(wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs(object,System.ComponentModel.PropertyChangedEventArgs)
BindableObject.OnPropertyChanged (System.String propertyName)
Element.OnPropertyChanged (System.String propertyName)
BindableObject.ClearValue (Xamarin.Forms.BindableProperty property, System.Boolean fromStyle, System.Boolean checkAccess)
BindableObject.ClearValue (Xamarin.Forms.BindableProperty property)
Platform+<>c__DisplayClass45_0.<Cleanup>g__DoCleanup|0 ()
Platform.Cleanup (System.Collections.Generic.List`1[T] viewsToRemove, System.Collections.Generic.List`1[T] renderersToDispose)
Platform.SetPage (Xamarin.Forms.Page newRoot)
Platform.Dispose ()
FormsAppCompatActivity.OnDestroy ()
Activity.n_OnDestroy (System.IntPtr jnienv, System.IntPtr native__this)
(wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.8(intptr,intptr)
This is within the dispose method of what I assume is the telerik control.
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:telerikInput="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"
x:Class="MobileInterface.Views.QuestionText"
Shell.PresentationMode="ModalNotAnimated">
<ContentPage.Content>
<StackLayout>
<StackLayout Grid.Row="1" Grid.Column="2" Orientation="Horizontal"
VerticalOptions="Start" HorizontalOptions="FillAndExpand"
BackgroundColor="{StaticResource Primary}" Padding="10"
>
<Label Text="{Binding LocationTitle}"
FontSize="Small"
HorizontalTextAlignment="Start" Grid.Column="1"
HorizontalOptions="FillAndExpand"
TextColor="White"/>
<Label Text="{Binding Title}"
FontSize="Small"
HorizontalTextAlignment="End" Grid.Column="2"
HorizontalOptions="FillAndExpand"
TextColor="White"
/>
</StackLayout>
<Label Text="{Binding QuestionText}"
VerticalOptions="Center"
HorizontalOptions="CenterAndExpand"
FontSize="Medium"
Margin="10"/>
<Entry x:Name="dataEntry" Text="{Binding Answer, Mode=TwoWay}"
FontSize="{Binding FontSize}"
VerticalOptions="CenterAndExpand" HorizontalOptions="FillAndExpand"
IsVisible="{Binding IsTextType}}"
Keyboard="{Binding KeyboardType}"
Completed="dataEntry_Completed"
Focused="dataEntry_Focused"
Margin="10"/>
<telerikInput:RadDateTimePicker
x:Name="datePicker"
Date="{Binding DateAnswer}"
DefaultHighlightedDate="{Binding DateDefaultHightlight}"
VerticalOptions="CenterAndExpand" HorizontalOptions="FillAndExpand"
DisplayStringFormat="d"
SpinnerFormat="d"
SelectionChanged="RadDateTimePicker_SelectionChanged"
IsVisible="{Binding IsDateType}">
<telerikInput:RadDateTimePicker.SelectorSettings>
<telerikInput:PickerPopupSelectorSettings>
<telerikInput:PickerPopupSelectorSettings.AcceptButtonStyle>
<Style TargetType="Button">
<Setter Property="TextColor" Value="White"/>
</Style>
</telerikInput:PickerPopupSelectorSettings.AcceptButtonStyle>
<telerikInput:PickerPopupSelectorSettings.CancelButtonStyle>
<Style TargetType="Button">
<Setter Property="TextColor" Value="White"/>
</Style>
</telerikInput:PickerPopupSelectorSettings.CancelButtonStyle>
</telerikInput:PickerPopupSelectorSettings>
</telerikInput:RadDateTimePicker.SelectorSettings>
</telerikInput:RadDateTimePicker>
<Button Margin="0,10,0,0" Text="{Binding ButtonText}"
Clicked="Button_Clicked"
BackgroundColor="{StaticResource Primary}"
TextColor="White" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
I'm not sure if the IsVisible is what's jamming me up - it's a generic page that either is text based but if the type is a date - I swap out which one is visible.
Any input or thoughts are appreciated on this type of error. It appears that it's been a common one in the Xamarin history.
Xamarin Forms: 5.0.0.2125
Telerik.UI.for.Xamarin.Input 2021.3.915.1
(same for the DataControls)
Could you please send us a sample repro project with this issue, so we can test on our side the exact setup you have. The dev team is researching the case and we want to be sure we have the complete picture of the behavior.
I look forward to your reply