Bug 35743 - Incorrect namespace auto-applied to XAML code-behind partial
Summary: Incorrect namespace auto-applied to XAML code-behind partial
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.5.2
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Stephane Delcroix
Depends on:
Reported: 2015-11-10 13:15 UTC by Auri Rahimzadeh
Modified: 2015-11-19 05:03 UTC (History)
4 users (show)

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:

Description Auri Rahimzadeh 2015-11-10 13:15:21 UTC
When generating code-behind partials, Xamarin.Forms is incorrectly being prepended as the namespace. For example, if a class AppContentPage is created, inheriting from ContentPage, all code-behind partials will have:

    public partial class ReportIncidentPage : global::Xamarin.Forms.AppContentPage 

when it should be

    public partial class ReportIncidentPage : AppContentPage {
Comment 1 Stephane Delcroix 2015-11-19 05:03:11 UTC
Prefixing the base class in code behind is the correct behavior. If you're interested in the rationale, see https://bugzilla.xamarin.com/show_bug.cgi?id=33256

If you're seeing an incorrect namespace ('global::Xamarin.Forms') being used, it's probably because your Xaml is slightly incorrect.

I assume it looks like:

<AppContentPage xmlns="http://xamarin.com/schemas/2014/forms"

but should be instead:

<local:AppContentPage xmlns="http://xamarin.com/schemas/2014/forms"

Xamarin.Forms used to not complain about the wrong syntax in the past, but now correct xml namescoping is required