Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichal Strehovsky <michals@microsoft.com>2018-08-01 14:32:48 +0300
committerMichal Strehovsky <michals@microsoft.com>2018-08-01 14:32:48 +0300
commit2ba984648555e0e22efeee003f611643aa98b44f (patch)
tree8379f3bd3d7045a2fe4d2b2336b5b1ad062fd3a9 /src
parentebb3632553a4c8f1303c92fc03ce19b4879bb708 (diff)
Implement API review feedback for the removable feature feature
The API review board didn't approve this to be a public API due to lack of usage data for now, but did provide guidelines to make this approvable in the future. This is doing two things: * Rename the attribute * By default, removed methods are going to throw, with an opt out (that might not be officially available). This is pretty easy to implement for Project N, because DR is intertwined with S.P.CoreLib and we can just define the exception there. It will likely block the adoption of this by IL Linker (or any other tool that is not hardwirded to work against a specific runtime). [tfs-changeset: 1709140]
Diffstat (limited to 'src')
-rw-r--r--src/System.Private.CoreLib/src/Resources/Strings.resx3
-rw-r--r--src/System.Private.CoreLib/src/System.Private.CoreLib.csproj1
-rw-r--r--src/System.Private.CoreLib/src/System/Runtime/CompilerServices/FeatureRemovedException.cs25
3 files changed, 29 insertions, 0 deletions
diff --git a/src/System.Private.CoreLib/src/Resources/Strings.resx b/src/System.Private.CoreLib/src/Resources/Strings.resx
index 5b870d38b..1cfdaaa76 100644
--- a/src/System.Private.CoreLib/src/Resources/Strings.resx
+++ b/src/System.Private.CoreLib/src/Resources/Strings.resx
@@ -2392,6 +2392,9 @@
<data name="Serialization_DateTimeTicksOutOfRange" xml:space="preserve">
<value>Invalid serialized DateTime data. Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.</value>
</data>
+ <data name="FeatureRemoved_Message" xml:space="preserve">
+ <value>Code to support feature '{0}' was removed during publishing. If this is in error, update the project configuration to not disable feature '{0}'.</value>
+ </data>
<data name="Arg_InvalidANSIString" xml:space="preserve">
<value>The ANSI string passed in could not be converted from the default ANSI code page to Unicode.</value>
</data>
diff --git a/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj b/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj
index 605b68f64..ee7b79f3b 100644
--- a/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj
+++ b/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj
@@ -149,6 +149,7 @@
<Compile Include="Interop\Interop.manual.cs" />
<Compile Include="Interop\Interop.WinRT.cs" Condition="'$(EnableWinRT)' == 'true'" />
<Compile Include="System\Runtime\CompilerServices\CastableObject.cs" />
+ <Compile Include="System\Runtime\CompilerServices\FeatureRemovedException.cs" />
<Compile Include="System\Reflection\AssemblyNameHelpers.StrongName.cs" />
<Compile Include="System\Reflection\AssemblyNameHelpers.cs" />
<Compile Include="System\Reflection\AssemblyNameLexer.cs" />
diff --git a/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/FeatureRemovedException.cs b/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/FeatureRemovedException.cs
new file mode 100644
index 000000000..fce17a87f
--- /dev/null
+++ b/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/FeatureRemovedException.cs
@@ -0,0 +1,25 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.CompilerServices
+{
+ // Exception to be thrown when a feature was removed during publishing.
+ internal sealed class FeatureRemovedException : Exception
+ {
+ public string FeatureName { get; }
+
+ public FeatureRemovedException(string featureName)
+ {
+ FeatureName = featureName;
+ }
+
+ public override string Message
+ {
+ get
+ {
+ return SR.Format(SR.FeatureRemoved_Message, FeatureName);
+ }
+ }
+ }
+}