From a99e21685c92c1d75c7397d936c1797c4aead372 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Tue, 23 May 2023 14:55:35 -0700 Subject: [PATCH 1/2] Use the BannedApiAnalyzer instead of the LinqPoison mechanism to ban Linq in the managed type system. --- .../Common/TypeSystem/Common/LinqPoison.cs | 20 ------------------- .../ILCompiler.TypeSystem/BannedSymbols.txt | 1 + .../ILCompiler.TypeSystem.csproj | 16 +++++++++++---- 3 files changed, 13 insertions(+), 24 deletions(-) delete mode 100644 src/coreclr/tools/Common/TypeSystem/Common/LinqPoison.cs create mode 100644 src/coreclr/tools/aot/ILCompiler.TypeSystem/BannedSymbols.txt diff --git a/src/coreclr/tools/Common/TypeSystem/Common/LinqPoison.cs b/src/coreclr/tools/Common/TypeSystem/Common/LinqPoison.cs deleted file mode 100644 index 2473b14397cab2..00000000000000 --- a/src/coreclr/tools/Common/TypeSystem/Common/LinqPoison.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace System -{ - // - // The type system needs to be low level enough to be usable as - // an actual runtime type system. - // - // LINQ is not low level enough to be allowable in the type system. - // - // It also has performance characteristics that make it a poor choice - // in high performance components such as the type system. - // - // If you get an error pointing to here, the fix is to remove - // "using System.Linq" from your file. Do not modify this file or - // remove it from the project. - // - internal sealed class Linq { } -} diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem/BannedSymbols.txt b/src/coreclr/tools/aot/ILCompiler.TypeSystem/BannedSymbols.txt new file mode 100644 index 00000000000000..9e3976e262a797 --- /dev/null +++ b/src/coreclr/tools/aot/ILCompiler.TypeSystem/BannedSymbols.txt @@ -0,0 +1 @@ +N:System.Linq;The type system needs to be low level enough to be usable as an actual runtime type system. LINQ is not low level enough to be allowable in the type system. diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem/ILCompiler.TypeSystem.csproj b/src/coreclr/tools/aot/ILCompiler.TypeSystem/ILCompiler.TypeSystem.csproj index 5a80cac5a3a0ec..23f3ac4005a57c 100644 --- a/src/coreclr/tools/aot/ILCompiler.TypeSystem/ILCompiler.TypeSystem.csproj +++ b/src/coreclr/tools/aot/ILCompiler.TypeSystem/ILCompiler.TypeSystem.csproj @@ -27,7 +27,7 @@ - + 1.4.0 @@ -252,9 +252,6 @@ TypeSystem\Common\LayoutInt.cs - - TypeSystem\Common\LinqPoison.cs - TypeSystem\Common\MetadataType.cs @@ -667,4 +664,15 @@ TypeSystem\Sorting\TypeSystemComparer.cs + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + From 09a6c2dee5687059e24fb5fdd3c94a637e74cb49 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Tue, 23 May 2023 15:29:45 -0700 Subject: [PATCH 2/2] Update the BannedApiAnalyzer to get support for banning namespaces. --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 2b7e2b42881ab9..964aa198246752 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -71,7 +71,7 @@ 4.5.0 1.0.1-beta1.21265.1 - 3.3.2 + 3.3.5-beta1.23270.2