Skip to content

[tests] Use approved feed for analyzer references - #12520

Merged
jonathanpeppers merged 4 commits into
mainfrom
jonathanpeppers-fix-main-cfs-access
Aug 25, 2026
Merged

[tests] Use approved feed for analyzer references#12520
jonathanpeppers merged 4 commits into
mainfrom
jonathanpeppers-fix-main-cfs-access

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Pull Request

Roslyn analyzer tests acquire Microsoft.NETCore.App.Ref at test runtime. The testing library ignored the repository NuGet.config and contacted public NuGet infrastructure, producing CFS network-isolation violations on main.

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.net and shavamanifest*.azureedge.net destinations are aliases associated with the same Azure Front Door event as the testhost.exe NuGet request. asmconfigfiles-prod.azure-api.net is intentionally unchanged because it originates from the pipeline-injected Geneva ConfigDownloader.exe and requires infrastructure remediation outside this repository.

  • Useful description of why the change is necessary.
  • Links to issues fixed
  • Unit tests

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 confirmed Microsoft.NETCore.App.Ref.3.1.0.nupkg was acquired through the copied approved-feed configuration.

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
Copilot AI lite review requested due to automatic review settings August 25, 2026 19:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.config into the analyzer test output directory so it’s available at test runtime.
  • Centralize a DefaultReferenceAssemblies configuration that points the Roslyn test framework at the copied NuGet.config.
  • Apply the centralized ReferenceAssemblies configuration 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.

jonathanpeppers and others added 3 commits August 25, 2026 15:05
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
@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Aug 25, 2026
@jonathanpeppers
jonathanpeppers merged commit 7c7d207 into main Aug 25, 2026
42 of 44 checks passed
@jonathanpeppers
jonathanpeppers deleted the jonathanpeppers-fix-main-cfs-access branch August 25, 2026 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants