Bug 54477 - MasterDetailPage's missing title error wasn't captured by XamlC
Summary: MasterDetailPage's missing title error wasn't captured by XamlC
Status: RESOLVED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Debugger ()
Version: 4.3.0 (C9)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Joaquin Jares
URL:
Depends on:
Blocks:
 
Reported: 2017-04-05 07:42 UTC by Frankie Foo
Modified: 2017-05-22 19:13 UTC (History)
7 users (show)

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


Attachments
Project to replicate the issue (243.65 KB, application/x-zip-compressed)
2017-04-05 07:42 UTC, Frankie Foo
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:
RESOLVED FIXED

Description Frankie Foo 2017-04-05 07:42:16 UTC
Created attachment 21197 [details]
Project to replicate the issue

---------------------------
Problematic code
---------------------------

.xaml

<MasterDetailPage
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="BugCatcher.MDXamlPage">
    <MasterDetailPage.Master>
        <ContentPage BackgroundColor="Red"/>
    </MasterDetailPage.Master>
    <MasterDetailPage.Detail>
        <ContentPage BackgroundColor="Blue"/>
    </MasterDetailPage.Detail>
</MasterDetailPage>

.xaml.cs

[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class MDXamlPage : MasterDetailPage
{
    public MDXamlPage()
    {
        InitializeComponent();
    }
}

---------------------------
Expected behavior
---------------------------

* XamlC will throw error that the title attribute in MasterDetailPage is missing.

---------------------------
Observed behavior
---------------------------

* XamlC doesn't captured the error, and build is successful.
* The app can be launched, but will freeze and crash when loading the MasterDetailsPage, with no error displayed/captured.
* The same error will be captured at compile-time, if use code-only to build the same UI. 

---------------------------
Tested platforms
---------------------------

* Android - Bad
* iOS - Not tested
* UWP - Not tested

---------------------------
Version
---------------------------

Visual Studio                   : VS 2017 Enterprise 15.0.0+26228.9
Xamarin                         : 4.3.0.784 (73f58d6)
Xamarin.Android SDK             : 7.1.0.41 (9578cdc)
Xamarin.iOS and Xamarin.Mac SDK : 10.4.0.123 (35d1ccd)
Xamarin Forms                   : 2.3.3.193
Comment 1 Frankie Foo 2017-04-06 08:43:06 UTC
Also bad in XF 2.3.4.224
Comment 3 Stephane Delcroix 2017-04-11 08:31:59 UTC
The MasterDetailPage.Title requirement is a runtime requirement, not a compile-time one. There is no way to make that kind of check at compilation time, either using plain c# code, or with XamlC. Or even with static code analysis. Demanding this is unrealistic.

What annoys you the most, at this time, is the fact that android crashes due to this exception, but that the exception isn't displayed or logged by the debugger. For this part of the problem, I'm reassigning this error to a different team.
Comment 4 Stephane Delcroix 2017-04-11 08:33:06 UTC
android swallowing exception is similar to https://bugzilla.xamarin.com/show_bug.cgi?id=54188#c3
Comment 5 Joaquin Jares 2017-05-22 19:13:23 UTC
Same as 54188, this seems not to be a repro anymore. Please check Enable Just My Code and send debug output if you can repro. Closing as fixed instead of no repro to give QA a chance at reproing.