Skip to content
1 change: 1 addition & 0 deletions docs/project/list-of-diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ The PR that reveals the implementation of the `<IncludeInternalObsoleteAttribute
| __`SYSLIB0059`__ | SystemEvents.EventsThreadShutdown callbacks are not run before the process exits. Use AppDomain.ProcessExit instead. |
| __`SYSLIB0060`__ | The constructors on Rfc2898DeriveBytes are obsolete. Use the static Pbkdf2 method instead. |
| __`SYSLIB0061`__ | The Queryable MinBy and MaxBy taking an IComparer\<TSource\> are obsolete. Use the new ones that take an IComparer\<TKey\>. |
| __`SYSLIB0062`__ | XSLT Script blocks are not supported on .NET Core or .NET 5 or later. |

## Analyzer Warnings

Expand Down
3 changes: 3 additions & 0 deletions src/libraries/Common/src/System/Obsoletions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ internal static class Obsoletions
internal const string QueryableMinByMaxByTSourceObsoleteMessage = "The Queryable MinBy and MaxBy taking an IComparer<TSource> are obsolete. Use the new ones that take an IComparer<TKey>.";
internal const string QueryableMinByMaxByTSourceObsoleteDiagId = "SYSLIB0061";

internal const string XsltSettingsEnableScriptMessage = "XSLT Script blocks are not supported on .NET Core or .NET 5 or later.";
internal const string XsltSettingsEnableScriptDiagId = "SYSLIB0062";

// When adding a new diagnostic ID, add it to the table in docs\project\list-of-diagnostics.md as well.
// Keep new const identifiers above this comment.
}
Expand Down
3 changes: 2 additions & 1 deletion src/libraries/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
SYSLIB0025: SuppressIldasmAttribute.
SYSLIB0032: HandleProcessCorruptedStateExceptionsAttribute.
SYSLIB0036: Regex.CompileToAssembly
SYSLIB0062: XsltSettings.EnableScript
-->
<NoWarn Condition="'$(IsPartialFacadeAssembly)' == 'true'">$(NoWarn);SYSLIB0003;SYSLIB0004;SYSLIB0015;SYSLIB0017;SYSLIB0021;SYSLIB0022;SYSLIB0023;SYSLIB0025;SYSLIB0032;SYSLIB0036</NoWarn>
<NoWarn Condition="'$(IsPartialFacadeAssembly)' == 'true'">$(NoWarn);SYSLIB0003;SYSLIB0004;SYSLIB0015;SYSLIB0017;SYSLIB0021;SYSLIB0022;SYSLIB0023;SYSLIB0025;SYSLIB0032;SYSLIB0036;SYSLIB0062</NoWarn>

<!-- Ignore analyzers that recommend APIs introduced in .NET Core when targeting frameworks that lack those APIs
to avoid issues with multitargeting.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ QilNode IXPathEnvironment.ResolveFunction(string prefix, string name, IList<QilN
for (int i = 0; i < args.Count; i++)
args[i] = _f.SafeDocOrderDistinct(args[i]);

#pragma warning disable SYSLIB0062 // XsltSettings.EnableScript is obsolete
if (_compiler.Settings.EnableScript)
#pragma warning restore SYSLIB0062
{
XmlExtensionFunction? scrFunc = _compiler.Scripts.ResolveFunction(name, ns, args.Count, (IErrorHelper)this);
if (scrFunc != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,9 @@ public XslFlags Function(string prefix, string name, IList<XslFlags> args)
{
// Unknown function. Can be script function or extension function
funcFlags = XslFlags.AnyType;
#pragma warning disable SYSLIB0062 // XsltSettings.EnableScript is obsolete
if (_compiler.Settings.EnableScript && ns != null)
#pragma warning restore SYSLIB0062
{
XmlExtensionFunction? scrFunc = _compiler.Scripts.ResolveFunction(name, ns, args.Count, default(NullErrorHelper));
if (scrFunc != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1309,7 +1309,9 @@ private void LoadMsScript(NsDecl? stylesheetNsList)
scriptNs ??= _compiler.CreatePhantomNamespace();
ParseStringAttribute(1, "language");

#pragma warning disable SYSLIB0062 // XsltSettings.EnableScript is obsolete
if (!_compiler.Settings.EnableScript)
#pragma warning restore SYSLIB0062
{
_compiler.Scripts.ScriptClasses[scriptNs] = null;
_input.SkipNode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public bool EnableDocumentFunction
set { _enableDocumentFunction = value; }
}

[Obsolete(Obsoletions.XsltSettingsEnableScriptMessage, DiagnosticId = Obsoletions.XsltSettingsEnableScriptDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
public bool EnableScript
{
get { return _enableScript; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2942,6 +2942,7 @@ public XsltSettings() { }
public XsltSettings(bool enableDocumentFunction, bool enableScript) { }
public static System.Xml.Xsl.XsltSettings Default { get { throw null; } }
public bool EnableDocumentFunction { get { throw null; } set { } }
[System.ObsoleteAttribute("XSLT Script blocks are not supported on .NET Core or .NET 5 or later.", DiagnosticId = "SYSLIB0062", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public bool EnableScript { get { throw null; } set { } }
public static System.Xml.Xsl.XsltSettings TrustedXslt { get { throw null; } }
}
Expand Down
Loading