microsoft / microsoft/aspire

[Failing test]: Aspire.Hosting.Yarp.Tests.YarpConfigGeneratorTests.GenerateEnvVariablesConfiguration

Open
#12,064 3 comments 1 reaction 1 assignee Assigned to @Copilot View on GitHub
failing-test needs-area-label testing ☑️ triage:bot-seen
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 12h
Merged PRs (30d)
201

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Build information

Build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1175888&view=results
Build error leg or test failing: Aspire.Hosting.Yarp.Tests
Pull Request: N/A
Representative failing test: Aspire.Hosting.Yarp.Tests.YarpConfigGeneratorTests.GenerateEnvVariablesConfiguration
Console log: https://helixr1107v0xdeko0k025g8.blob.core.windows.net/dotnet-aspire-refs-pull-11790-merge-ccb4f8ad87624c6297/Aspire.Hosting.Yarp.Tests/1/console.4fa2accf.log?helixlogtype=result&skoid=8eda00af-b5ec-4be9-b69b-0919a2338892&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2025-10-15T22%3A53%3A03Z&ske=2025-10-15T23%3A53%3A03Z&sks=b&skv=2024-11-04&sv=2024-11-04&se=2025-10-15T23:53:03Z&sr=b&sp=rl&sig=7KEkYCHDMzmdz1I1NT0nL4%2BwWNlATllYpw4IXHwXutk%3D

### Fill in the error message template

## Error Message

Fill the error message using [step by step known issues guidance](https://github.com/dotnet/arcade/blob/main/Documentation/Projects/Build%20Analysis/KnownIssueJsonStepByStep.md).

```json
{
"ErrorMessage": "System.TypeInitializationException : The type initializer for '' threw an exception. ---- System.Exception : The API 'Aspire.Hosting.Azure.Tests.TestModuleInitializer.Setup' must be called prior to any Verify has run.",
"ErrorPattern": "The API 'Aspire\\.Hosting\\.Azure\\.Tests\\.TestModuleInitializer\\.Setup' must be called prior to any Verify has run\\.",
"BuildRetry": false,
"ExcludeConsoleLog": false
}
```

### Other info

Most (or all) tests in the Aspire.Hosting.Yarp.Tests suite fail with the same initialization error. This occurs before snapshot verification (Verify) can establish paths, because the `TestModuleInitializer.Setup()` was not called as required.

Potential causes:
- The shared TestModuleInitializer.cs source file is missing from the Yarp test project, or not included in compilation.
- The `[ModuleInitializer]` attribute or method is missing or excluded via conditional compilation.
- Multiple test assemblies may need a shared initializer reference.

Suggested actions:
1. Confirm inclusion of TestModuleInitializer.cs in Aspire.Hosting.Yarp.Tests.
2. Ensure `[ModuleInitializer]` is present and public static.
3. Check for conditional compilation that may exclude the initializer.
4. Consider moving the setup to a small shared test helper assembly if needed.
5. Retrying without code fixes will not resolve this (BuildRetry: false).

### Known issue validation
**Build: :mag_right:** https://dev.azure.com/dnceng-public/public/_build/results?buildId=1175888
**Error message validated:** `[The API 'Aspire\.Hosting\.Azure\.Tests\.TestModuleInitializer\.Setup' must be called prior to any Verify has run\.`]
**Result validation:** :white_check_mark: Known issue matched with the provided build.
**Validation performed at:** 10/15/2025 11:11:28 PM UTC

📊 **[View CI Failure Report](https://github.com/microsoft/aspire/issues/12064#issuecomment-4174838941)**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.