WPF (.NET 8) XAML cannot resolve namespaces, converters, ViewModels despite classes being public

23 hours ago 2
ARTICLE AD BOX

I'm losing my mind over this project and honestly have no idea what else to try.

I'm working on a WPF app targeting .NET 8 and I'm getting a massive number of XAML errors like:

XDG0008: The name "XYZ" does not exist in the namespace

XDG0001: The resource "XYZ" could not be resolved

MC3037: Missing XmlNamespace, Assembly or ClrNamespace

XDG0006: Cannot find type in clr-namespace

plus random type incompatibility errors:

[Error (active) MC3037 Missing XmlNamespace, Assembly or ClrNamespace in Mapping instruction. Line 442 Position 61. AMV.App C:\Users\barto\source\AMV_project\AMV\AMV.App\Views\MainWindow.xaml 442

Error XDG-0001 The resource "RoleMargin" could not be resolved. AMV.App C:\Users\barto\source\AMV_project\AMV\AMV.App\Views\MainWindow.xaml 337

Error XDG-0001 The resource "InvBoolVis" could not be resolved. AMV.App C:\Users\barto\source\AMV_project\AMV\AMV.App\Views\MainWindow.xaml 439

Error XDG-0001 The resource "InvBoolVis" could not be resolved. AMV.App C:\Users\barto\source\AMV_project\AMV\AMV.App\Views\MainWindow.xaml 519

Error XDG-0001 The resource "CountVis" could not be resolved. AMV.App C:\Users\barto\source\AMV_project\AMV\AMV.App\Views\MainWindow.xaml 259

Error XDG-0001 The resource "CountVis" could not be resolved. AMV.App C:\Users\barto\source\AMV_project\AMV\AMV.App\Views\MainWindow.xaml 333

Error XDG-0001 The resource "BoolVis" has an incompatible type. AMV.App C:\Users\barto\source\AMV_project\AMV\AMV.App\Views\MainWindow.xaml 47

Error XDG-0001 The resource "BoolVis" has an incompatible type. AMV.App C:\Users\barto\source\AMV_project\AMV\AMV.App\Views\MainWindow.xaml 204

Examples

The name "ZeroToVisibilityConverter" does not exist in the namespace "clr-namespace:AMV.Converters"
The name "MainViewModel" does not exist in the namespace "clr-namespace:AMV.ViewModels"
The name "Conversation" does not exist in the namespace "clr-namespace:AMV.Models"
The resource "BoolVis" has an incompatible type The resource "RoleMargin" could not be resolved

Also:

CS1631 Cannot yield a value in the body of a catch clause

Important details

ALL classes (converters, view models, models, etc.) are declared as public

Namespaces in code match the folder structure

I tried both:

xmlns:conv="clr-namespace:AMV.Converters"

and

xmlns:conv="clr-namespace:AMV.Converters;assembly=AMV"

Project builds partially, but XAML designer and runtime both complain

Resources are defined (or at least should be) in ResourceDictionaries

I also use merged dictionaries (MessageTemplates.xaml etc.)

What I already tried:

Cleaning solution (dotnet clean) Rebuilding everything Deleting bin and obj Restarting Visual Studio Checking namespace typos 10+ times Making sure classes are public Moving classes between projects Adding/removing assembly= in XAML namespaces Verifying Build Action (Page, Resource, etc.) Checking if files are included in .csproj Recreating some converters from scratch Swearing at it (did not help)

Suspicion

At this point I suspect one of these:

.NET 8 + WPF weirdness Broken project references Assembly name mismatch (AMV vs AMV.App?) XAML not seeing compiled code-behind ResourceDictionary not loading correctly Something fundamentally broken in project structure

Full project can be found here: https://github.com/skye7x/AMV-Ai

Question

What could cause XAML to not see ANY types from my own namespaces, even though:

classes exist are public namespaces are correct project builds (partially)

Is there something obvious I'm missing, or is this some deeper WPF/.NET issue?

At this point I genuinely don't know what to do with this project anymore.

Read Entire Article