Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated partial App class in XamlTypeInfo.g.cs has fixed "public" access modifier #10099

Open
aries-zhang opened this issue Oct 24, 2024 · 0 comments
Labels
area-Application bug Something isn't working

Comments

@aries-zhang
Copy link

aries-zhang commented Oct 24, 2024

Describe the bug

When a WinUI 3 app has the CA1515: Consider making public types internal code rule enabled, the App class can not be made internal due to its partial class generated in XamlTypeInfo.g.cs is made public.

Steps to reproduce the bug

  1. Create a blank WinUI 3 app with VisualStudio's WinUI 3 app template.
  2. Go to App.xaml.cs, change the App class's access modifier from public to internal.
  3. Build the project.
  4. Build fails with the following error:
Error (active)	CS0262	Partial declarations of 'App' have conflicting accessibility modifiers

Expected behavior

App should be able to successfully build when change App to internal.

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.6.1: 1.6.240923002

Windows version

Windows 11 (24H2): Build 26100

Additional context

Upon search there are 3 generated partial classes for App. While the following two do not have access modifier:
partial class App : global::Microsoft.UI.Xaml.Application

.\obj\x64\Debug\net8.0-windows10.0.22621.0\win-x64\Views\App.g.cs
.\obj\x64\Debug\net8.0-windows10.0.22621.0\win-x64\Views\App.g.i.cs

the generated partial class in
.\obj\x64\Debug\net8.0-windows10.0.22621.0\win-x64\XamlTypeInfo.g.cs
has public partial class App : global::Microsoft.UI.Xaml.Markup.IXamlMetadataProvider.

@aries-zhang aries-zhang added the bug Something isn't working label Oct 24, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Oct 24, 2024
@karkarl karkarl added area-Application and removed needs-triage Issue needs to be triaged by the area owners labels Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Application bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants