Skip to content

Fix test GoldenFile.GetSnapshotPath under ContinuousIntegrationBuild#61

Merged
albertospelta merged 1 commit into
mainfrom
alberto/patch-ci
Jul 14, 2026
Merged

Fix test GoldenFile.GetSnapshotPath under ContinuousIntegrationBuild#61
albertospelta merged 1 commit into
mainfrom
alberto/patch-ci

Conversation

@albertospelta

Copy link
Copy Markdown
Member

Azure Pipelines' build step applies /p:ContinuousIntegrationBuild=true to every project (src/**/*.csproj), which makes Roslyn remap the [CallerFilePath] literal compiled into GoldenFile to a deterministic placeholder like "/_/src/Dax.Template.Tests/...". That path never exists on disk, so walking up from it to find the test project's .csproj always bottomed out at null and threw. Fall back to AppContext.BaseDirectory (the real runtime output directory, unaffected by compile-time path mapping) when the caller-path walk doesn't resolve.

Azure Pipelines' build step applies /p:ContinuousIntegrationBuild=true to every project (src/**/*.csproj), which makes Roslyn remap the [CallerFilePath] literal compiled into GoldenFile to a deterministic placeholder like "/_/src/Dax.Template.Tests/...". That path never exists on disk, so walking up from it to find the test project's .csproj always bottomed out at null and threw. Fall back to AppContext.BaseDirectory (the real runtime output directory, unaffected by compile-time path mapping) when the caller-path walk doesn't resolve.
@albertospelta
albertospelta merged commit 6fa85d8 into main Jul 14, 2026
2 checks passed
@albertospelta
albertospelta deleted the alberto/patch-ci branch July 14, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant