Bug 13724 - Creating Second Instance of Generic UIViewController throws error
Summary: Creating Second Instance of Generic UIViewController throws error
Status: RESOLVED DUPLICATE of bug 13518
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 6.4.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-08-02 16:07 UTC by alex.rodriguez
Modified: 2013-08-02 21:25 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test Project demonstrating the issue (6.46 KB, application/zip)
2013-08-02 16:07 UTC, alex.rodriguez
Details


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 DUPLICATE of bug 13518

Description alex.rodriguez 2013-08-02 16:07:46 UTC
Created attachment 4528 [details]
Test Project demonstrating the issue

In Xamarin.iOS 6.4, I am no longer able to use generic subclasses of UIViewController more than once.  When I try to create another instance of the generic ViewController of a different type, I get the following error:

Unable to cast object of type 'GenericsTest.SalesDocumentView' (Objective-C type: 'GenericsTest.SalesDocumentView') to type 'GenericsTest.CustomView`1[GenericsTest.Customer]'.
Additional information:
	Selector: loadView
	Method: GenericsTest.CustomView`1<GenericsTest.Customer>:LoadView ()

I've attached an example project which demonstrates my issue.  I push and instance of CustomerViewController onto the navigation stack, then tap a button on that view to push an instance of SalesDocumentViewController.  The error is thrown when the SalesDocumentViewController is created.

Both CustomerViewController and SalesDocumentViewController inherit from CustomView<T> (which inherits from UIViewController), themselves being CustomView<Customer> and CustomView<SalesDocument>.

This error only occurs on devices.  I've tried turning off "Enable Generic Value Type Sharing", if that matters.

Is this intended?  This sort of structure worked in prior versions.

Thank you.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2013-08-02 21:25:18 UTC

*** This bug has been marked as a duplicate of bug 13518 ***