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

Xaml Compiler does not work with internal constructors #18371

Open
CodeDevAM opened this issue Mar 5, 2025 · 4 comments
Open

Xaml Compiler does not work with internal constructors #18371

CodeDevAM opened this issue Mar 5, 2025 · 4 comments

Comments

@CodeDevAM
Copy link

Describe the bug

The Xaml Compiler requires a public parameterless constructor in the code behind file of a view. It does not accept an internal parameterless constructor. However it would be beneficial if it would.

To Reproduce

Make the constructor in a code behind file internal instead of public.

Expected behavior

Xaml compiler should also work with internal constructors when all relevant classes are within the same assembly.

Avalonia version

11.2.5

OS

No response

Additional context

No response

@maxkatz6
Copy link
Member

maxkatz6 commented Mar 5, 2025

Please add repro. Internal constructors should work already.

@CodeDevAM
Copy link
Author

InternalConstructors.zip

I get the following message:
Unable to find public constructor for type InternalConstructors:InternalConstructors.Views.UserControl1() Zeile 12, Position 3.

@maxkatz6
Copy link
Member

maxkatz6 commented Mar 6, 2025

Thank you.

Making ctor public, while keeping class internal works. If that's an acceptable workaround for you.

@maxkatz6
Copy link
Member

maxkatz6 commented Mar 6, 2025

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

No branches or pull requests

2 participants