src/EditorFeatures/TestUtilities/Threading/WpfTestRunner.cs
/// <summary>
/// Asserts that the test is running on a <see cref="WpfFactAttribute"/> or <see cref="WpfTheoryAttribute"/>
/// test method, and records the reason for requiring the use of an STA thread.
/// </summary>
Asserts that the test is running on a  or
test method, and records the reason for requiring the use of an STA thread.
Asserts that the test is running on a or test method and records the reason for requiring the use of an STA thread .
internal static void RequireWpfFact(string reason)
        {
            if (!(TestExportJoinableTaskContext.GetEffectiveSynchronizationContext() is DispatcherSynchronizationContext))
            {
                throw new InvalidOperationException($"This test requires {nameof(WpfFactAttribute)} because '{reason}' but is missing {nameof(WpfFactAttribute)}. Either the attribute should be changed, or the reason it needs an STA thread audited.");
            }
            s_wpfFactRequirementReason = reason;
        }
internal static void RequireWpfFact ( string reason ) { if ( ! ( TestExportJoinableTaskContext . GetEffectiveSynchronizationContext ( ) is DispatcherSynchronizationContext ) ) { throw new InvalidOperationException ( $" This test requires  { nameof ( WpfFactAttribute ) }  because ' { reason } ' but is missing  { nameof ( WpfFactAttribute ) } . Either the attribute should be changed, or the reason it needs an STA thread audited. " ) ; } s_wpfFactRequirementReason = reason ; }
Asserts that the test is running on a  or
test method, and records the reason for requiring the use of an STA thread.
Asserts that the test is running on a or test method and records the reason for requiring the use of an STA thread .
reason
string