Skip to content

Commit 5aa4945

Browse files
authored
Fix platform analyzer attribute order for MacCatalyst (#105409)
We need to make sure the attribute for MacCatalyst comes _after_ the iOS one due to how MacCatalyst is a superset of iOS: https://learn.microsoft.com/en-us/dotnet/standard/analyzers/platform-compat-analyzer#platform-inclusion This caused an error in aspnetcore in the latest dependency flow because the analyzer thought AesGcm is _only_ supported on MacCatalyst: > error CA1416: (NETCORE_ENGINEERING_TELEMETRY=Build) This call site is reachable on all platforms. 'AesGcm.Decrypt(ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, Span<byte>, ReadOnlySpan<byte>)' is only supported on: 'maccatalyst' 13.0 and later.
1 parent d3eeb0e commit 5aa4945

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Aead.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ private static ref readonly byte GetSwiftRef(ReadOnlySpan<byte> b)
3030

3131
[UnsupportedOSPlatform("ios")]
3232
[UnsupportedOSPlatform("tvos")]
33-
[SupportedOSPlatform("maccatalyst")]
3433
[SupportedOSPlatform("ios13.0")]
3534
[SupportedOSPlatform("tvos13.0")]
35+
[SupportedOSPlatform("maccatalyst")]
3636
internal static unsafe void ChaCha20Poly1305Encrypt(
3737
ReadOnlySpan<byte> key,
3838
ReadOnlySpan<byte> nonce,
@@ -68,9 +68,9 @@ internal static unsafe void ChaCha20Poly1305Encrypt(
6868

6969
[UnsupportedOSPlatform("ios")]
7070
[UnsupportedOSPlatform("tvos")]
71-
[SupportedOSPlatform("maccatalyst")]
7271
[SupportedOSPlatform("ios13.0")]
7372
[SupportedOSPlatform("tvos13.0")]
73+
[SupportedOSPlatform("maccatalyst")]
7474
internal static unsafe void ChaCha20Poly1305Decrypt(
7575
ReadOnlySpan<byte> key,
7676
ReadOnlySpan<byte> nonce,
@@ -113,9 +113,9 @@ internal static unsafe void ChaCha20Poly1305Decrypt(
113113

114114
[UnsupportedOSPlatform("ios")]
115115
[UnsupportedOSPlatform("tvos")]
116-
[SupportedOSPlatform("maccatalyst")]
117116
[SupportedOSPlatform("ios13.0")]
118117
[SupportedOSPlatform("tvos13.0")]
118+
[SupportedOSPlatform("maccatalyst")]
119119
internal static unsafe void AesGcmEncrypt(
120120
ReadOnlySpan<byte> key,
121121
ReadOnlySpan<byte> nonce,
@@ -151,9 +151,9 @@ internal static unsafe void AesGcmEncrypt(
151151

152152
[UnsupportedOSPlatform("ios")]
153153
[UnsupportedOSPlatform("tvos")]
154-
[SupportedOSPlatform("maccatalyst")]
155154
[SupportedOSPlatform("ios13.0")]
156155
[SupportedOSPlatform("tvos13.0")]
156+
[SupportedOSPlatform("maccatalyst")]
157157
internal static unsafe void AesGcmDecrypt(
158158
ReadOnlySpan<byte> key,
159159
ReadOnlySpan<byte> nonce,

src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/RuntimeMetrics.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,10 @@ private static IEnumerable<Measurement<long>> GetGarbageCollectionCounts()
191191
}
192192
}
193193

194-
[SupportedOSPlatform("maccatalyst")]
195194
[UnsupportedOSPlatform("ios")]
196195
[UnsupportedOSPlatform("tvos")]
197196
[UnsupportedOSPlatform("browser")]
197+
[SupportedOSPlatform("maccatalyst")]
198198
private static IEnumerable<Measurement<double>> GetCpuTime()
199199
{
200200
Debug.Assert(s_processCpuTime is not null);

src/libraries/System.Private.CoreLib/src/System/Environment.UnixOrBrowser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ private static int CheckedSysConf(Interop.Sys.SysConfName name)
7575
/// Get the CPU usage, including the process time spent running the application code, the process time spent running the operating system code,
7676
/// and the total time spent running both the application and operating system code.
7777
/// </summary>
78-
[SupportedOSPlatform("maccatalyst")]
7978
[UnsupportedOSPlatform("ios")]
8079
[UnsupportedOSPlatform("tvos")]
8180
[UnsupportedOSPlatform("browser")]
81+
[SupportedOSPlatform("maccatalyst")]
8282
public static ProcessCpuUsage CpuUsage
8383
{
8484
get

src/libraries/System.Private.CoreLib/src/System/Environment.Windows.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,10 @@ private static unsafe string[] SegmentCommandLine(char* cmdLine)
364364
/// Get the CPU usage, including the process time spent running the application code, the process time spent running the operating system code,
365365
/// and the total time spent running both the application and operating system code.
366366
/// </summary>
367-
[SupportedOSPlatform("maccatalyst")]
368367
[UnsupportedOSPlatform("ios")]
369368
[UnsupportedOSPlatform("tvos")]
370369
[UnsupportedOSPlatform("browser")]
370+
[SupportedOSPlatform("maccatalyst")]
371371
public static ProcessCpuUsage CpuUsage
372372
{
373373
get => Interop.Kernel32.GetProcessTimes(Interop.Kernel32.GetCurrentProcess(), out _, out _, out long procKernelTime, out long procUserTime) ?

src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ public override void GenerateKey() { }
121121
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
122122
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")]
123123
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")]
124-
[System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")]
125124
[System.Runtime.Versioning.SupportedOSPlatform("ios13.0")]
126125
[System.Runtime.Versioning.SupportedOSPlatform("tvos13.0")]
126+
[System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")]
127127
public sealed partial class AesGcm : System.IDisposable
128128
{
129129
[System.ObsoleteAttribute("AesGcm should indicate the required tag size for encryption and decryption. Use a constructor that accepts the tag size.", DiagnosticId="SYSLIB0053", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
@@ -287,9 +287,9 @@ public AuthenticationTagMismatchException(string? message, System.Exception? inn
287287
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
288288
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")]
289289
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")]
290-
[System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")]
291290
[System.Runtime.Versioning.SupportedOSPlatform("ios13.0")]
292291
[System.Runtime.Versioning.SupportedOSPlatform("tvos13.0")]
292+
[System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")]
293293
public sealed partial class ChaCha20Poly1305 : System.IDisposable
294294
{
295295
public ChaCha20Poly1305(byte[] key) { }

src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ namespace System.Security.Cryptography
1010
[UnsupportedOSPlatform("browser")]
1111
[UnsupportedOSPlatform("ios")]
1212
[UnsupportedOSPlatform("tvos")]
13-
[SupportedOSPlatform("maccatalyst")]
1413
[SupportedOSPlatform("ios13.0")]
1514
[SupportedOSPlatform("tvos13.0")]
15+
[SupportedOSPlatform("maccatalyst")]
1616
public sealed partial class AesGcm : IDisposable
1717
{
1818
private const int NonceSize = 12;

src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ChaCha20Poly1305.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ namespace System.Security.Cryptography
99
[UnsupportedOSPlatform("browser")]
1010
[UnsupportedOSPlatform("ios")]
1111
[UnsupportedOSPlatform("tvos")]
12-
[SupportedOSPlatform("maccatalyst")]
1312
[SupportedOSPlatform("ios13.0")]
1413
[SupportedOSPlatform("tvos13.0")]
14+
[SupportedOSPlatform("maccatalyst")]
1515
public sealed partial class ChaCha20Poly1305 : IDisposable
1616
{
1717
// Per https://tools.ietf.org/html/rfc7539, ChaCha20Poly1305 AEAD requires a 256-bit key and 96-bit nonce,

0 commit comments

Comments
 (0)