Bug 52985 - [XF/XVS] Forms Content Page Xaml template calling non-existent class
Summary: [XF/XVS] Forms Content Page Xaml template calling non-existent class
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Templates ()
Version: 4.3.0 (C9)
Hardware: PC Windows
: --- normal
Target Milestone: 15.2
Assignee: Pierce Boggan [MSFT]
URL:
: 53104 ()
Depends on:
Blocks:
 
Reported: 2017-03-02 19:00 UTC by Al Clark [MSFT]
Modified: 2017-05-05 14:49 UTC (History)
11 users (show)

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


Attachments
Attached Logs (4.69 KB, application/x-zip-compressed)
2017-04-14 12:39 UTC, Swati Gangrade
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 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:
VERIFIED FIXED

Description Al Clark [MSFT] 2017-03-02 19:00:48 UTC
=== Overview ===

Error in new template for Forms Content Page Xaml file.  Codebehind is creating an instance of class ContentPageViewModel that doesn't exist.

=== Steps to replicate ===

1. Create a new Forms project.
2. Right-click project and add Forms Content Page Xaml file.

=== Expected result ===

Sample should create instance of class named after the file created.

        public fcp()
        {
            InitializeComponent();
            BindingContext = new [NameOfContentPage]ViewModel();
        }

=== Actual result ===

Sample creates instance of ContentPageViewModel resulting in red squigglies and the error:
"The type of namespace name 'ContentPageViewModel' could not be found (are you missing a using directive or an assembly reference?)"

        public fcp()
        {
            InitializeComponent();
            BindingContext = new ContentPageViewModel();
        }
Comment 1 Al Clark [MSFT] 2017-03-03 15:48:30 UTC
Incorrect template
Comment 2 Al Clark [MSFT] 2017-03-03 15:53:53 UTC
Ignore last message - too many Bugzilla tabs open :(
Comment 3 Pierce Boggan [MSFT] 2017-03-07 16:29:51 UTC
*** Bug 53104 has been marked as a duplicate of this bug. ***
Comment 4 Sam Oen 2017-03-08 01:27:41 UTC
Good luck with the quick fix, cool click counter template. Just watching the Xamarin Show 17: ReactiveUI, James looks A LITTLE TIRED hahaha
Comment 7 Swati Gangrade 2017-04-14 12:39:00 UTC
Created attachment 21549 [details]
Attached Logs

Bug is retested and verified in the below test environment:

• Microsoft Visual Studio Enterprise 2017 d15rel Version 15.1 (26403.0) d15rel d15rel
• Microsoft .NET Framework Version 4.6.01586
• Xamarin   4.5.0.339 (265d40a)
• Xamarin.Android SDK   7.3.0.5 (40f69c3)
• Xamarin.iOS and Xamarin.Mac SDK   10.10.0.4 (9245c1c)

Actual Result- There is no red squiggles in added Content Page.cs file.Hence marking bug as verified. Please refer the attached gist and screencast link for bug verification reference

Gist Link-https://gist.github.com/gangrade-swati/7252c922578b029e8a6ed65192976742

Screen Cast Link-https://www.screencast.com/t/Q0ksJ52IvgV0
Comment 8 quakeulf 2017-05-05 10:43:20 UTC
Still not fixed. I get it after doing this:

1. In Portable project Add new item...
2. Choose "Forms Content Page Xaml"
3. Click "Add"
4. Open .cs-file and "BindingContext = new ContentPageViewModel();" is still there.
Comment 9 Pierce Boggan [MSFT] 2017-05-05 14:49:14 UTC
Hi, 

This will be fixed in the next stable release of Visual Studio. Thanks so much for the report. :)

Pierce Boggan