-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Description
-
In .NET MAUI Preview 7, a custom control used in XAML fails to resolve at compile time (XC0000) when VisualStateManager with Setters is defined inside the control usage.
-
The same code compiles and runs in Preview 6, so this appears to be a regression in Preview 7’s XAML compiler/type resolution.
Expected behavior
The XAML compiler resolves customControl:MyBorder and compiles successfully.
VisualState setters apply at runtime.
Actual behavior
Build fails with XC0000 complaining it cannot resolve the custom control type.
Error output
XC0000: Cannot resolve type "http://schemas.microsoft.com/dotnet/2021/maui:MyBorder".
File: MainPage.xaml, line 17 (the custom control usage).

Steps to Reproduce
- Create a new .NET MAUI app.
- Add a custom control class, e.g., MyBorder in namespace CustomBorder (assembly: TextSample), deriving from Border.
- Use the control in a XAML page with a clr-namespace mapping: xmlns:customControl="clr-namespace:CustomBorder;assembly=TextSample"
- Add VisualStateManager.VisualStateGroups with VisualState.Setters targeting a property such as Stroke inside the custom control element.
- Build the project (any target).
Link to public reproduction project repository
No response
Version with bug
10.0.0-preview.7
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
10.0.0-preview.6
Affected platforms
Windows
Affected platform versions
All Platform (Windows, Android, MacOS and iOS)
Did you find any workaround?
Use fully qualified property syntax in the setter:
<Setter Property="controls:MyBorder.Stroke" Value="Red" />
This workaround works in some cases but is inconsistent across platforms and scenarios.