Skip to content

Setup PublicApi Roslyn analyzer for Xamarin.Android.Tools.AndroidSdk#294

Merged
jonathanpeppers merged 3 commits intomainfrom
copilot/setup-publicapi-roslyn-analyzer
Mar 10, 2026
Merged

Setup PublicApi Roslyn analyzer for Xamarin.Android.Tools.AndroidSdk#294
jonathanpeppers merged 3 commits intomainfrom
copilot/setup-publicapi-roslyn-analyzer

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 10, 2026

Adds Microsoft.CodeAnalysis.PublicApiAnalyzers to track public API surface changes, with APIs split between shipped (.NET 10) and unshipped (.NET 11).

  • Package: Microsoft.CodeAnalysis.PublicApiAnalyzers 3.3.4, PrivateAssets=All
  • Per-TFM API files: PublicAPI/{netstandard2.0,net10.0}/PublicAPI.{Shipped,Unshipped}.txt — both TFMs currently expose identical API surfaces
  • Shipped.txt: 130 public API entries representing the API surface at the .NET 10 release point (fb95edd)
  • Unshipped.txt: 131 entries for APIs introduced after the .NET 10 release (new .NET 11 APIs), including a *REMOVED* entry for the old ProcessUtils.StartProcess overload which gained an environmentVariables parameter
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.4" PrivateAssets="All" />

<AdditionalFiles Include="PublicAPI/$(TargetFramework)/PublicAPI.Shipped.txt" />
<AdditionalFiles Include="PublicAPI/$(TargetFramework)/PublicAPI.Unshipped.txt" />

Follows the per-TFM directory convention from dotnet/maui and the analyzer docs for multi-targeting projects.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Add Microsoft.CodeAnalysis.PublicApiAnalyzers 3.3.4 package reference.
Create per-TFM PublicAPI directories with Shipped.txt (empty) and
Unshipped.txt (all current public APIs) for both netstandard2.0 and
net10.0 target frameworks. Add AdditionalFiles entries in the .csproj.

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot AI changed the title [WIP] Setup PublicApi Roslyn analyzer for AndroidSdk Setup PublicApi Roslyn analyzer for Xamarin.Android.Tools.AndroidSdk Mar 10, 2026
@jonathanpeppers jonathanpeppers marked this pull request as ready for review March 10, 2026 16:43
Copilot AI review requested due to automatic review settings March 10, 2026 16:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds public API surface tracking to Xamarin.Android.Tools.AndroidSdk using Roslyn PublicApiAnalyzers, establishing per-target-framework PublicAPI baseline files to help prevent accidental public API changes across releases.

Changes:

  • Add Microsoft.CodeAnalysis.PublicApiAnalyzers to the AndroidSdk project.
  • Wire per-TFM PublicAPI/{TFM}/PublicAPI.{Shipped,Unshipped}.txt files via AdditionalFiles.
  • Introduce initial PublicAPI baseline files for netstandard2.0 and net10.0.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/Xamarin.Android.Tools.AndroidSdk/Xamarin.Android.Tools.AndroidSdk.csproj Adds PublicApiAnalyzers and includes per-TFM PublicAPI tracking files as additional analyzer inputs.
src/Xamarin.Android.Tools.AndroidSdk/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt Introduces the netstandard2.0 public API list (currently all under “Unshipped”).
src/Xamarin.Android.Tools.AndroidSdk/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt Adds the netstandard2.0 shipped baseline file (currently empty aside from #nullable enable).
src/Xamarin.Android.Tools.AndroidSdk/PublicAPI/net10.0/PublicAPI.Unshipped.txt Introduces the net10.0 public API list (currently all under “Unshipped”).
src/Xamarin.Android.Tools.AndroidSdk/PublicAPI/net10.0/PublicAPI.Shipped.txt Adds the net10.0 shipped baseline file (currently empty aside from #nullable enable).

Comment thread src/Xamarin.Android.Tools.AndroidSdk/PublicAPI/net10.0/PublicAPI.Unshipped.txt Outdated
@jonathanpeppers
Copy link
Copy Markdown
Member

@copilot can you move the "shipped" APIs for what shipped in .NET 10?

Then everything "unshipped" are API changes introduced in main after that point in time (.NET 11).

Move APIs that were present at the .NET 10 release point
(fb95edd) to PublicAPI.Shipped.txt. Only APIs introduced after
that commit remain in PublicAPI.Unshipped.txt (.NET 11 changes).

The old ProcessUtils.StartProcess signature (without
environmentVariables parameter) is marked as *REMOVED* in
Unshipped.txt since it was replaced with a new overload.

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 10, 2026

@copilot can you move the "shipped" APIs for what shipped in .NET 10?

Done in 86f8bba. Built the project at the .NET 10 release point (fb95edd) to generate its public API surface, then split the APIs:

  • Shipped.txt: 130 API entries that existed at fb95edd (the .NET 10 release point)
  • Unshipped.txt: 131 entries for APIs introduced after that commit (.NET 11), including a *REMOVED* entry for the old ProcessUtils.StartProcess overload (which gained an environmentVariables parameter)

@jonathanpeppers jonathanpeppers merged commit 3c4858c into main Mar 10, 2026
2 checks passed
@jonathanpeppers jonathanpeppers deleted the copilot/setup-publicapi-roslyn-analyzer branch March 10, 2026 19:06
jonathanpeppers pushed a commit that referenced this pull request Mar 11, 2026
Adds a convention: when adding or removing `public` API, update the `PublicAPI.Unshipped.txt` files for both `net10.0` and `netstandard2.0` TFMs, and verify zero `RS0016`/`RS0017` warnings.

Motivated by @jonathanpeppers feedback on #282 — new `AvdManagerRunner` and `AvdInfo` types were missing from the unshipped files after #294 added the analyzer.
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.

3 participants