Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Regression] DynamicDataAttribute.GetData no longer works in 3.7 when using TestFramework without TestAdapter #4619

Open
Youssef1313 opened this issue Jan 11, 2025 · 2 comments · May be fixed by #4620

Comments

@Youssef1313
Copy link
Member

Youssef1313 commented Jan 11, 2025

This regression is likely caused by #3801

In this PR, pay attention to the change in DynamicDataAttribute.cs.

Before the changes, DynamicDataAttribute.GetData would always work and use reflection.

After the change, DynamicDataAttribute will use DynamicDataProvider.Instance.GetData, but DynamicDataProvider.Instance is set by the adapter. So, when the adapter isn't used, this fails because DynamicDataProvider.Instance is null:

get => s_dynamicDataOperations
?? throw new InvalidOperationException($"Dynamic data provider is not set, it should be set by MSTest adapter. " +
$"If you are seeing this error, you are using Test Framework without Test Adapter, and your adapter should set {nameof(DynamicDataProvider)}.{nameof(Instance)}. In MSTestAdapter, this happens when PlatformServiceProvider.Instance is called.");

Worse, the exception says:

If you are seeing this error, you are using Test Framework without Test Adapter, and your adapter should set DynamicDataProvider.Instance

However, DynamicDataProvider is even internal.

AB#2342253

@Youssef1313
Copy link
Member Author

Actually, SourceGeneratedDynamicDataOperations seems to be doing nothing. It's inheriting DynamicDataOperations without any additional functionality.

@Youssef1313 Youssef1313 self-assigned this Jan 11, 2025
@Youssef1313
Copy link
Member Author

@Evangelink Adding to 3.7.1 for now. We will discuss on Monday depending on how much time is needed to fix and will evaluate if we make it part of 3.7.1, or if we will not delay 3.7.1 further and make this part of 3.7.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment