Skip to content

Conversation

@jpobst
Copy link
Contributor

@jpobst jpobst commented Jan 26, 2023

Context: dotnet/android#7590

While building Mono.Android.dll, we have 1462 CA1422 warnings of the following caused by an interface being marked as [ObsoleteOSPlatform] but the interface invoker class is not similarly annotated.

C:\code\xamarin-android\src\Mono.Android\obj\Debug\net8.0\android-33\mcw\Org.Apache.Commons.Logging.ILog.cs(128,11): 
warning CA1422: This call site is reachable on: 'Android' 21.0 and later. 'ILog' is obsoleted on: 'Android' 22.0 and 
later (This class is obsoleted in this android platform).

There are also 42 CA1422 warnings caused by interface async extension classes not having [ObsoleteOSPlatform] attributes.

C:\code\xamarin-android\src\Mono.Android\obj\Debug\net8.0\android-33\mcw\
Org.Apache.Http.IO.ISessionOutputBuffer.cs(52,58): warning CA1422: This call site is reachable on: 'Android' 21.0 
and later. 'ISessionOutputBuffer.Write(byte[]?, int, int)' is obsoleted on: 'Android' 22.0 and later 
(This class is obsoleted in this android platform).

Fix these by adding the [ObsoleteOSPlatform] attribute to these types if the source interface is deprecated.

@jpobst jpobst marked this pull request as ready for review January 26, 2023 19:59
@jpobst jpobst requested a review from jonpryor January 26, 2023 19:59
@jonpryor jonpryor merged commit 120d8a7 into main Jan 26, 2023
@jonpryor jonpryor deleted the more-obsolete branch January 26, 2023 20:18
jonpryor pushed a commit to dotnet/android that referenced this pull request Feb 15, 2023
Changes: dotnet/java-interop@8a1ae57...9e0a469

  * dotnet/java-interop@9e0a4690: [generator] deep clone methods to avoid NREs (dotnet/java-interop#1080)
  * dotnet/java-interop@5fa7ac45: [java-source-utils] Fix lgtm java/path-injection-local (dotnet/java-interop#1079)
  * dotnet/java-interop@120d8a71: [generator] Add more [ObsoleteOSPlatform] to prevent CA1422 (dotnet/java-interop#1078)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants