Skip to content

Commit df05666

Browse files
authored
Update the (Get|Set)CompressedStack obsoletions to use SYSLIB0003 (#56874)
* Update the (Get|Set)CompressedStack obsoletions to use SYSLIB0003 * Update test suppression
1 parent f61d5c8 commit df05666

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,13 +507,13 @@ private bool SetApartmentState(ApartmentState state, bool throwOnError)
507507
return SetApartmentStateUnchecked(state, throwOnError);
508508
}
509509

510-
[Obsolete("Thread.GetCompressedStack has been deprecated. Use the System.Threading.CompressedStack class instead.")]
510+
[Obsolete(Obsoletions.CodeAccessSecurityMessage, DiagnosticId = Obsoletions.CodeAccessSecurityDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
511511
public CompressedStack GetCompressedStack()
512512
{
513513
throw new InvalidOperationException(SR.Thread_GetSetCompressedStack_NotSupported);
514514
}
515515

516-
[Obsolete("Thread.SetCompressedStack has been deprecated. Use the System.Threading.CompressedStack class instead.")]
516+
[Obsolete(Obsoletions.CodeAccessSecurityMessage, DiagnosticId = Obsoletions.CodeAccessSecurityDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
517517
public void SetCompressedStack(CompressedStack stack)
518518
{
519519
throw new InvalidOperationException(SR.Thread_GetSetCompressedStack_NotSupported);

src/libraries/System.Threading.Thread/ref/System.Threading.Thread.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public static void EndThreadAffinity() { }
6464
~Thread() { }
6565
public static void FreeNamedDataSlot(string name) { }
6666
public System.Threading.ApartmentState GetApartmentState() { throw null; }
67-
[System.ObsoleteAttribute("Thread.GetCompressedStack has been deprecated. Use the System.Threading.CompressedStack class instead.")]
67+
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
6868
public System.Threading.CompressedStack GetCompressedStack() { throw null; }
6969
public static int GetCurrentProcessorId() { throw null; }
7070
public static object? GetData(System.LocalDataStoreSlot slot) { throw null; }
@@ -83,7 +83,7 @@ public static void ResetAbort() { }
8383
public void Resume() { }
8484
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
8585
public void SetApartmentState(System.Threading.ApartmentState state) { }
86-
[System.ObsoleteAttribute("Thread.SetCompressedStack has been deprecated. Use the System.Threading.CompressedStack class instead.")]
86+
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
8787
public void SetCompressedStack(System.Threading.CompressedStack stack) { }
8888
public static void SetData(System.LocalDataStoreSlot slot, object? data) { }
8989
public static void Sleep(int millisecondsTimeout) { }

src/libraries/System.Threading.Thread/tests/ThreadTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,10 +1149,10 @@ public static void MiscellaneousTest()
11491149
Thread.BeginThreadAffinity();
11501150
Thread.EndThreadAffinity();
11511151

1152-
#pragma warning disable 618 // obsolete members
1152+
#pragma warning disable SYSLIB0003 // obsolete members
11531153
Assert.Throws<InvalidOperationException>(() => Thread.CurrentThread.GetCompressedStack());
11541154
Assert.Throws<InvalidOperationException>(() => Thread.CurrentThread.SetCompressedStack(CompressedStack.Capture()));
1155-
#pragma warning restore 618 // obsolete members
1155+
#pragma warning restore SYSLIB0003 // obsolete members
11561156

11571157
Thread.MemoryBarrier();
11581158

0 commit comments

Comments
 (0)