[tests] Use approved feed for analyzer references - #12520
Merged
Conversation
Roslyn analyzer tests resolve reference assemblies at test runtime. Their NuGet client ignored the repository NuGet.config and contacted public NuGet infrastructure, violating CFS network isolation. Copy the repository configuration beside the test assembly and configure all verifier test types to use it when acquiring reference packages. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3172357b-9b50-454a-9e75-9f481ffb3934
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Microsoft.Android.Sdk.Analysis Roslyn analyzer test infrastructure so runtime acquisition of Microsoft.NETCore.App.Ref uses the repository-approved Azure Artifacts feeds, avoiding unapproved/public NuGet network access during test execution.
Changes:
- Copy the repo
NuGet.configinto the analyzer test output directory so it’s available at test runtime. - Centralize a
DefaultReferenceAssembliesconfiguration that points the Roslyn test framework at the copiedNuGet.config. - Apply the centralized
ReferenceAssembliesconfiguration to analyzer, code-fix, and refactoring verifier test harnesses.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Microsoft.Android.Sdk.Analysis/Tests/Verifiers/CSharpVerifierHelper.cs | Adds a shared DefaultReferenceAssemblies configured to use a NuGet.config located in the test base directory. |
| src/Microsoft.Android.Sdk.Analysis/Tests/Verifiers/CSharpCodeRefactoringVerifier`1+Test.cs | Sets ReferenceAssemblies to the shared default in the refactoring test harness. |
| src/Microsoft.Android.Sdk.Analysis/Tests/Verifiers/CSharpCodeFixVerifier`2+Test.cs | Sets ReferenceAssemblies to the shared default in the code-fix test harness. |
| src/Microsoft.Android.Sdk.Analysis/Tests/Verifiers/CSharpAnalyzerVerifier`1+Test.cs | Sets ReferenceAssemblies to the shared default in the analyzer test harness. |
| src/Microsoft.Android.Sdk.Analysis/Tests/Microsoft.Android.Sdk.Analysis.Tests.csproj | Copies the repository NuGet.config into the test output so the verifier configuration can use it at runtime. |
Avoid retaining an older NuGet.config in the centralized test output when source timestamps move backwards after switching branches. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3172357b-9b50-454a-9e75-9f481ffb3934
Compare NuGet.config content instead of copying it on every build. This refreshes stale output even when its timestamp is newer while avoiding a no-op write during incremental builds. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3172357b-9b50-454a-9e75-9f481ffb3934
Keep the analyzer test configuration copy consistent with existing project conventions. Clean CI builds do not need unconditional or content-based copy behavior to enforce the approved package sources. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3172357b-9b50-454a-9e75-9f481ffb3934
simonrozsival
approved these changes
Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Roslyn analyzer tests acquire
Microsoft.NETCore.App.Refat test runtime. The testing library ignored the repositoryNuGet.configand contacted public NuGet infrastructure, producing CFS network-isolation violations onmain.Copy the repository NuGet configuration beside the test assembly and configure the analyzer, code-fix, and refactoring verifier types to use it. Runtime reference package acquisition now uses the approved Azure Artifacts feeds already defined by the repository.
The reported
ci.dot.netandshavamanifest*.azureedge.netdestinations are aliases associated with the same Azure Front Door event as thetesthost.exeNuGet request.asmconfigfiles-prod.azure-api.netis intentionally unchanged because it originates from the pipeline-injected GenevaConfigDownloader.exeand requires infrastructure remediation outside this repository.Validation:
dotnet test src\Microsoft.Android.Sdk.Analysis\Tests\Microsoft.Android.Sdk.Analysis.Tests.csproj -c Release -p:RestoreConfigFile=NuGet.config(16 passed, 1 skipped). A fresh temporary package cache confirmedMicrosoft.NETCore.App.Ref.3.1.0.nupkgwas acquired through the copied approved-feed configuration.