Describe the bug
When i use MergeResourceInclude i get System.ArgumentException: Unable to resolve namespace for type ... when trying to start the app.
To Reproduce
Steps to reproduce the behavior:
Have a Styles with AttachedProperties used like this:
xmlns:dialogHostAvalonia="clr-namespace:DialogHostAvalonia"CornerRadius="{Binding Path=(dialogHostAvalonia:DialogHostStyle.CornerRadius), RelativeSource=...}"
namespace DialogHostAvalonia;
public class DialogHostStyle {
public static readonly AttachedProperty<CornerRadius> CornerRadiusProperty =
AvaloniaProperty.RegisterAttached<DialogHostStyle, DialogHost, CornerRadius>("CornerRadius");
public static CornerRadius GetCornerRadius(DialogHost element)
{
return element.GetValue(CornerRadiusProperty);
}
public static void SetCornerRadius(DialogHost element, CornerRadius value)
{
element.SetValue(CornerRadiusProperty, value);
}
}
Everything works fine.
Migrate styles to ControlTheme. Add resource dictionary with ControlTheme like this:
Start app, use control with this ControlTheme, get exception.
If we add xmlns:dialogHostAvalonia="clr-namespace:DialogHostAvalonia" to namespaces definition in styles (step 2) everything starts working fine.
How to fix
Exception shouldn't be raised. Namespaces should be copied automatically by the MergeResourceInclude.
Desktop (please complete the following information):
OS: Any
Version: 11.0.0-preview5
Additional context
Exception info
```
System.ArgumentException: Unable to resolve namespace for type dialogHostAvalonia:DialogHostStyle
at Avalonia.Markup.Xaml.XamlIl.Runtime.XamlIlRuntimeHelpers.XamlTypeResolver.Resolve(String qualifiedTypeName) in /_/src/Markup/Avalonia.Markup.Xaml/XamlIl/Runtime/XamlIlRuntimeHelpers.cs:line 153
at Avalonia.Markup.Xaml.Extensions.ResolveType(IServiceProvider ctx, String namespacePrefix, String type) in /_/src/Markup/Avalonia.Markup.Xaml/Extensions.cs:line 37
at Avalonia.Markup.Parsers.ExpressionParser.ParseAttachedProperty(AttachedPropertyNameNode node) in /_/src/Markup/Avalonia.Markup/Markup/Parsers/ExpressionParser.cs:line 132
at Avalonia.Markup.Parsers.ExpressionParser.Parse(CharacterReader& r) in /_/src/Markup/Avalonia.Markup/Markup/Parsers/ExpressionParser.cs:line 56
at Avalonia.Markup.Parsers.ExpressionObserverBuilder.Parse(String expression, Boolean enableValidation, Func`3 typeResolver, INameScope nameScope) in /_/src/Markup/Avalonia.Markup/Markup/Parsers/ExpressionObserverBuilder.cs:line 22
at Avalonia.Data.Binding.CreateExpressionObserver(AvaloniaObject target, AvaloniaProperty targetProperty, Object anchor, Boolean enableDataValidation) in /_/src/Markup/Avalonia.Markup/Data/Binding.cs:line 69
at Avalonia.Data.BindingBase.Initiate(AvaloniaObject target, AvaloniaProperty targetProperty, Object anchor, Boolean enableDataValidation) in /_/src/Markup/Avalonia.Markup/Data/BindingBase.cs:line 93
at Avalonia.AvaloniaObjectExtensions.Bind(AvaloniaObject target, AvaloniaProperty property, IBinding binding, Object anchor) in /_/src/Avalonia.Base/AvaloniaObjectExtensions.cs:line 204
at DialogHostAvalonia.DialogHostStyles.XamlClosure_6.XamlClosure_9.Build(IServiceProvider ) in C:\Users\SKProCH\RiderProjects\DialogHost.Avalonia\DialogHost.Avalonia\DialogHostStyles.axaml:line 61
at Avalonia.Markup.Xaml.XamlIl.Runtime.XamlIlRuntimeHelpers.<>c__DisplayClass1_0`1.b__0(IServiceProvider sp) in /_/src/Markup/Avalonia.Markup.Xaml/XamlIl/Runtime/XamlIlRuntimeHelpers.cs:line 37
at Avalonia.Markup.Xaml.Templates.TemplateContent.Load(Object templateContent) in /_/src/Markup/Avalonia.Markup.Xaml/Templates/TemplateContent.cs:line 13
at Avalonia.Markup.Xaml.Templates.ControlTemplate.Build(TemplatedControl control) in /_/src/Markup/Avalonia.Markup.Xaml/Templates/ControlTemplate.cs:line 16
at Avalonia.Controls.Primitives.TemplatedControl.ApplyTemplate() in /_/src/Avalonia.Controls/Primitives/TemplatedControl.cs:line 289
at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize) in /_/src/Avalonia.Base/Layout/Layoutable.cs:line 526
at Avalonia.Layout.Layoutable.Measure(Size availableSize) in /_/src/Avalonia.Base/Layout/Layoutable.cs:line 361
at Avalonia.Controls.Primitives.OverlayLayer.MeasureOverride(Size availableSize) in /_/src/Avalonia.Controls/Primitives/OverlayLayer.cs:line 28
at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize) in /_/src/Avalonia.Base/Layout/Layoutable.cs:line 529
at Avalonia.Layout.Layoutable.Measure(Size availableSize) in /_/src/Avalonia.Base/Layout/Layoutable.cs:line 361
at Avalonia.Layout.LayoutManager.Measure(Layoutable control) in /_/src/Avalonia.Base/Layout/LayoutManager.cs:line 294
at Avalonia.Layout.LayoutManager.ExecuteMeasurePass() in /_/src/Avalonia.Base/Layout/LayoutManager.cs:line 254
at Avalonia.Layout.LayoutManager.InnerLayoutPass() in /_/src/Avalonia.Base/Layout/LayoutManager.cs:line 236
at Avalonia.Layout.LayoutManager.ExecuteLayoutPass() in /_/src/Avalonia.Base/Layout/LayoutManager.cs:line 148
at Avalonia.Layout.LayoutManager.ExecuteQueuedLayoutPass() in /_/src/Avalonia.Base/Layout/LayoutManager.cs:line 108
at Avalonia.Threading.JobRunner.Job.Avalonia.Threading.JobRunner.IJob.Run() in /_/src/Avalonia.Base/Threading/JobRunner.cs:line 193
at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority) in /_/src/Avalonia.Base/Threading/JobRunner.cs:line 38
at Avalonia.Win32.Win32Platform.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam) in /_/src/Windows/Avalonia.Win32/Win32Platform.cs:line 257
at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg)
at Avalonia.Win32.Win32Platform.RunLoop(CancellationToken cancellationToken) in /_/src/Windows/Avalonia.Win32/Win32Platform.cs:line 204
at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) in /_/src/Avalonia.Base/Threading/Dispatcher.cs:line 61
at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 120
at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder builder, String[] args, ShutdownMode shutdownMode) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 212
at DialogHostDemo.Program.Main(String[] args) in C:\Users\SKProCH\RiderProjects\DialogHost.Avalonia\DialogHost.Demo\Program.cs:line 13
```
Describe the bug When i use
MergeResourceInclude
i getSystem.ArgumentException: Unable to resolve namespace for type ...
when trying to start the app.To Reproduce Steps to reproduce the behavior:
xmlns:dialogHostAvalonia="clr-namespace:DialogHostAvalonia"
CornerRadius="{Binding Path=(dialogHostAvalonia:DialogHostStyle.CornerRadius), RelativeSource=...}"
Everything works fine.
xmlns:dialogHostAvalonia="clr-namespace:DialogHostAvalonia"
to namespaces definition in styles (step 2) everything starts working fine.How to fix Exception shouldn't be raised. Namespaces should be copied automatically by the
MergeResourceInclude
.Desktop (please complete the following information):
Additional context
Exception info
``` System.ArgumentException: Unable to resolve namespace for type dialogHostAvalonia:DialogHostStyle at Avalonia.Markup.Xaml.XamlIl.Runtime.XamlIlRuntimeHelpers.XamlTypeResolver.Resolve(String qualifiedTypeName) in /_/src/Markup/Avalonia.Markup.Xaml/XamlIl/Runtime/XamlIlRuntimeHelpers.cs:line 153 at Avalonia.Markup.Xaml.Extensions.ResolveType(IServiceProvider ctx, String namespacePrefix, String type) in /_/src/Markup/Avalonia.Markup.Xaml/Extensions.cs:line 37 at Avalonia.Markup.Parsers.ExpressionParser.ParseAttachedProperty(AttachedPropertyNameNode node) in /_/src/Markup/Avalonia.Markup/Markup/Parsers/ExpressionParser.cs:line 132 at Avalonia.Markup.Parsers.ExpressionParser.Parse(CharacterReader& r) in /_/src/Markup/Avalonia.Markup/Markup/Parsers/ExpressionParser.cs:line 56 at Avalonia.Markup.Parsers.ExpressionObserverBuilder.Parse(String expression, Boolean enableValidation, Func`3 typeResolver, INameScope nameScope) in /_/src/Markup/Avalonia.Markup/Markup/Parsers/ExpressionObserverBuilder.cs:line 22 at Avalonia.Data.Binding.CreateExpressionObserver(AvaloniaObject target, AvaloniaProperty targetProperty, Object anchor, Boolean enableDataValidation) in /_/src/Markup/Avalonia.Markup/Data/Binding.cs:line 69 at Avalonia.Data.BindingBase.Initiate(AvaloniaObject target, AvaloniaProperty targetProperty, Object anchor, Boolean enableDataValidation) in /_/src/Markup/Avalonia.Markup/Data/BindingBase.cs:line 93 at Avalonia.AvaloniaObjectExtensions.Bind(AvaloniaObject target, AvaloniaProperty property, IBinding binding, Object anchor) in /_/src/Avalonia.Base/AvaloniaObjectExtensions.cs:line 204 at DialogHostAvalonia.DialogHostStyles.XamlClosure_6.XamlClosure_9.Build(IServiceProvider ) in C:\Users\SKProCH\RiderProjects\DialogHost.Avalonia\DialogHost.Avalonia\DialogHostStyles.axaml:line 61 at Avalonia.Markup.Xaml.XamlIl.Runtime.XamlIlRuntimeHelpers.<>c__DisplayClass1_0`1.