summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues
diff options
context:
space:
mode:
authorSamantha Houts <samhouts@users.noreply.github.com>2017-07-24 20:38:34 (GMT)
committerStephane Delcroix <stephane@delcroix.org>2017-07-24 20:38:34 (GMT)
commit60db754eb7171d5b691fe7ae85ef25c4dcef464f (patch)
treec8a118e232ae1a21f579a3f5c50719b14c171903 /Xamarin.Forms.Controls.Issues
parentb12f0b3bb71dfa22ac91d0d07463a7da7646e049 (diff)
downloadxamarin-forms-60db754eb7171d5b691fe7ae85ef25c4dcef464f.zip
xamarin-forms-60db754eb7171d5b691fe7ae85ef25c4dcef464f.tar.gz
xamarin-forms-60db754eb7171d5b691fe7ae85ef25c4dcef464f.tar.bz2
[Android] Prevent ObjectDisposed exceptions on Fast Renderers (#1033)
* Add repro for object disposed exception * [Android] Clear Renderer property from Element on dispose
Diffstat (limited to 'Xamarin.Forms.Controls.Issues')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/ScrollViewObjectDisposed.cs65
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems1
2 files changed, 66 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/ScrollViewObjectDisposed.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/ScrollViewObjectDisposed.cs
new file mode 100644
index 0000000..8cd4bcb
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/ScrollViewObjectDisposed.cs
@@ -0,0 +1,65 @@
+´╗┐using System;
+using System.Collections.Generic;
+using System.Linq;
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Internals;
+
+#if UITEST
+using Xamarin.UITest;
+using NUnit.Framework;
+#endif
+
+namespace Xamarin.Forms.Controls.Issues
+{
+ [Preserve(AllMembers = true)]
+ [Issue(IssueTracker.None, 0, "Object Disposed Exception in ScrollViewContainer", PlatformAffected.Android)]
+ public class ScrollViewObjectDisposed : TestContentPage
+ {
+ const string Instructions = "Tap the button. If the app does not crash and the red label displays \"Success\", this test has passed.";
+ const string Success = "Success";
+ const string TestButtonId = "TestButtonId";
+
+ Label _status = new Label() { Text = "Test is running...", BackgroundColor = Color.Red, TextColor = Color.White };
+
+ ScrollView _scroll = new ScrollView();
+
+ protected override void Init()
+ {
+ _scroll.Content = _status;
+
+ InitTest();
+ }
+
+ void InitTest()
+ {
+
+ Button nextButton = new Button { Text = "Next", AutomationId = TestButtonId };
+ nextButton.Clicked += NextButton_Clicked;
+
+ StackLayout stack = new StackLayout
+ {
+ Children = { new Label { Text = Instructions }, _scroll, nextButton }
+ };
+
+ Content = stack;
+ }
+
+ void NextButton_Clicked(object sender, EventArgs e)
+ {
+ _status.Text = "";
+
+ InitTest();
+
+ _status.Text = Success;
+ }
+
+#if UITEST
+ [Test]
+ public void ScrollViewObjectDisposedTest ()
+ {
+ RunningApp.Tap(q => q.Marked(TestButtonId));
+ RunningApp.WaitForElement(q => q.Marked(Success));
+ }
+#endif
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
index 0495474..ae6e9fc 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
@@ -309,6 +309,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla56896.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla40161.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzila57749.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)ScrollViewObjectDisposed.cs" />
<Compile Include="$(MSBuildThisFileDirectory)_Template.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla42620.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue1028.cs" />