Bug 54392 - ViewController sometimes appearing
Summary: ViewController sometimes appearing
Status: RESOLVED NORESPONSE
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: unspecified
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-04-03 03:23 UTC by jcaptanis
Modified: 2017-10-17 02:36 UTC (History)
6 users (show)

Tags: pagerenderer, ios, viewcontroller
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NORESPONSE

Description jcaptanis 2017-04-03 03:23:32 UTC
The code below is simply used to embed the native contact picker on a xamarin forms page (XfContactList). The contact picker will only show 80% of the time.

`
        protected override void OnElementChanged(ElementChangedEventArgs<XfContactList> e)
        {
            base.OnElementChanged(e);

            var contactList = e.NewElement;
            if (contactList == null) return;

            var contactPicker = new ABPeoplePickerNavigationController();
            contactPicker.SelectPerson2 += (sender, args) => PersonSelected(args.Person);
            contactPicker.SelectPerson += (sender, args) => PersonSelected(args.Person);
            contactPicker.Delegate = new DoSelection(PersonSelected);
            contactPicker.PredicateForSelectionOfPerson = NSPredicate.FromFormat("phoneNumbers.@count = 1");
            contactPicker.PredicateForSelectionOfProperty = NSPredicate.FromFormat("key == 'phoneNumbers'");
            SetNativeControl(contactPicker.View);
        }
`
I cant work out what i am doing wrong, and no one can explain why this happens so for me, so i am filing this as a bug.
Comment 1 Manuel de la Peña [MSFT] 2017-04-05 09:59:38 UTC
Hello,

Can you please provide the information of your runtime?

The easiest way to get exact version information is to use the "Xamarin Studio" menu, "About Xamarin Studio" item, "Show Details" button and copy/paste the version informations (you can use the "Copy Information" button).
Comment 2 jcaptanis 2017-04-06 01:36:42 UTC
I can say, when the contact picker doesnt "show" a dialog still appears with a empty title. So its not like nothing happens, it just shows a blank view. This happens both in the emulator and on the device.
-------


Microsoft Visual Studio Ultimate 2013
Version 12.0.40629.00 Update 5
Microsoft .NET Framework
Version 4.6.01590

Installed Version: Ultimate

Architecture and Modeling Tools   06181-004-0451047-02635
Microsoft Architecture and Modeling Tools
    
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

Team Explorer for Visual Studio 2013   06181-004-0451047-02635
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06181-004-0451047-02635
Microsoft Visual Basic 2013

Visual C# 2013   06181-004-0451047-02635
Microsoft Visual C# 2013

Visual C++ 2013   06181-004-0451047-02635
Microsoft Visual C++ 2013

Visual F# 2013   06181-004-0451047-02635
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06181-004-0451047-02635
Microsoft® Visual Studio® 2013 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

Windows Phone SDK 8.0 - ENU   06181-004-0451047-02635
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools   12.5.60612.0
Microsoft Web Developer Tools contains the following components:
Support for creating and opening ASP.NET web projects
Browser Link: A communication channel between Visual Studio and browsers
Editor extensions for HTML, CSS, and JavaScript
Page Inspector: Inspection tool for ASP.NET web projects
Scaffolding: A framework for building and running code generators
Server Explorer extensions for Microsoft Azure Web Apps
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Microsoft Azure

ASP.NET Web Frameworks and Tools 2012.2   4.1.21001.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.30612.0
For additional information, visit http://www.asp.net/

AutoT4   1.0
A zero-configuration extension for Visual Studio 2012 which will automatically run your T4 templates at build time.

Command Bus, Event Stream and Async Manager   Merq
Provides ICommandBus, IEventStream and IAsyncManager MEF services for loosely coupled Visual Studio extension components communication and integration.

Common Azure Tools   1.4
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

JetBrains ReSharper Ultimate 2016.2.2    Build 106.0.20160913.91321
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2017 JetBrains, Inc.

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

Microsoft Azure Tools   2.4
Microsoft Azure Tools for Microsoft Visual Studio 2013 - v2.4.20730.1601

Microsoft Team Foundation Server 2013 Power Tools   12.0
Power Tools that extend the Team Foundation Server integration with Visual Studio.

Microsoft Visual Studio Process Editor   1.0
Process Editor for Microsoft Visual Studio Team Foundation Server

Node.js Tools   1.0.21029.05
Adds support for developing and debugging Node.js apps in Visual Studio

Node.js Tools - Profiling   1.0.21029.05
Profiling support for Node.js projects.

NuGet Package Manager   2.8.60723.765
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

Office Developer Tools for Visual Studio 2013 ENU   12.0.30626
Microsoft Office Developer Tools for Visual Studio 2013 ENU

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

Silverlight Debug Helper   1.0
Attaches to the correct browser processes for Silverlight debugging automatically. For more information about the Silverlight Debug Helper, see the project page at http://sldebughelper.codeplex.com 

SQL Server Data Tools   12.0.41012.0
Microsoft SQL Server Data Tools

StopOnFirstBuildError   1.0
StopOnFirstBuildError

Stops a solution build immediately after a project has failed to build.

http://tech.einaregilsson.com/2011/01/06/stop-build-on-first-error-in-visual-studio-2010/

T4 Toolbox   12.0.0.0
Extends code generation capabilities of Text Templates.

Team Foundation Sidekicks   3.0
Team Foundation Sidekicks utilities

Typewriter   1.8.2
Typewriter generates TypeScript files from c# code files using TypeScript Templates. This allows you to create fully typed TypeScript representations of server side API that automatically updates when you make changes to your c# code.

VSColorOutput   2.4
Color output for build and debug windows - http://mike-ward.net/vscoloroutput

Windows Installer XML Toolset   3.8.1128.0
Windows Installer XML Toolset version 3.8.1128.0
Copyright (c) Outercurve Foundation. All rights reserved.

Windows Phone 8.1 SDK Integration   1.0
This package integrates the tools for the Windows Phone 8.1 SDK into the menus and controls of Visual Studio.

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin   4.2.2.11 (00fa5cc)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   7.0.2.42 (501e63c)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS   10.3.1.8 (7beaef4)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 3 jcaptanis 2017-04-28 07:37:39 UTC
any updates on this??
Comment 4 Jon Douglas [MSFT] 2017-07-24 20:59:41 UTC
(In reply to jcaptanis from comment #3)
> any updates on this??

Can you please upload a minimal sample project that demonstrates this behavior 80% of the time? This way we can further investigate and file this accordingly. It seems there's a mixture of Xamarin.Forms here, so it could be a Xamarin.Forms bug. Either way we will want a reproduction project so we can investigate further.

Thank you for the report!
Comment 5 Vincent Dondain [MSFT] 2017-08-29 18:12:58 UTC
We have not received the requested information. If you are still experiencing this issue please provide all the requested information and re-open the bug report. Thanks!
Comment 6 jcaptanis 2017-08-30 01:55:44 UTC
Vincent,

I have given already the minimal working code. If the Xamarin team doesnt know what to do with the above, you need to check your hiring practice.

I cant give u anything more. This is the exactly code i am running.

When it doesnt work, i get a BLANK contact list - the window appears but nothing else. This is obviously a race condition.

            SetNativeControl(contactPicker.View);
Comment 7 jcaptanis 2017-08-30 01:59:46 UTC
If this is not a bug, you should be able to tell me how i can acheive what i want. Just give me the code and i'll be on my way.

I need to EMBED a contact list on a PAGE. I DONT want it to popup into its own modal. Show me the code that will allow me todo that, because the above ONLY WORKS 80% of the time.

What i can tell u, is that its the "first load" of the control. So if i open the app and open this screen, if it loads, it will loads ALWAYS. If it doesnt, it wont load until the app is cycled. 

Its obvious that the view is being cached before its fully initalised. I need to know how to properly initialise it.

So i dont care if u fix this exact bug, i just need a WORKAROUND to meet my requirement.
Comment 8 jcaptanis 2017-08-30 02:01:23 UTC
THe page is a tab control. U can tab from the phone dialler, to a contact list, to another screen. The contact list is the only control i have a problem with.
Comment 9 jcaptanis 2017-08-30 02:03:17 UTC
My workaround atm is to pop this up into its own dialog. That works everytime, but it ruins the UX. 

I dont see how u guys can implemment all these different workflows of cross code boundaries, embedding code c# code in java controls and vice versa, yet this simple requirement is too much?
Comment 10 Vincent Dondain [MSFT] 2017-08-30 20:44:15 UTC
Hi,

Jon asked for a test case and you didn't reply (in less than a month) so I assumed you found how to solve your issue, sorry it's not the case.

We ask for test cases (just a quick project that shows the issue) because it's the easiest way for us to investigate all your code (your snippet is only partial) and project options.

The fact that getting the contacts modal view works 80% of the time is weird and is potentially due to your code/project (when/how it's called/initialized, build options, device/simulator) which is what justifies a test case.

We are not asking that to make your life harder but only to be able to better help you. You can be sure that with a proper way to reproduce issues the team is 100% ready to provide answers and solutions.

Thanks.
Comment 11 jcaptanis 2017-08-31 01:31:36 UTC
Vincent, i understand the repo problem, i deal with this on a daily basis. If u can review my bugzilla history, everytime thus far i have posted an issue, its been a bug.

So i cant provide u with a repo. Hence the question, can u show me how i should be doing it? Can u give me a minimum repo of hosting a contact list in  XF.Forms tab page, and attaching a listener so i can intercept the contact that has been requested. I posted up on the forums and i didnt get a single reply.

Then i'll try ur fix in my project and we can see if its my project settings.

BUT IMO its a bug. I dont see how i can "accidently" with my "project configuration" cause the contact list page to render without any labels. for any components or any data. Just the blank, uninitalised view. And then each consequent time, calling the same code, get the same issue. But then on another startup of the app, it works. If my code is ok, and im not abusing the API, this can only be a race condition/bug.

Regards,
Jonathan
Comment 12 David Ortinau [MSFT] 2017-09-07 21:48:01 UTC
I have to reiterate the obvious, we need more context and ideally a project that reproduces this hit/miss behavior in order to further troubleshoot the possible bug. The initial code snippet unfortunately doesn't provide enough to go on.

In terms of guidance for how to include native iOS in a Forms project, start with a custom PageRenderer. I "think" that's what you're currently doing.

https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/custom-renderer/contentpage/

https://github.com/xamarin/xamarin-forms-samples/blob/master/CustomRenderers/ContentPage/iOS/CameraPageRenderer.cs

Another option is to use DependencyService to call into iOS code and present the ABPeoplePickerNavigationController (deprecated by Apple, now the Contacts and ContactsUI) similar to this:

https://github.com/xamarin/xamarin-forms-samples/blob/48b31dcab0a909044daa708bc59d71195b20d9e5/DependencyService/DependencyServiceSample/iOS/PicturePickerImplementation.cs

Some additional questions towards understanding the bug that would be helpful:
- What version of Xamarin.Forms?
- Is this in a PageRenderer? What's the context for the code snippet?
- How is this page launched/navigated to?
Comment 13 Paul DiPietro [MSFT] 2017-10-17 02:36:24 UTC
Resolving as no further responses have been made in over 30 days. Please refer to the above comment re: determining specific behavior to investigate.