Skip to content

DependsOn can execute a deferred-enumeration placeholder directly #7409

Closed

Description

@thomhurst

Summary

A test depending on a deferred-enumeration test can cause the deferred placeholder to execute directly. The run reports an extra failure saying the placeholder must be expanded before execution, even though its concrete case was already expanded.

Reproduction

Add a [Test] with [ClassDataSource<Resource>(DeferEnumeration = true)], and a second test with [DependsOn(typeof(DeferredTests), nameof(DeferredTests.Test), ProceedOnFailure = true)]. Select both classes with a namespace filter. In the observed case Resource has an injectable property whose data source throws during registration. The run reports both the expected registration failure and an extra Deferred enumeration placeholder ... was scheduled directly failure from DeferredEnumerationExecutableTest.CreateInstanceAsync.

Observed while adding ArgumentInjectionFailureTests in PR #7391; replacing DependsOn with ordered NotInParallel attributes avoids the extra placeholder execution. The regression's original dependency targeted Fails_During_Argument_Injection on ArgumentInjectionFailureTests.

Expected and actual

Dependency resolution should wait for expanded concrete tests. It should never enqueue the placeholder for direct execution.

Environment

PR #7391 head 85020f6 plus its deferred argument regression, SDK 10.0.403, net10.0, macOS arm64, source-generated discovery. Please make dependency scheduling expand or resolve deferred targets before execution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium: edge case, mode divergence, flaky test, or workaround existsbugSomething isn't workingin-progressWork is in progress

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions