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. |

## 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.";
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
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 @@ -208,7 +208,9 @@ public void XsltSettings1_2(object param0, object param1, object param2, object
_xsl.Load(_xslFile, xs, new XmlUrlResolver());

xs.EnableDocumentFunction = (bool)param5;
#pragma warning disable SYSLIB0062 // XsltSettings.EnableScript is obsolete
xs.EnableScript = (bool)param6;
#pragma warning restore SYSLIB0062
_xsl.Load(_xslFile, xs, new XmlUrlResolver());

try
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.", 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