question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AvaloniaUI - XAML - Unable to resolve type from namespace

See original GitHub issue

Hi:

I believe I might have asked this previously, but I can’t seem to find the post or reply, so I’ll repost.

I’ve been working with the DevExpress MVVM assembly (.Net Core). I created a version of the assembly that uses AvaloniaUI in place of WPF.

I’m including this assembly i my client project and am having difficulty with name space resolution in a XAML definition. I’ using the above mentioned MVVM assembly (using AvaloniaUI) in place of the default version.

Consider the following XAML definition:

<Window  x:Class="Sample.Views.MainWindowView"
        xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
        xmlns:views="clr-namespace:Sample.Views"
        xmlns:productionViewModels="clr-namespace:Sample.ViewModels.Production"
        xmlns:designViewModels="clr-namespace:Sample.ViewModels.Designer"
        WindowStartupLocation="CenterScreen"
        mc:Ignorable="d"
        Title="Sample" Height="720" Width="1280"
        DataContext="{dxmvvm:ViewModelSource Type=productionViewModels:MainWindowViewModel}"
        d:DataContext="{dxmvvm:ViewModelSource Type=designViewModels:MainWindowViewModel}">

I get the following error:

Error XAMLIL Unable to resolve type ViewModelSource from namespace http://schemas.devexpress.com/winfx/2008/xaml/mvvm (line 13 position 9) Line 13, position 9.

I recall reading somewhere that I should try using the referenced assembly rather than the URL in the namespace definition. I’m unsure on how to do this.

Can someone help shed some light on this and what steps for resolution would be?

Thanks JohnB

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
helmesjocommented, May 29, 2020

Any update on this? I’m seeing the same problem, which (occasionally) causes the preview to fail to load.

In my case I just changed the namespaces used across the project, and everything builds and runs just fine.

Edit: In my case it’s solved by changing xmlns:vm="clr-namespace:some.namespace.ViewModels;assembly=my_assembly" to xmlns:vm="clr-namespace:some.namespace.ViewModels

assembly=my_assembly was there from the template generated project. Will it cause problems removing it?

0reactions
JanRomerocommented, Aug 7, 2020

@camelCaseCo @helmesjo Replacing the underscore with a space did it for me. No need to remove the assembly entirely. Probably best to just not put spaces in the project name in the first place…

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Unable to resolve type" when referencing a xaml file ...
But I'm getting an error saying "Unable to resolve type MusicStoreView from namespace using:Buguette.Views". (MusicStoreView is the name of the ...
Read more >
Unable to resolve type LargeLabelControl from namespace
I've created a Avalonia Templated Control and it gave me this error: System.Xaml.XamlException: 'Unable to resolve type LargeLabelControl from ...
Read more >
IDE Support
If your XAML file is showing a lot of errors, try right-clicking the file then selecting "Open With..." → "Avalonia XAML Editor". Design-Time...
Read more >
Scichart with Avalonia MVVM framework | WPF Chart Forums
Hi I'm trying to use [AvaloniaUI][1] with . ... “XAMLIL: Unable to resolve type SciChartSurface from namespace http://schemas.abtsoftware.co.uk/scichart ...
Read more >
CompiledBindings to the template parent don't resolve ...
CompiledBindings to the template parent don't resolve DataType properly in Avalonia XAML ; Subsystem, XAML ; Assignee, Denis Mukhametianov.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found