Skip to content

Using both [RunsOnUIThread] and [DynamicData] won't run data source on UI Thread #176

@carldebilly

Description

@carldebilly

The dynamic data provider should run on the same context (UI Thead here) than the test itself.

[TestClass]
public class SomeTests
{
	[TestMethod]
	[RunsOnUIThread]
	[DynamicData(nameof(GetTestsData), DynamicDataSourceType.Method)]
	public Do_The_Tests(FrameworkElement element)
	{
		// Do something with the `element`
	}

	public IEnumerable<object[]> GetTestsData()
	{
		var stackPanel = new StackPanel();
		stackPanel.Children.Add(new Border()); // WILL CRASH HERE
		yield return [ stackPanel ];
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions