question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inheriting from WinUI 2 Control in C++/WinRT results in compile issues

See original GitHub issue

Describe the bug

When inheriting from a MUXC control in MIDL, the compilation fails with errors like this:

Severity	Code	Description	File	Project	Line	Suppression State
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'put_VerticalCacheLength' ( RuntimeClass 'Microsoft.UI.Xaml.Controls.ItemsRepeater' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'put_VerticalCacheLength' ( Procedure 'put_VerticalCacheLength' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'put_Layout' ( RuntimeClass 'Microsoft.UI.Xaml.Controls.ItemsRepeater' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'put_Layout' ( Procedure 'put_Layout' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'put_ItemTemplate' ( RuntimeClass 'Microsoft.UI.Xaml.Controls.ItemsRepeater' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'put_ItemTemplate' ( Procedure 'put_ItemTemplate' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'put_ItemsSource' ( RuntimeClass 'Microsoft.UI.Xaml.Controls.ItemsRepeater' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'put_ItemsSource' ( Procedure 'put_ItemsSource' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'put_HorizontalCacheLength' ( RuntimeClass 'Microsoft.UI.Xaml.Controls.ItemsRepeater' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'put_HorizontalCacheLength' ( Procedure 'put_HorizontalCacheLength' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'put_Animator' ( RuntimeClass 'Microsoft.UI.Xaml.Controls.ItemsRepeater' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'put_Animator' ( Procedure 'put_Animator' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'get_VerticalCacheLength' ( RuntimeClass 'Microsoft.UI.Xaml.Controls.ItemsRepeater' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'get_VerticalCacheLength' ( Procedure 'get_VerticalCacheLength' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'get_Layout' ( RuntimeClass 'Microsoft.UI.Xaml.Controls.ItemsRepeater' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'get_Layout' ( Procedure 'get_Layout' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'get_ItemTemplate' ( RuntimeClass 'Microsoft.UI.Xaml.Controls.ItemsRepeater' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'get_ItemTemplate' ( Procedure 'get_ItemTemplate' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'get_ItemsSource' ( RuntimeClass 'Microsoft.UI.Xaml.Controls.ItemsRepeater' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'get_ItemsSource' ( Procedure 'get_ItemsSource' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'get_HorizontalCacheLength' ( RuntimeClass 'Microsoft.UI.Xaml.Controls.ItemsRepeater' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'get_HorizontalCacheLength' ( Procedure 'get_HorizontalCacheLength' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'get_Animator' ( RuntimeClass 'Microsoft.UI.Xaml.Controls.ItemsRepeater' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL5015	[msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ Procedure 'get_Animator' ( Procedure 'get_Animator' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL2072	[msg]inapplicable attribute [context]: Windows.Foundation.Metadata.ExperimentalAttribute [ RuntimeClass 'Microsoft.UI.Xaml.Controls.ItemsRepeater' ( RuntimeClass 'RepeaterCompileCrash.BlankUserControl' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	
Error	MIDL2072	[msg]inapplicable attribute [context]: Windows.Foundation.Metadata.ExperimentalAttribute [ RuntimeClass 'Microsoft.UI.Xaml.Controls.ItemsRepeater' ( RuntimeClass 'RepeaterCompileCrash.BlankUserControl' ) ]	D:\Projects\RepeaterCompileCrash\BlankUserControl.idl	RepeaterCompileCrash	5	

RepeaterCompileCrash.zip

Steps to reproduce the bug

Steps to reproduce the behavior:

  1. Create new C++/WinRT project
  2. Add WinUI package and update pch.h
  3. Create new control, inherit from a MUXC control in IDL
  4. Compile project

Expected behavior

Project should compile just fine.

Screenshots

Version Info

NuGet package version:

Microsoft.UI.Xaml.2.5.0-prerelease.200923002

Windows 10 version Saw the problem?
Insider Build (20241) Yes
May 2020 Update (19041)
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop
Xbox
Surface Hub
IoT

Additional context

Issue found by @sylveon

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:25 (21 by maintainers)

github_iconTop GitHub Comments

3reactions
DHowettcommented, Nov 13, 2020

Terminal just hit this attempting to add a MUX type as a member to an idl.

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

namespace Microsoft.Terminal.Settings.Editor
{
    [default_interface] runtimeclass MainPage : Windows.UI.Xaml.Controls.Page//, Windows.UI.Xaml.Data.INotifyPropertyChanged
    {
        MainPage(Microsoft.Terminal.Settings.Model.CascadiaSettings settings);
        event Windows.Foundation.TypedEventHandler<Object, Microsoft.Terminal.Settings.Model.SettingsTarget> OpenJson;

        IInspectable CurrentPageName;
        Microsoft.UI.Xaml.Controls.NavigationView SettingsNav(); ////// <<<< line 13
    }
}
1>D:\Terminal\src\cascadia\TerminalSettingsEditor\MainPage.idl(13): error MIDL5015: [msg]the custom attribute argument contains a boolean value that is not valid [context]: enable [ RuntimeClass 'Microsoft.UI.Xaml.Controls.NavigationView' ( Parameter 'result' ) ]

(/cc @carlos-zamora)

1reaction
asklarcommented, Jun 22, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Data binding in depth - UWP applications
The binding <TextBlock Text="{x:Bind SampleDataGroupAsObject.Title}"/> will result in a compile error because the Title property is not found on ...
Read more >
Inheriting descendant of WinUI-UserControl does not ...
Inheriting descendant of WinUI-UserControl does not inherit all styles · Inheriting as above results in certain styles missing; · Copying the ...
Read more >
Differences between Uno.UI and UWP/WinUI
As for WinUI, all visual elements in Uno.UI inherit from FrameworkElement , which inherits from UIElement . (At least, those that are publicly...
Read more >
Delphi WinUI 3 Demo
The demo comes with updated versions of the WinRT Delphi RTL import units, to support the 1.0 release of WinUI 3. The current...
Read more >
If you're not having fun, you're doing it wrong. | Page 2
In this article we take a look at multi-windowing in a WinUI 3 Desktop application. The ability for an app to control multiple...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found