[tests] Fix duplicate MockBuildEngine constructor - #12741
Merged
Merged
Conversation
PR #12724 added a primary constructor after #12736 introduced the same explicit warning-collecting constructor, causing CS0111 on main. Remove only the primary-constructor parameter list. Keep the explicit constructor and warning collection used by the JNI rewrite tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The change is minimal, directly addresses the reported CS0111 duplicate-constructor error, and preserves existing test helper behavior.
Review tier: Lite
Findings: None
What changed in this PR
Fixes a compilation regression in the Microsoft.Android.Sdk.TrimmableTypeMap.IntegrationTests test project by removing the unintended primary-constructor parameter list from MockBuildEngine, avoiding the duplicate-constructor CS0111 error while preserving the existing explicit constructor behavior.
Changes:
- Remove the primary-constructor parameter list from
MockBuildEngineso only the explicit constructor remains. - Keep the warning collection behavior and optional warnings list parameter unchanged.
| File | Description |
|---|---|
| tests/Microsoft.Android.Sdk.TrimmableTypeMap.IntegrationTests/MockBuildEngine.cs | Removes the primary constructor signature to eliminate the duplicate-constructor compile error in integration tests. |
jonathanpeppers
approved these changes
Sep 9, 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.
Remove the primary-constructor parameter list from the integration tests'
MockBuildEngine, fixing CS0111 onmain.#12724 (
ecef743e91614754e6e1ab0ed7ed1834ecdedf5c) added that signature after #12736 had introduced an explicit constructor with the same optional warning-list parameter. The merged combination left both constructors in place. This one-line repair keeps the explicit constructor and warning collection unchanged, including the existing no-XA4326 assertions; it does not change the production generator.The failure appears in the Linux and macOS builds of Azure DevOps build 1588988:
Based directly on current
main(d907cd735615d5d17616cbba9e1a4aeef99ab61d), independently of #12722. Rechecked live main and open PRs before editing and immediately before opening this PR; no equivalent fix was found.Validation
MockBuildEngine.csusing an isolated .NET SDK11.0.100-rc.1.26431.118, its net11.0 reference assemblies, and its realMicrosoft.Build.Framework.dll. The same command reproduced CS0111 before the fix and succeeded without diagnostics after it.null, and supplied-list cases. Logging with default/null was harmless; successive warnings appended to the supplied list with object identity preserved.Direct compiler command
SDKpoints to the private SDK copy andOUTto the session artifact directory; run from the repository root:Integration-test limit: Attempted
dotnet test tests/Microsoft.Android.Sdk.TrimmableTypeMap.IntegrationTests/Microsoft.Android.Sdk.TrimmableTypeMap.IntegrationTests.csproj --no-restore -p:BuildProjectReferences=false --filter 'FullyQualifiedName~JniAssemblyRewriterTests|FullyQualifiedName~GeneratedTypeMapRewriterTests' -v minimal, but no tests executed in the unprepared worktree. A subsequentdotnet buildof the same project with--no-restore -p:BuildProjectReferences=false -v minimalconfirmed NETSDK1004 (missingproject.assets.json). The local Android build outputs are also absent. No full bootstrap or device tests were run, and older installed generator binaries were not substituted for current-main integration validation.