DynamicDataSourceResolver Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Infrastructure. Registry that the MSTest source generator uses to publish compile-time accessors for DynamicDataAttribute data sources and display-name methods, so that at runtime MSTest reads dynamic data without reflecting over the declaring type.
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
[System.Runtime.CompilerServices.Nullable(0)]
public static class DynamicDataSourceResolver
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class DynamicDataSourceResolver
[<System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)>]
[<System.Runtime.CompilerServices.Nullable(0)>]
type DynamicDataSourceResolver = class
[<System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)>]
type DynamicDataSourceResolver = class
Public Class DynamicDataSourceResolver
- Inheritance
-
DynamicDataSourceResolver
- Attributes
Remarks
This type is not intended to be used directly from application code. It is public only because the MSTest source generator emits a [ModuleInitializer] in the test assembly that calls it across the assembly boundary, and module initializers cannot use internal APIs from another assembly. The signature and behaviour are implementation details that may evolve with the generator; do not hand-roll calls to RegisterDataProvider(Type, String, DynamicDataSourceType, Func<Object[],Object>) / RegisterDisplayNameProvider(Type, String, Func<MethodInfo,Object[],String>).
When a source is not registered here (reflection mode, or a source the generator could not resolve), DynamicDataAttribute falls back to reflecting over the declaring type. That fallback is annotated with DynamicallyAccessedMembersAttribute, so it preserves the required members and remains trim / Native AOT safe on its own. The source-generated registrations are an optimization that lets [DynamicData] read its data without reflecting at all.
Methods
| Name | Description |
|---|---|
| RegisterDataProvider(Type, String, DynamicDataSourceType, Func<Object[],Object>) |
Infrastructure. Registers a compile-time accessor that returns the raw data object for the
DynamicDataAttribute source named |
| RegisterDisplayNameProvider(Type, String, Func<MethodInfo,Object[],String>) |
Infrastructure. Registers a compile-time accessor for the custom display-name method named
|