No compatible code running on the thread

Russell Hires 0 Reputation points
2024-06-21T14:09:08.9533333+00:00

I know what is causing this, but the solution evades me, because many of the answers are "I upgraded to the next VS version", which is not helpful.

What is causing this: I have a class (record) that overrides the AutomationId property of a UI object, and once I implemented that, I get this error. The other thing to note is that my class that is creating the objects is not XAML based, that is, it doesn't have a ui.xaml/ui.xaml.cs pair. It's just ui.cs which builds the widgets.

Here's a snippet of code that injects the AutomationId:

foreach (DashboardItem item in DashboardItems)
{
	DashboardButton button = new()
	{
		Text = item.Text,
		SubText = item.SubText,
		AutomationId = item.AutomationId
	};
}
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,223 questions
{count} votes