Skip to content

Obsolete SuppressIldasmAttribute and remove ildasm.exe support for it #50951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/project/list-of-diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ The PR that reveals the implementation of the `<IncludeInternalObsoleteAttribute
| __`SYSLIB0012`__ | Assembly.CodeBase and Assembly.EscapedCodeBase are only included for .NET Framework compatibility. Use Assembly.Location instead. |
| __`SYSLIB0013`__ | Uri.EscapeUriString can corrupt the Uri string in some cases. Consider using Uri.EscapeDataString for query string components instead. |
| __`SYSLIB0014`__ | WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead. |
| __`SYSLIB0015`__ | DisablePrivateReflectionAttribute has no effect in .NET 6.0+ applications. |
| __`SYSLIB0015`__ | DisablePrivateReflectionAttribute has no effect in .NET 6.0+. |
| __`SYSLIB0016`__ | Use the Graphics.GetContextInfo overloads that accept arguments for better performance and fewer allocations. |
| __`SYSLIB0017`__ | Strong name signing is not supported and throws PlatformNotSupportedException. |
| __`SYSLIB0018`__ | ReflectionOnly loading is not supported and throws PlatformNotSupportedException. |
Expand All @@ -79,6 +79,7 @@ The PR that reveals the implementation of the `<IncludeInternalObsoleteAttribute
| __`SYSLIB0022`__ | The Rijndael and RijndaelManaged types are obsolete. Use Aes instead. |
| __`SYSLIB0023`__ | RNGCryptoServiceProvider is obsolete. To generate a random number, use one of the RandomNumberGenerator static methods instead. |
| __`SYSLIB0024`__ | Creating and unloading AppDomains is not supported and throws an exception. |
| __`SYSLIB0025`__ | SuppressIldasmAttribute has no effect in .NET 6.0+. |

## Analyzer Warnings

Expand Down
30 changes: 0 additions & 30 deletions src/coreclr/ildasm/dasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -879,22 +879,6 @@ BOOL EnumClasses()
#pragma warning(pop)
#endif

#ifndef _DEBUG
bool HasSuppressingAttribute()
{
const void* pData;
ULONG cbData;

return ((S_OK == g_pImport->GetCustomAttributeByName(TokenFromRid(mdtModule,1),
(LPCUTF8)"System.Runtime.CompilerServices.SuppressIldasmAttribute",
&pData,
&cbData))
|| (S_OK == g_pImport->GetCustomAttributeByName(TokenFromRid(mdtAssembly,1),
(LPCUTF8)"System.Runtime.CompilerServices.SuppressIldasmAttribute",
&pData,
&cbData)));
}
#endif
void DumpMscorlib(void* GUICookie)
{
// In the CoreCLR with reference assemblies and redirection it is more difficult to determine if
Expand Down Expand Up @@ -7541,17 +7525,6 @@ BOOL DumpFile()
_ASSERTE(g_rchCA);
memset(g_rchCA,0,g_uNCA+1);
}
#ifndef _DEBUG
if(HasSuppressingAttribute())
{
if (g_fDumpHeader)
DumpHeader(g_CORHeader,g_pFile);
if(g_fDumpMetaInfo)
DumpMetaInfo(g_wszFullInputFile,NULL,g_pFile);
printError(g_pFile,RstrUTF(IDS_E_SUPPRESSED));
goto CloseFileAndExit;
}
#endif

{
// Dump the CLR header info if requested.
Expand Down Expand Up @@ -7814,9 +7787,6 @@ BOOL DumpFile()
DumpRTFPostfix(g_pFile);
}

#ifndef _DEBUG
CloseFileAndExit:
#endif
if(g_pFile)
{
fclose(g_pFile);
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/ildasm/dasm.rc
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ BEGIN
IDS_W_CREATEDMRES L"WARNING: managed resource file %s created"
IDS_E_READINGMRES L"ERROR: reading managed resource %s at offset 0x%X"
IDS_RTL L"RTL_False" // change this to RTL_True on Arabic/Hebrew system
IDS_E_SUPPRESSED L"Protected module -- cannot disassemble"
IDS_LEGALCOPYRIGHT L"\251 Microsoft Corporation. All rights reserved."
END

Expand Down
5 changes: 2 additions & 3 deletions src/coreclr/ildasm/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,8 @@
#define IDS_VERSION 491
#define IDS_W_CREATEDMRES 492
#define IDS_E_READINGMRES 493
#define IDS_E_SUPPRESSED 494
#define IDS_LEGALCOPYRIGHT 495
#define IDS_E_INVALIDRECORD 496
#define IDS_LEGALCOPYRIGHT 494
#define IDS_E_INVALIDRECORD 495

#define IDC_CHECK1 1000
#define IDC_CHECK2 1001
Expand Down
5 changes: 4 additions & 1 deletion src/libraries/Common/src/System/Obsoletions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ internal static class Obsoletions
internal const string WebRequestMessage = "WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.";
internal const string WebRequestDiagId = "SYSLIB0014";

internal const string DisablePrivateReflectionAttributeMessage = "DisablePrivateReflectionAttribute has no effect in .NET 6.0+ applications.";
internal const string DisablePrivateReflectionAttributeMessage = "DisablePrivateReflectionAttribute has no effect in .NET 6.0+.";
internal const string DisablePrivateReflectionAttributeDiagId = "SYSLIB0015";

internal const string GetContextInfoMessage = "Use the Graphics.GetContextInfo overloads that accept arguments for better performance and fewer allocations.";
Expand Down Expand Up @@ -83,5 +83,8 @@ internal static class Obsoletions

internal const string AppDomainCreateUnloadMessage = "Creating and unloading AppDomains is not supported and throws an exception.";
internal const string AppDomainCreateUnloadDiagId = "SYSLIB0024";

internal const string SuppressIldasmAttributeMessage = "SuppressIldasmAttribute has no effect in .NET 6.0+.";
internal const string SuppressIldasmAttributeDiagId = "SYSLIB0025";
}
}
3 changes: 2 additions & 1 deletion src/libraries/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
SYSLIB0021: Derived cryptographic types.
SYSLIB0022: Rijndael types.
SYSLIB0023: RNGCryptoServiceProvider.
SYSLIB0025: SuppressIldasmAttribute.
-->
<NoWarn Condition="'$(IsPartialFacadeAssembly)' == 'true'">$(NoWarn);SYSLIB0003;SYSLIB0004;SYSLIB0015;SYSLIB0017;SYSLIB0021;SYSLIB0022;SYSLIB0023</NoWarn>
<NoWarn Condition="'$(IsPartialFacadeAssembly)' == 'true'">$(NoWarn);SYSLIB0003;SYSLIB0004;SYSLIB0015;SYSLIB0017;SYSLIB0021;SYSLIB0022;SYSLIB0023;SYSLIB0025</NoWarn>
<!-- Reset these properties back to blank, since they are defaulted by Microsoft.NET.Sdk -->
<WarningsAsErrors Condition="'$(WarningsAsErrors)' == 'NU1605'" />
<!-- Set the documentation output file globally. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace System.Runtime.CompilerServices
{
[Obsolete(Obsoletions.SuppressIldasmAttributeMessage, DiagnosticId = Obsoletions.SuppressIldasmAttributeDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module)]
public sealed class SuppressIldasmAttribute : Attribute
{
Expand Down
3 changes: 2 additions & 1 deletion src/libraries/System.Runtime/ref/System.Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9570,7 +9570,7 @@ public DependencyAttribute(string dependentAssemblyArgument, System.Runtime.Comp
public string DependentAssembly { get { throw null; } }
public System.Runtime.CompilerServices.LoadHint LoadHint { get { throw null; } }
}
[System.ObsoleteAttribute("DisablePrivateReflectionAttribute has no effect in .NET 6.0+ applications.", DiagnosticId = "SYSLIB0015", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.ObsoleteAttribute("DisablePrivateReflectionAttribute has no effect in .NET 6.0+.", DiagnosticId = "SYSLIB0015", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public sealed partial class DisablePrivateReflectionAttribute : System.Attribute
{
Expand Down Expand Up @@ -9854,6 +9854,7 @@ public StrongBox() { }
public StrongBox(T value) { }
object? System.Runtime.CompilerServices.IStrongBox.Value { get { throw null; } set { } }
}
[System.ObsoleteAttribute("SuppressIldasmAttribute has no effect in .NET 6.0+.", DiagnosticId = "SYSLIB0025", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Module)]
public sealed partial class SuppressIldasmAttribute : System.Attribute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,13 @@ public static void StringFreezingAttributeTests()
new StringFreezingAttribute();
}

#pragma warning disable SYSLIB0025 // Obsolete: SuppressIldasmAttribute
[Fact]
public static void SuppressIldasmAttributeTests()
{
new SuppressIldasmAttribute();
}
#pragma warning restore SYSLIB0025 // Obsolete: SuppressIldasmAttribute

[Fact]
public static void TypeForwardedFromAttributeTests()
Expand Down