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

XmlnsDefinition not working in HeadlessPlattform #15645

Open
IXimonI opened this issue May 7, 2024 · 0 comments
Open

XmlnsDefinition not working in HeadlessPlattform #15645

IXimonI opened this issue May 7, 2024 · 0 comments

Comments

@IXimonI
Copy link

IXimonI commented May 7, 2024

Describe the bug

I'm getting this issue when running UnitTests using Avalonia.Headless(.Xunit).

XamlX.XamlParseException: 'Unable to resolve type Xyz from namespace Abc

The issue is not appearing in normal app setups and can be solved using the workaround described in #7200
( GC.KeepAlive(typeof(TypeInReferencedAssembly)) in App.OnFrameworkInitializationCompleted() )

I guess this is also a similar issue to the solved #7200 thus only appearing in this specific setup.

To Reproduce

  1. Prepare an AssemblyInfo with XmlnsDefinition Attribute for the library you want to test e.g.

using Avalonia.Metadata;
[assembly: XmlnsDefinition("https://my.controls.url", "Abc.Namespace")]

  1. Try test it in an Avalonia.Headless testing project for example parsing a Xaml:

image

Expected behavior

All types beeing resolved. Can be currently reached by modifing the TestApp type like this (line 20):

image

Thank you for your help

Avalonia version

11.0.10

OS

Windows

Additional context

No response

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