Skip to content

Skip NU1703 for empty MonoAndroid assets#7511

Open
sbomer wants to merge 2 commits into
NuGet:devfrom
sbomer:skip-empty-assets-for-monoandroid-warning
Open

Skip NU1703 for empty MonoAndroid assets#7511
sbomer wants to merge 2 commits into
NuGet:devfrom
sbomer:skip-empty-assets-for-monoandroid-warning

Conversation

@sbomer

@sbomer sbomer commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Avoid emitting the MonoAndroid deprecation warning (introduced in #7229) when restore selects only . placeholder assets from a package. Keep warning behavior for packages that contribute real MonoAndroid compile or runtime assets.

The warning was showing up on a transitive reference to System.Security.Cryptography.ProtectedData 4.5.0 in dotnet/runtime#129836, but we don't want it to warn when no assets are used from the MonoAndroid TFM.

Assisted-by: GitHub Copilot CLI:gpt-5.5

@nkolev92 PTAL

Bug

Fixes:
NU1903 showing up on reference to old package with MonoAndroid TFM but no MonoAndroid assets, in dotnet/runtime#129836.

Description

The warning added in #7229 fires for packages that declare a MonoAndroid TFM but only ship an empty _._ placeholder for TFM compatibility. We shouldn't emit the warning if no MonoAndroid assets are consumed.

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.

Avoid emitting the MonoAndroid deprecation warning when restore selects only _._ placeholder assets from a package. Keep warning behavior for packages that contribute real MonoAndroid compile or runtime assets.

Assisted-by: GitHub Copilot CLI:gpt-5.5

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sbomer sbomer requested a review from a team as a code owner June 25, 2026 19:14
@sbomer sbomer requested review from jebriede and zivkan June 25, 2026 19:14
@dotnet-policy-service dotnet-policy-service Bot added the Community PRs created by someone not in the NuGet team label Jun 25, 2026

@nkolev92 nkolev92 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

small suggestion. LGTM

Please keep the PR template for PRs.

Comment thread src/NuGet.Core/NuGet.Commands/RestoreCommand/MonoAndroidDeprecation.cs Outdated
Remove the unnecessary null-conditional when checking selected MonoAndroid assets; restore passes non-null asset collections.

Assisted-by: GitHub Copilot CLI:gpt-5.5

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community PRs created by someone not in the NuGet team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants