Open PureWeen opened 5 years ago
The problem is that the TextView instance is collected by the GC (which means TextView's Dispose method is called, which nulls out the Delegate field, which makes everything visibly break).
I have not yet figured out why the TextView instance is collected.
We've had to account for these kinds of things a few places
Most recently https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs#L20
Which we instantiate inside LoadView
If we didn't store the view locally then it was getting disposed of.
Especially when using the designer.
Steps to Reproduce
Here's the fix we are applying to Xamarin.Forms https://github.com/xamarin/Xamarin.Forms/pull/8011/files#diff-71148fd2814c3d17185db42cc58913ffR173
Here's the issue people are having https://github.com/xamarin/Xamarin.Forms/issues/5500
Expected Behavior
I shouldn't have to save the TextView.Delegate to a local variable
Actual Behavior
I have to save it to a local variable otherwise it gets set to null on the TextView
Environment
Build Logs
BuildLog.txt
Example Project (If Possible)
VanishingDelegate.zip