2

We are developing Shared Code based Xamarin Forms app to be deployed across Android and iOS platforms. We are facing this strange issue number of times. There is compile time error on InitializeComponent which didn't let code to compile. We have gone through almost all the stackoverflow questions and xamarin discussions on this topic. None to them helped.

Following is code-

DocumentSearchPage.xaml.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;

namespace FinderApp.Views
{
    public partial class DocumentSearchPage : ContentPage
    {
        public DocumentSearchPage ()
        {


            InitializeComponent ();- This line show compilation issue- InitializeComponent doesn't exist in current context

        }
    }
}

DocumentSearchPage.xaml

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="FinderApp.Views.DocumentSearchPage">

  <ContentPage.Content>

  </ContentPage.Content>

</ContentPage>

Till now we have tried-

  1. Changing property custom tool to different values
  2. Checking if Namespace names are matching in xaml and cs file
  3. Updated xaml forms to v2.3.0.38 pre2. Obiviously we have tried with stable version first.
  4. Clean Rebuild solution

Enviroment

iMac OS X 10.11.2 Xamarin Studio 5.10.3 Xamarin Forms 2.3.038 pre2

We are facing issue on windows8, visual studio 2015 also.\ We have this issue with PCL approach too.

Expert help needed!

Kaustubh Kadam
  • 162
  • 2
  • 11
  • This bug should be resolved, as far as i know. The old bugfix was: Change something in your XAML and change it back. – Sven-Michael Stübe May 02 '16 at 15:57
  • I also have huge problems with Xamarin Studio in Mac, force quite, open, clean, rebuild. – Bruno Caceiro May 04 '16 at 15:51
  • Many answered this question here: [initializecomponent-doesnt-exist-when-creating-a-new-page](https://stackoverflow.com/questions/28818525/xamarin-forms-initializecomponent-doesnt-exist-when-creating-a-new-page) –  Mar 08 '18 at 06:54

1 Answers1

0

If you are using VS 2015, seems naive but this is the state even as of today, no reasons to explain, but as of Aug 2016 and latest xamarin this is the status

  1. Close and repoen solution
  2. Clean Solution
  3. Rebuild Solution
Sundara Prabu
  • 1,683
  • 18
  • 19