Skip to content

[BUG] Error referencing InitializeComponent in public App() constructor, but Build succeeded. #1018

Open
@AleksandarDevic

Description

Describe the Issue

When I create a simple MAUI project, in file MauiApp1\Platforms\Windows\App.xaml.cs
for method InitializeComponent I get a compiler error: 'App' does not contain a definition for 'InitializeComponent' and no accessible extension method 'InitializeComponent' accepting a first argument of type 'App' could be found (are you missing a using directive or an assembly reference?)CS1061.

But when I do dotnet build I get info Build Succeeded!

image

Steps To Reproduce

  1. I created a simple MAUI project.

  2. In file MauiApp1\Platforms\Windows\App.xaml.cs, for method InitializeComponent I get compiler error:
    'App' does not contain a definition for 'InitializeComponent' and no accessible extension method 'InitializeComponent' accepting a first argument of type 'App' could be found (are you missing a using directive or an assembly reference?)CS1061.

  3. But when I do dotnet build I get info Build Succeeded!

Expected Behavior

The compiler should recognize the method InitializeComponent from MauiWinUIApplication class.

Environment Information

  • OS: Windows 11
  • VSCode: 1.87.2
  • .NET MAUI v0.9.7, C# v2.22.5, C# Dev Kit v1.4.29
    | VS Bug 2032244

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-mauibugSomething isn't workingtriagedThe issue has been triagedvs-syncAdd this label to synchronize the issue to AzDovs-syncdLinked to AzDO

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions