Skip to content

[docs] Align MSBuild and Java.Interop agent instructions - #13790

Merged
simonrozsival merged 1 commit into
mainfrom
pureween-ccr-evaluation
Nov 26, 2026
Merged

simonrozsival merged 1 commit into
mainfrom
pureween-ccr-evaluation

Conversation

@PureWeen

Copy link
Copy Markdown
Member

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: 2e6affde3970cb83f991fd3f38044ac2b2fc2165

Dimension Assessment Rationale
Change confidence 9.5/10 ↑ Verified all 166 <UsingTask/> registrations across 62 src/ .targets files (including all 38 'Full'/'Core' conditioned pairs on $(_MicrosoftAndroidBuildTasksAssembly) and NativeAotBootstrapTargetsTests.cs), MSBuild's TargetEntry.ExecuteEntry evaluation order, Directory.Build.props, and all Java.Interop .csproj output/TFM properties.
↑ Reviewed the final diff with an independent rubber-duck pass.
↓ Downstream automated review behavior on future PRs is only observable once new PRs run against the updated instructions.

Context: #10893
Context: #12678
Context: #13500
Context: #13756

Follow-up audit of repository agent instructions and code-review rules surfaced three places where documented guidance contradicts MSBuild evaluation semantics or current repository conventions:

  • <UsingTask/> hosting across shipped assemblies: .github/copilot-instructions.md, .github/instructions/msbuild.instructions.md, and .github/skills/code-review/references/msbuild-rules.md carried a blanket ban from Add TaskFactory="TaskHostFactory" Runtime="NET" to xa-prep-tasks and BootstrapTasks UsingTask elements #10893 against putting TaskFactory="TaskHostFactory" or Runtime="NET" on any shipped <UsingTask/>. Since [xabt] Move trimmable typemap tasks to net11 #12678 introduced $(_MicrosoftAndroidBuildTasksAssembly) (Microsoft.Android.Build.Tasks.dll, targeting $(DotNetTargetFramework)), all 38 shipped modern-.NET tasks register as a conditioned pair (Runtime="NET" TaskFactory="TaskHostFactory" Condition=" '$(MSBuildRuntimeType)' == 'Full' " and Runtime="NET" Condition=" '$(MSBuildRuntimeType)' == 'Core' ", asserted in NativeAotBootstrapTargetsTests). Document the actual three-way convention: unconditional TaskFactory="TaskHostFactory" Runtime="NET" for internal xa-prep-tasks/BootstrapTasks, neither attribute on shipped netstandard2.0 task assemblies, and the 'Full'/'Core' conditioned pair (never an unconditioned TaskFactory="TaskHostFactory") on $(_MicrosoftAndroidBuildTasksAssembly).
  • DependsOnTargets vs Condition evaluation order: .github/instructions/msbuild.instructions.md stated in its Inputs section that DependsOnTargets runs before the parent target's Condition, Inputs, and Outputs, contradicting its own later section (A target's Condition is evaluated before its DependsOnTargets) and MSBuild's TargetEntry.ExecuteEntry. Align both .github/instructions/msbuild.instructions.md and .github/skills/code-review/references/msbuild-rules.md to state that MSBuild evaluates Condition before scheduling DependsOnTargets, and runs DependsOnTargets before evaluating Inputs and Outputs ([Xamarin.Android.Build.Tasks] Replace Lint with MSBuild targets #13500).
  • $(DotNetStableTargetFramework) drift in Java.Interop docs: .github/instructions/java-interop.instructions.md and Documentation/Java.Interop/BuildConfiguration.md hardcoded .NET 10 / net10.0/, whereas Directory.Build.props sets <DotNetStableTargetFramework>net11.0</DotNetStableTargetFramework>. Reference $(DotNetStableTargetFramework) directly and note netstandard2.0 shared-library and $(TestOutputDirectory) output roots accurately so future TFM bumps do not go stale.

Validation: Documentation-only Markdown changes; no SDK build or device tests required per .github/copilot-instructions.md. Deterministically verified all 166 <UsingTask/> elements across all 62 .targets files under src/, NativeAotBootstrapTargetsTests.cs, Directory.Build.props, and all Java.Interop .csproj files against the updated wording.

Context: #10893
Context: #12678
Context: #13500
Context: #13756

Follow-up audit of repository agent instructions and code-review rules surfaced three places where our documented guidance contradicts MSBuild evaluation semantics or current repository conventions:

  * `<UsingTask/>` hosting across shipped assemblies: `.github/copilot-instructions.md`, `.github/instructions/msbuild.instructions.md`, and `.github/skills/code-review/references/msbuild-rules.md` carried a blanket ban from #10893 against putting `TaskFactory="TaskHostFactory"` or `Runtime="NET"` on any shipped `<UsingTask/>`. Since #12678 introduced `$(_MicrosoftAndroidBuildTasksAssembly)` (`Microsoft.Android.Build.Tasks.dll`, targeting `$(DotNetTargetFramework)`), all 38 shipped modern-.NET tasks register as a conditioned pair (`Runtime="NET" TaskFactory="TaskHostFactory" Condition=" '$(MSBuildRuntimeType)' == 'Full' "` and `Runtime="NET" Condition=" '$(MSBuildRuntimeType)' == 'Core' "`, asserted in `NativeAotBootstrapTargetsTests`). Document the actual three-way convention: unconditional `TaskFactory="TaskHostFactory" Runtime="NET"` for internal `xa-prep-tasks`/`BootstrapTasks`, neither attribute on shipped `netstandard2.0` task assemblies, and the `'Full'`/`'Core'` conditioned pair (never an unconditioned `TaskHostFactory`) on `$(_MicrosoftAndroidBuildTasksAssembly)`.
  * `DependsOnTargets` vs `Condition` evaluation order: `.github/instructions/msbuild.instructions.md` stated in its `Inputs` section that `DependsOnTargets` runs *before* the parent target's `Condition`, `Inputs`, and `Outputs`, contradicting its own later section (`A target's Condition is evaluated before its DependsOnTargets`) and MSBuild's `TargetEntry.ExecuteEntry`. Align both files (`.github/instructions/msbuild.instructions.md` and `.github/skills/code-review/references/msbuild-rules.md`) to state that MSBuild evaluates `Condition` before scheduling `DependsOnTargets`, and runs `DependsOnTargets` before evaluating `Inputs` and `Outputs` (#13500).
  * `$(DotNetStableTargetFramework)` drift in Java.Interop docs: `.github/instructions/java-interop.instructions.md` and `Documentation/Java.Interop/BuildConfiguration.md` hardcoded `.NET 10` / `net10.0/`, whereas `Directory.Build.props` now sets `<DotNetStableTargetFramework>net11.0</DotNetStableTargetFramework>`. Reference `$(DotNetStableTargetFramework)` directly and note `netstandard2.0` shared-library and `$(TestOutputDirectory)` output roots accurately so future TFM bumps do not go stale.

Validation: Documentation-only Markdown changes; no SDK build or device tests required per `.github/copilot-instructions.md`. Verified all 166 `<UsingTask/>` elements across all 62 `.targets` files under `src/`, `NativeAotBootstrapTargetsTests.cs`, `Directory.Build.props`, and all Java.Interop `.csproj` files against the updated wording.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 26, 2026 04:38

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.

🟢 Approval recommended

No active review issues were identified for the documentation-only updates to MSBuild and Java.Interop guidance.

No open issues 🎉

What changed in this PR

This documentation-only PR aligns .NET for Android’s agent instructions and review rules with current MSBuild behavior and Java.Interop build conventions.

Changes:

  • Distinguishes task-hosting rules for internal tasks, shipped netstandard2.0 tasks, and shipped modern-.NET tasks.
  • Clarifies that target conditions are evaluated before dependencies, while incremental inputs and outputs are evaluated afterward.
  • Replaces hardcoded Java.Interop framework versions with shared properties and clarifies output directories.
File Description
Documentation/​Java.Interop/​BuildConfiguration.md Clarifies framework-based output paths and shared-library exceptions.
.github/​skills/​code-review/​references/​msbuild-rules.md Aligns hosting and target-evaluation review guidance.
.github/​instructions/​msbuild.instructions.md Corrects evaluation order and documents three-way hosting rules.
.github/​instructions/​java-interop.instructions.md Uses framework properties instead of a hardcoded .NET version.
.github/​copilot-instructions.md Replaces the blanket shipped-task hosting ban with assembly-specific guidance.

Review effort: Balanced

@PeppersMuse

Copy link
Copy Markdown

Reviewed the docs-only alignment. What I checked:

  • UsingTask three-way convention: verified against the repo — the conditioned 'Full'/'Core' pair on $(_MicrosoftAndroidBuildTasksAssembly) exists in the shipped .targets files (e.g. Xamarin.Android.Common.targets, Microsoft.Android.Sdk.*.targets), and the new wording in .github/copilot-instructions.md, .github/instructions/msbuild.instructions.md, and .github/skills/code-review/references/msbuild-rules.md all describe the same three cases consistently (internal tasks always hosted, shipped netstandard2.0 tasks omit both attributes, shipped modern-.NET tasks use the conditioned pair, never an unconditioned TaskFactory).
  • Condition-before-DependsOnTargets: the corrected wording now matches MSBuild evaluation semantics and is consistent between the Inputs section and the later dedicated section in msbuild.instructions.md, and the matching row in msbuild-rules.md.
  • Java.Interop TFM wording: confirmed Directory.Build.props sets DotNetStableTargetFramework to net11.0, so referencing the property instead of hardcoding .NET 10 is correct. Also confirmed the BuildConfiguration.md note about netstandard2.0 shared libraries landing under $ (DotNetStableTargetFramework): e.g. Java.Interop.Tools.Cecil.csproj sets OutputPath to $ (BuildOutputDirectory)$ (DotNetStableTargetFramework)\ with AppendTargetFrameworkToOutputPath=false.
  • Copilot recommended approval with no open issues, and CI is green.

Docs-only, no build or test impact. Nothing blocking from me.

@simonrozsival
simonrozsival merged commit c19a2eb into main Nov 26, 2026
39 checks passed
@simonrozsival
simonrozsival deleted the pureween-ccr-evaluation branch November 26, 2026 13:00
simonrozsival added a commit that referenced this pull request Nov 27, 2026
Context: #13521
Context: #13728
Context: #13790

An expanded review of all stored conversation turns in 1,558 remaining local dotnet/android candidate sessions found recurring test-scope churn, overbuilt solutions, and build/environment validation pitfalls. The review used 50 subagents; 1,486 sessions had stored turns and 72 had none. The candidate filter can include non-coding conversations, and stored turns are not full raw tool transcripts.

### Test and review guidance

Test additions repeatedly needed scope reductions when they duplicated existing coverage, asserted implementation shape, or used brittle GC-timing assumptions. The guidance now emphasizes unique behavioral or regression protection while preserving meaningful characterization tests. The code-review skill no longer requires a comment on clean PRs or a full-file read when relevant context is sufficient.

### Build and runtime experiments

The review confirmed shared SDK/JDK path hazards and missing submodule prerequisites; local-build guidance now checks resolved paths, and the tests skill now lists the SourceLink workaround next to standalone `dotnet test`, where agents in fresh worktrees hit it. Manual submodule guidance already merged in #13780; automatic initialization is a separate build change in #13797, with no build-code changes here. Historical `make all` failures predate the existing `make leeroy` guidance. In one requested runtime experiment, successful builds and `dotnet test --no-build` exercised baseline rather than candidate artifacts, so the device skill now advises verifying manually replaced APK/native-library candidates.

### Correctness and shortening

Review rules contained inaccurate test-fixture, JNI, GC, and Android stack claims; these were corrected. MSBuild guidance now permits skipping incrementality when required side effects or incomplete inputs/outputs make it unsafe, and avoids requiring helper targets for inputs already available during evaluation. Rebasing onto main preserves #13790's task-hosting rules, Condition/DependsOnTargets ordering, and Java.Interop target-framework corrections unchanged rather than duplicating or replacing them.

The always-loaded instructions now enable NRT for new code without converting existing code unless asked. Duplicated commands, examples, and unconditional rules were removed or shortened.

Net change against the rebased main: **−138 lines** (+52/−190 across 11 instruction/skill files); `copilot-instructions.md` shrinks from 287 to 150 lines.
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.

5 participants