From a4886253e64eac249ffb74b285de0f90ae654b7b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 8 Sep 2025 18:08:30 +0000 Subject: [PATCH 1/6] Initial plan From ff9418ac0ca843818d2eb94e8e4798868dd5e362 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 8 Sep 2025 18:16:43 +0000 Subject: [PATCH 2/6] Add breaking change documentation for XsltSettings.EnableScript obsolete (SYSLIB0062) Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --- docs/core/compatibility/10.0.md | 6 ++ docs/core/compatibility/toc.yml | 4 + .../xsltsettings-enablescript-obsolete.md | 78 +++++++++++++++++++ .../code-analysis/quality-rules/ca3076.md | 3 + .../xml/script-blocks-using-msxsl-script.md | 5 +- 5 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 docs/core/compatibility/xml/10.0/xsltsettings-enablescript-obsolete.md diff --git a/docs/core/compatibility/10.0.md b/docs/core/compatibility/10.0.md index b20300bcb804a..4bace90e659f3 100644 --- a/docs/core/compatibility/10.0.md +++ b/docs/core/compatibility/10.0.md @@ -136,3 +136,9 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af |-------|---------------------------------------|--------------------| | [Empty ColumnDefinitions and RowDefinitions are disallowed](wpf/10.0/empty-grid-definitions.md) | Source incompatible | Preview 5 | | [Incorrect usage of DynamicResource causes application crash](wpf/10.0/dynamicresource-crash.md) | Source incompatible/behavioral change | Preview 4 | + +## XML and XSLT + +| Title | Type of change | Introduced version | +|-------|-------------------|--------------------| +| [XsltSettings.EnableScript property is obsolete](xml/10.0/xsltsettings-enablescript-obsolete.md) | Source incompatible | Preview 1 | diff --git a/docs/core/compatibility/toc.yml b/docs/core/compatibility/toc.yml index 2308812e76ac7..429847364a9a6 100644 --- a/docs/core/compatibility/toc.yml +++ b/docs/core/compatibility/toc.yml @@ -158,6 +158,10 @@ items: href: wpf/10.0/empty-grid-definitions.md - name: Incorrect usage of DynamicResource causes application crash href: wpf/10.0/dynamicresource-crash.md + - name: XML and XSLT + items: + - name: XsltSettings.EnableScript property is obsolete + href: xml/10.0/xsltsettings-enablescript-obsolete.md - name: .NET 9 items: - name: Overview diff --git a/docs/core/compatibility/xml/10.0/xsltsettings-enablescript-obsolete.md b/docs/core/compatibility/xml/10.0/xsltsettings-enablescript-obsolete.md new file mode 100644 index 0000000000000..f8a03b6ddc021 --- /dev/null +++ b/docs/core/compatibility/xml/10.0/xsltsettings-enablescript-obsolete.md @@ -0,0 +1,78 @@ +--- +title: "Breaking change - XsltSettings.EnableScript property is obsolete" +description: "Learn about the breaking change in .NET 10 where XsltSettings.EnableScript property is marked as obsolete." +ms.date: 01/14/2025 +ai-usage: ai-assisted +ms.custom: https://github.com/dotnet/docs/issues/47504 +--- + +# XsltSettings.EnableScript property is obsolete + +The property is now marked as obsolete with diagnostic ID `SYSLIB0062`. XSLT script blocks are supported only in .NET Framework and are not supported on .NET Core or .NET 5+. + +## Version introduced + +.NET 10 Preview 1 + +## Previous behavior + +Previously, the property could be set without any compiler warnings: + +- When set to `false`: script blocks were skipped (expected behavior anyway) +- When set to `true`: a was thrown at runtime because script compilation is not supported + +```csharp +using System.Xml.Xsl; + +// No compiler warnings in previous versions +XsltSettings settings = new XsltSettings(); +settings.EnableScript = true; // Would throw PlatformNotSupportedException at runtime +``` + +## New behavior + +Starting in .NET 10, the property is marked as obsolete. Setting or accessing this property generates a compile-time warning `SYSLIB0062`. + +```csharp +using System.Xml.Xsl; + +// Generates SYSLIB0062 warning +XsltSettings settings = new XsltSettings(); +settings.EnableScript = true; // Warning: SYSLIB0062: XsltSettings.EnableScript is obsolete +``` + +## Type of breaking change + +This change can affect [source compatibility](../../categories.md#source-compatibility). + +## Reason for change + +The property was obsoleted to turn a runtime error into a build warning, providing better guidance for migration. Since XSLT script blocks are not supported on modern .NET implementations, this property had no legitimate use case and would only result in runtime exceptions when set to `true`. + +## Recommended action + +Call sites should be reviewed for any assumptions made about the behavior of this property. References to the property can most likely be removed since the property did not truly enable script blocks on modern .NET. + +Remove any references to `EnableScript` in your code: + +```csharp +// Before +XsltSettings settings = new XsltSettings(); +settings.EnableScript = true; // Remove this line + +// After +XsltSettings settings = new XsltSettings(); +// No need to set EnableScript +``` + +If you need to create XSLT settings with document function enabled but script disabled (which is the default behavior), use: + +```csharp +XsltSettings settings = new XsltSettings(enableDocumentFunction: true, enableScript: false); +// Or simply use XsltSettings.Default which has EnableScript = false +XsltSettings settings = XsltSettings.Default; +``` + +## Affected APIs + +- diff --git a/docs/fundamentals/code-analysis/quality-rules/ca3076.md b/docs/fundamentals/code-analysis/quality-rules/ca3076.md index 694b7dd2da321..20d4630b50a1c 100644 --- a/docs/fundamentals/code-analysis/quality-rules/ca3076.md +++ b/docs/fundamentals/code-analysis/quality-rules/ca3076.md @@ -19,6 +19,9 @@ f1_keywords: If you execute Extensible Stylesheets Language Transformations (XSLT) in .NET applications insecurely, the processor may resolve untrusted URI references that could disclose sensitive information to attackers, leading to Denial of Service and Cross-Site attacks. For more information, see [XSLT Security Considerations(.NET Guide)](../../../standard/data/xml/xslt-security-considerations.md). +> [!NOTE] +> Starting in .NET 10, the property is marked as obsolete and generates warning SYSLIB0062. Setting this property to `false` explicitly is no longer necessary since script execution is not supported on .NET Core or .NET 5+. + ## Rule description **XSLT** is a World Wide Web Consortium (W3C) standard for transforming XML data. XSLT is typically used to write style sheets to transform XML data to other formats such as HTML, fixed-length text, comma-separated text, or a different XML format. Although prohibited by default, you may choose to enable it for your project. diff --git a/docs/standard/data/xml/script-blocks-using-msxsl-script.md b/docs/standard/data/xml/script-blocks-using-msxsl-script.md index ffe21e97d91ad..3cc2511be09d5 100644 --- a/docs/standard/data/xml/script-blocks-using-msxsl-script.md +++ b/docs/standard/data/xml/script-blocks-using-msxsl-script.md @@ -16,7 +16,10 @@ The class supports embedded scripts u ## Enable XSLT Script - Support for embedded scripts is an optional XSLT setting on the class. Script support is disabled by default. To enable script support, create an object with the property set to `true` and pass the object to the method. +Support for embedded scripts is an optional XSLT setting on the class. Script support is disabled by default. To enable script support, create an object with the property set to `true` and pass the object to the method. + +> [!WARNING] +> Starting in .NET 10, the property is marked as obsolete and generates warning SYSLIB0062. Since script blocks are not supported on .NET Core or .NET 5+, this property has no effect and setting it to `true` will throw a at runtime. > [!NOTE] > XSLT scripting should be enabled only if you require script support and you are working in a fully trusted environment. From 742875924d1031c7674865272a76f7f3192f3c9c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 8 Sep 2025 18:20:44 +0000 Subject: [PATCH 3/6] Update code samples to warn about XsltSettings.EnableScript obsoletion Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --- .../XslCompiledTransform.Load/CS/Xslt_Load_v2.cs | 4 ++++ .../XslCompiledTransform.Load/VB/Xslt_Load_v2.vb | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/samples/snippets/csharp/VS_Snippets_Data/XslCompiledTransform.Load/CS/Xslt_Load_v2.cs b/samples/snippets/csharp/VS_Snippets_Data/XslCompiledTransform.Load/CS/Xslt_Load_v2.cs index 7f798692cd58c..5c5971391b34c 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/XslCompiledTransform.Load/CS/Xslt_Load_v2.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/XslCompiledTransform.Load/CS/Xslt_Load_v2.cs @@ -48,6 +48,7 @@ static void XslCompiledTransform_Load3() { XmlReader reader = XmlReader.Create("http://serverName/data/xsl/sort.xsl"); // Create the XsltSettings object with script enabled. +// Warning: Script enabling (true parameter) will be obsolete in .NET 10 XsltSettings settings = new XsltSettings(false,true); // Load the style sheet. @@ -95,6 +96,7 @@ static void XslCompiledTransform_Load5() { static void XslCompiledTransform_Load6() { // // Create the XsltSettings object with script enabled. +// Warning: Script enabling (true parameter) will be obsolete in .NET 10 XsltSettings settings = new XsltSettings(false,true); // Create the XslCompiledTransform object and load the style sheet. @@ -140,6 +142,8 @@ static void XslCompiledTransform_Load9() { // // Create the XsltSettings object with script enabled. XsltSettings settings = new XsltSettings(); +// Warning: Starting in .NET 10, EnableScript is obsolete (SYSLIB0062) +// and will throw PlatformNotSupportedException on .NET Core/.NET 5+ settings.EnableScript = true; // Create a resolver that will be used to resolve the style sheet. diff --git a/samples/snippets/visualbasic/VS_Snippets_Data/XslCompiledTransform.Load/VB/Xslt_Load_v2.vb b/samples/snippets/visualbasic/VS_Snippets_Data/XslCompiledTransform.Load/VB/Xslt_Load_v2.vb index a16962ecd2914..1728af05519c8 100644 --- a/samples/snippets/visualbasic/VS_Snippets_Data/XslCompiledTransform.Load/VB/Xslt_Load_v2.vb +++ b/samples/snippets/visualbasic/VS_Snippets_Data/XslCompiledTransform.Load/VB/Xslt_Load_v2.vb @@ -50,6 +50,7 @@ Class XslCompiledTransformLoad Dim reader As XmlReader = XmlReader.Create("http://serverName/data/xsl/sort.xsl") ' Create the XsltSettings object with script enabled. + ' Warning: Script enabling (True parameter) will be obsolete in .NET 10 Dim settings As New XsltSettings(False, True) ' Load the style sheet. @@ -97,6 +98,7 @@ Class XslCompiledTransformLoad Shared Sub XslCompiledTransform_Load6() ' ' Create the XsltSettings object with script enabled. + ' Warning: Script enabling (True parameter) will be obsolete in .NET 10 Dim settings As New XsltSettings(False, True) ' Create the XslCompiledTransform object and load the style sheet. @@ -142,6 +144,8 @@ Class XslCompiledTransformLoad ' ' Create the XsltSettings object with script enabled. Dim settings As New XsltSettings() + ' Warning: Starting in .NET 10, EnableScript is obsolete (SYSLIB0062) + ' and will throw PlatformNotSupportedException on .NET Core/.NET 5+ settings.EnableScript = True ' Create a resolver that will be used to resolve the style sheet. From c2cdce2a37a38d93893ff8c24bcbfb129d5296be Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Mon, 8 Sep 2025 14:30:12 -0700 Subject: [PATCH 4/6] human edits --- docs/core/compatibility/10.0.md | 6 -- .../core-libraries/10.0/obsolete-apis.md | 7 +- docs/core/compatibility/toc.yml | 4 - docs/core/compatibility/unsupported-apis.md | 3 +- .../xsltsettings-enablescript-obsolete.md | 78 ------------------- .../code-analysis/quality-rules/ca3076.md | 15 ++-- .../obsoletions-overview.md | 1 + .../syslib-diagnostics/syslib0061.md | 2 +- .../syslib-diagnostics/syslib0062.md | 48 ++++++++++++ docs/navigate/tools-diagnostics/toc.yml | 2 + .../xml/script-blocks-using-msxsl-script.md | 35 ++++----- 11 files changed, 80 insertions(+), 121 deletions(-) delete mode 100644 docs/core/compatibility/xml/10.0/xsltsettings-enablescript-obsolete.md create mode 100644 docs/fundamentals/syslib-diagnostics/syslib0062.md diff --git a/docs/core/compatibility/10.0.md b/docs/core/compatibility/10.0.md index 4bace90e659f3..b20300bcb804a 100644 --- a/docs/core/compatibility/10.0.md +++ b/docs/core/compatibility/10.0.md @@ -136,9 +136,3 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af |-------|---------------------------------------|--------------------| | [Empty ColumnDefinitions and RowDefinitions are disallowed](wpf/10.0/empty-grid-definitions.md) | Source incompatible | Preview 5 | | [Incorrect usage of DynamicResource causes application crash](wpf/10.0/dynamicresource-crash.md) | Source incompatible/behavioral change | Preview 4 | - -## XML and XSLT - -| Title | Type of change | Introduced version | -|-------|-------------------|--------------------| -| [XsltSettings.EnableScript property is obsolete](xml/10.0/xsltsettings-enablescript-obsolete.md) | Source incompatible | Preview 1 | diff --git a/docs/core/compatibility/core-libraries/10.0/obsolete-apis.md b/docs/core/compatibility/core-libraries/10.0/obsolete-apis.md index 797c61c39f824..603875dc29d7c 100644 --- a/docs/core/compatibility/core-libraries/10.0/obsolete-apis.md +++ b/docs/core/compatibility/core-libraries/10.0/obsolete-apis.md @@ -2,7 +2,7 @@ title: "Breaking change: .NET 10 obsoletions with custom IDs" titleSuffix: "" description: Learn about the APIs that have been marked as obsolete in .NET 10 with a custom diagnostic ID. -ms.date: 03/28/2025 +ms.date: 09/08/2025 ai-usage: ai-assisted --- # API obsoletions with non-default diagnostic IDs (.NET 10) @@ -21,6 +21,7 @@ The following table lists the custom diagnostic IDs and their corresponding warn | [SYSLIB0059](../../../../fundamentals/syslib-diagnostics/syslib0059.md) | callbacks aren't run before the process exits. Use instead. | Warning | | [SYSLIB0060](../../../../fundamentals/syslib-diagnostics/syslib0060.md) | constructors are obsolete. Use instead. | Warning | | [SYSLIB0061](../../../../fundamentals/syslib-diagnostics/syslib0061.md) | and taking an `IComparer` are obsolete. Use the new ones that take an `IComparer`. | Warning | +| [SYSLIB0062](../../../../fundamentals/syslib-diagnostics/syslib0062.md) | is obsolete. | Warning | ## Version introduced @@ -64,6 +65,10 @@ These obsoletions can affect [source compatibility](../../categories.md#source-c - - +### SYSLIB0062 + +- + ## See also - [API obsoletions with non-default diagnostic IDs (.NET 9)](../9.0/obsolete-apis-with-custom-diagnostics.md) diff --git a/docs/core/compatibility/toc.yml b/docs/core/compatibility/toc.yml index 429847364a9a6..2308812e76ac7 100644 --- a/docs/core/compatibility/toc.yml +++ b/docs/core/compatibility/toc.yml @@ -158,10 +158,6 @@ items: href: wpf/10.0/empty-grid-definitions.md - name: Incorrect usage of DynamicResource causes application crash href: wpf/10.0/dynamicresource-crash.md - - name: XML and XSLT - items: - - name: XsltSettings.EnableScript property is obsolete - href: xml/10.0/xsltsettings-enablescript-obsolete.md - name: .NET 9 items: - name: Overview diff --git a/docs/core/compatibility/unsupported-apis.md b/docs/core/compatibility/unsupported-apis.md index d230d80991bad..36b703f05db71 100644 --- a/docs/core/compatibility/unsupported-apis.md +++ b/docs/core/compatibility/unsupported-apis.md @@ -2,7 +2,7 @@ title: Unsupported APIs on .NET Core and .NET 5+ titleSuffix: "" description: Learn which .NET APIs always throw an exception on .NET Core and .NET 5 and later versions. -ms.date: 11/22/2024 +ms.date: 09/08/2025 --- # APIs that always throw exceptions on .NET Core and .NET 5+ @@ -349,6 +349,7 @@ This article organizes the affected APIs by namespace. | | All | | | All | | | All | +| (when set to `true`) | All | ## See also diff --git a/docs/core/compatibility/xml/10.0/xsltsettings-enablescript-obsolete.md b/docs/core/compatibility/xml/10.0/xsltsettings-enablescript-obsolete.md deleted file mode 100644 index f8a03b6ddc021..0000000000000 --- a/docs/core/compatibility/xml/10.0/xsltsettings-enablescript-obsolete.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -title: "Breaking change - XsltSettings.EnableScript property is obsolete" -description: "Learn about the breaking change in .NET 10 where XsltSettings.EnableScript property is marked as obsolete." -ms.date: 01/14/2025 -ai-usage: ai-assisted -ms.custom: https://github.com/dotnet/docs/issues/47504 ---- - -# XsltSettings.EnableScript property is obsolete - -The property is now marked as obsolete with diagnostic ID `SYSLIB0062`. XSLT script blocks are supported only in .NET Framework and are not supported on .NET Core or .NET 5+. - -## Version introduced - -.NET 10 Preview 1 - -## Previous behavior - -Previously, the property could be set without any compiler warnings: - -- When set to `false`: script blocks were skipped (expected behavior anyway) -- When set to `true`: a was thrown at runtime because script compilation is not supported - -```csharp -using System.Xml.Xsl; - -// No compiler warnings in previous versions -XsltSettings settings = new XsltSettings(); -settings.EnableScript = true; // Would throw PlatformNotSupportedException at runtime -``` - -## New behavior - -Starting in .NET 10, the property is marked as obsolete. Setting or accessing this property generates a compile-time warning `SYSLIB0062`. - -```csharp -using System.Xml.Xsl; - -// Generates SYSLIB0062 warning -XsltSettings settings = new XsltSettings(); -settings.EnableScript = true; // Warning: SYSLIB0062: XsltSettings.EnableScript is obsolete -``` - -## Type of breaking change - -This change can affect [source compatibility](../../categories.md#source-compatibility). - -## Reason for change - -The property was obsoleted to turn a runtime error into a build warning, providing better guidance for migration. Since XSLT script blocks are not supported on modern .NET implementations, this property had no legitimate use case and would only result in runtime exceptions when set to `true`. - -## Recommended action - -Call sites should be reviewed for any assumptions made about the behavior of this property. References to the property can most likely be removed since the property did not truly enable script blocks on modern .NET. - -Remove any references to `EnableScript` in your code: - -```csharp -// Before -XsltSettings settings = new XsltSettings(); -settings.EnableScript = true; // Remove this line - -// After -XsltSettings settings = new XsltSettings(); -// No need to set EnableScript -``` - -If you need to create XSLT settings with document function enabled but script disabled (which is the default behavior), use: - -```csharp -XsltSettings settings = new XsltSettings(enableDocumentFunction: true, enableScript: false); -// Or simply use XsltSettings.Default which has EnableScript = false -XsltSettings settings = XsltSettings.Default; -``` - -## Affected APIs - -- diff --git a/docs/fundamentals/code-analysis/quality-rules/ca3076.md b/docs/fundamentals/code-analysis/quality-rules/ca3076.md index 20d4630b50a1c..3b5f05f4eac93 100644 --- a/docs/fundamentals/code-analysis/quality-rules/ca3076.md +++ b/docs/fundamentals/code-analysis/quality-rules/ca3076.md @@ -17,21 +17,17 @@ f1_keywords: ## Cause -If you execute Extensible Stylesheets Language Transformations (XSLT) in .NET applications insecurely, the processor may resolve untrusted URI references that could disclose sensitive information to attackers, leading to Denial of Service and Cross-Site attacks. For more information, see [XSLT Security Considerations(.NET Guide)](../../../standard/data/xml/xslt-security-considerations.md). - -> [!NOTE] -> Starting in .NET 10, the property is marked as obsolete and generates warning SYSLIB0062. Setting this property to `false` explicitly is no longer necessary since script execution is not supported on .NET Core or .NET 5+. +If you execute Extensible Stylesheets Language Transformations (XSLT) in .NET applications insecurely, the processor might resolve untrusted URI references that could disclose sensitive information to attackers, leading to denial of service and cross-site attacks. For more information, see [XSLT Security Considerations (.NET Guide)](../../../standard/data/xml/xslt-security-considerations.md). ## Rule description -**XSLT** is a World Wide Web Consortium (W3C) standard for transforming XML data. XSLT is typically used to write style sheets to transform XML data to other formats such as HTML, fixed-length text, comma-separated text, or a different XML format. Although prohibited by default, you may choose to enable it for your project. +*XSLT* is a World Wide Web Consortium (W3C) standard for transforming XML data. XSLT is typically used to write style sheets to transform XML data to other formats such as HTML, fixed-length text, comma-separated text, or a different XML format. Although prohibited by default, you might choose to enable it for your project. To ensure you're not exposing an attack surface, this rule triggers whenever the XslCompiledTransform. receives insecure combination instances of and , which allows malicious script processing. ## How to fix violations -- Replace the insecure XsltSettings argument with XsltSettings. or with an instance that has disabled document function and script execution. - +- Replace the insecure `XsltSettings` argument with or with an instance that's disabled document function and script execution. - Replace the argument with null or an instance. ## When to suppress warnings @@ -153,6 +149,9 @@ namespace TestNamespace } ``` +> [!NOTE] +> Starting in .NET 10, the property is marked as obsolete and generates warning `SYSLIB0062`. On .NET (Core), it's no longer necessary to explicitly set this property to `false` since script execution isn't supported. + ## See also -- [XSLT Security Considerations(.NET Guide)](../../../standard/data/xml/xslt-security-considerations.md) +- [XSLT Security Considerations (.NET Guide)](../../../standard/data/xml/xslt-security-considerations.md) diff --git a/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md b/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md index 43e95dab5bb67..f6a8f835fbe53 100644 --- a/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md +++ b/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md @@ -82,6 +82,7 @@ The following table provides an index to the `SYSLIB0XXX` obsoletions in .NET 5+ | [SYSLIB0059](syslib0059.md) | Warning | callbacks aren't run before the process exits. Use instead. | | [SYSLIB0060](syslib0060.md) | Warning | Constructors on are obsolete. Use instead. | | [SYSLIB0061](syslib0061.md) | Warning | The `Queryable` and taking an `IComparer` are obsolete. Use the new ones that take an `IComparer`. | +| [SYSLIB0062](syslib0062.md) | Warning | is obsolete. | ## Suppress warnings diff --git a/docs/fundamentals/syslib-diagnostics/syslib0061.md b/docs/fundamentals/syslib-diagnostics/syslib0061.md index 6d35bf5e93396..06c3b3889a7a6 100644 --- a/docs/fundamentals/syslib-diagnostics/syslib0061.md +++ b/docs/fundamentals/syslib-diagnostics/syslib0061.md @@ -5,7 +5,7 @@ ms.date: 03/31/2025 f1_keywords: - SYSLIB0061 --- -# SYSLIB0061: System.Linq.Queryable.MaxBy and System.Linq.Queryable.MinBy taking an IComparer\ are obsolete. +# SYSLIB0061: System.Linq.Queryable.MaxBy and System.Linq.Queryable.MinBy taking an IComparer\ are obsolete Starting in .NET 10, the two extension methods and that accept an `IComparer` are obsolete. Please use the newly added overloads that accept an `IComparer` instead. diff --git a/docs/fundamentals/syslib-diagnostics/syslib0062.md b/docs/fundamentals/syslib-diagnostics/syslib0062.md new file mode 100644 index 0000000000000..22f0a1c44e5b1 --- /dev/null +++ b/docs/fundamentals/syslib-diagnostics/syslib0062.md @@ -0,0 +1,48 @@ +--- +title: SYSLIB0062 warning - XsltSettings.EnableScript is obsolete +description: Learn about the obsoletion of the XsltSettings.EnableScript property. Use of this property generates compile-time warning SYSLIB0062. +ms.date: 09/08/2025 +f1_keywords: + - SYSLIB0062 +--- +# SYSLIB0062: XsltSettings.EnableScript is obsolete + +Starting in .NET 10, the property is marked obsolete. + +## Reason for obsoletion + +XSLT script blocks aren't supported on .NET Core or .NET 5+. This obsoletion turns a run-time error into a build warning, which provides better guidance for migration. + +## Workaround + +Review call sites for any assumptions made about the behavior of this property. You can likely remove any references to the property since it didn't truly enable script blocks on modern .NET. + +## Suppress a warning + +If you must use the obsolete API, you can suppress the warning in code or in your project file. + +To suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the warning. + +```csharp +// Disable the warning. +#pragma warning disable SYSLIB0062 + +// Code that uses obsolete API. +// ... + +// Re-enable the warning. +#pragma warning restore SYSLIB0062 +``` + +To suppress all the `SYSLIB0062` warnings in your project, add a `` property to your project file. + +```xml + + + ... + $(NoWarn);SYSLIB0062 + + +``` + +For more information, see [Suppress warnings](obsoletions-overview.md#suppress-warnings). diff --git a/docs/navigate/tools-diagnostics/toc.yml b/docs/navigate/tools-diagnostics/toc.yml index 2220f172b118a..52b37667a3956 100644 --- a/docs/navigate/tools-diagnostics/toc.yml +++ b/docs/navigate/tools-diagnostics/toc.yml @@ -4022,6 +4022,8 @@ items: href: ../../fundamentals/syslib-diagnostics/syslib0060.md - name: SYSLIB0061 href: ../../fundamentals/syslib-diagnostics/syslib0061.md + - name: SYSLIB0062 + href: ../../fundamentals/syslib-diagnostics/syslib0062.md - name: Experimental features items: - name: Overview diff --git a/docs/standard/data/xml/script-blocks-using-msxsl-script.md b/docs/standard/data/xml/script-blocks-using-msxsl-script.md index 3cc2511be09d5..37a862edff588 100644 --- a/docs/standard/data/xml/script-blocks-using-msxsl-script.md +++ b/docs/standard/data/xml/script-blocks-using-msxsl-script.md @@ -7,24 +7,24 @@ dev_langs: - "vb" ms.assetid: fde6f43f-c594-486f-abcb-2211197fae20 --- -# Script Blocks Using msxsl:script +# Script blocks Using msxsl:script > [!NOTE] > Script blocks are supported only in .NET Framework. They are _not_ supported on .NET Core or .NET 5 or later. The class supports embedded scripts using the `msxsl:script` element. When the style sheet is loaded, any defined functions are compiled to common intermediate language (CIL) by the Code Document Object Model (CodeDOM) and are executed during run time. The assembly generated from the embedded script block is separate than the assembly generated for the style sheet. -## Enable XSLT Script +## Enable XSLT script Support for embedded scripts is an optional XSLT setting on the class. Script support is disabled by default. To enable script support, create an object with the property set to `true` and pass the object to the method. > [!WARNING] -> Starting in .NET 10, the property is marked as obsolete and generates warning SYSLIB0062. Since script blocks are not supported on .NET Core or .NET 5+, this property has no effect and setting it to `true` will throw a at runtime. +> Starting in .NET 10, the property is marked as obsolete and generates warning SYSLIB0062. Since script blocks aren't supported on .NET Core or .NET 5+, this property has no effect and setting it to `true` throws a at run time. > [!NOTE] > XSLT scripting should be enabled only if you require script support and you are working in a fully trusted environment. -## msxsl:script Element Definition +## msxsl:script element definition The `msxsl:script` element is a Microsoft extension to the XSLT 1.0 recommendation and has the following definition: @@ -49,25 +49,25 @@ Support for embedded scripts is an optional XSLT setting on the ``` -## Script Functions +## Script functions Functions can be declared within the `msxsl:script` element. When a function is declared, it is contained in a script block. Style sheets can contain multiple script blocks, each operating independent of the other. That means that if you are executing inside a script block, you cannot call a function that you defined in another script block unless it is declared to have the same namespace and the same scripting language. Because each script block can be in its own language, and the block is parsed according to the grammar rules of that language parser we recommend that you use the correct syntax for the language in use. For example, if you are in a Microsoft C# script block, use the C# comment syntax. The supplied arguments and return values to the function can be of any type. Because the W3C XPath types are a subset of the common language runtime (CLR) types, type conversion takes place on types that are not considered to be an XPath type. The following table shows the corresponding W3C types and the equivalent CLR type. -|W3C type|CLR type| -|--------------|--------------| -|`String`|| -|`Boolean`|| -|`Number`|| -|`Result Tree Fragment`|| -|`Node Set`|| +| W3C type | CLR type | +|------------------------|-------------------------------------------| +| `String` | | +| `Boolean` | | +| `Number` | | +| `Result Tree Fragment` | | +| `Node Set` | | CLR numeric types are converted to . The type is converted to . types are converted to . **XPathNavigator[]** is converted to . All other types throw an error. -### Importing Namespaces and Assemblies +### Import namespaces and assemblies The class predefines a set of assemblies and namespaces that are supported by default by the `msxsl:script` element. However, you can use classes and members belonging to a namespace that is not on the predefined list by importing the assembly and namespace in `msxsl:script` block. @@ -76,9 +76,7 @@ Support for embedded scripts is an optional XSLT setting on the Date: Mon, 8 Sep 2025 14:34:07 -0700 Subject: [PATCH 5/6] reset snippet files --- .../XslCompiledTransform.Load/CS/Xslt_Load_v2.cs | 4 ---- .../XslCompiledTransform.Load/VB/Xslt_Load_v2.vb | 4 ---- 2 files changed, 8 deletions(-) diff --git a/samples/snippets/csharp/VS_Snippets_Data/XslCompiledTransform.Load/CS/Xslt_Load_v2.cs b/samples/snippets/csharp/VS_Snippets_Data/XslCompiledTransform.Load/CS/Xslt_Load_v2.cs index 5c5971391b34c..7f798692cd58c 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/XslCompiledTransform.Load/CS/Xslt_Load_v2.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/XslCompiledTransform.Load/CS/Xslt_Load_v2.cs @@ -48,7 +48,6 @@ static void XslCompiledTransform_Load3() { XmlReader reader = XmlReader.Create("http://serverName/data/xsl/sort.xsl"); // Create the XsltSettings object with script enabled. -// Warning: Script enabling (true parameter) will be obsolete in .NET 10 XsltSettings settings = new XsltSettings(false,true); // Load the style sheet. @@ -96,7 +95,6 @@ static void XslCompiledTransform_Load5() { static void XslCompiledTransform_Load6() { // // Create the XsltSettings object with script enabled. -// Warning: Script enabling (true parameter) will be obsolete in .NET 10 XsltSettings settings = new XsltSettings(false,true); // Create the XslCompiledTransform object and load the style sheet. @@ -142,8 +140,6 @@ static void XslCompiledTransform_Load9() { // // Create the XsltSettings object with script enabled. XsltSettings settings = new XsltSettings(); -// Warning: Starting in .NET 10, EnableScript is obsolete (SYSLIB0062) -// and will throw PlatformNotSupportedException on .NET Core/.NET 5+ settings.EnableScript = true; // Create a resolver that will be used to resolve the style sheet. diff --git a/samples/snippets/visualbasic/VS_Snippets_Data/XslCompiledTransform.Load/VB/Xslt_Load_v2.vb b/samples/snippets/visualbasic/VS_Snippets_Data/XslCompiledTransform.Load/VB/Xslt_Load_v2.vb index 1728af05519c8..a16962ecd2914 100644 --- a/samples/snippets/visualbasic/VS_Snippets_Data/XslCompiledTransform.Load/VB/Xslt_Load_v2.vb +++ b/samples/snippets/visualbasic/VS_Snippets_Data/XslCompiledTransform.Load/VB/Xslt_Load_v2.vb @@ -50,7 +50,6 @@ Class XslCompiledTransformLoad Dim reader As XmlReader = XmlReader.Create("http://serverName/data/xsl/sort.xsl") ' Create the XsltSettings object with script enabled. - ' Warning: Script enabling (True parameter) will be obsolete in .NET 10 Dim settings As New XsltSettings(False, True) ' Load the style sheet. @@ -98,7 +97,6 @@ Class XslCompiledTransformLoad Shared Sub XslCompiledTransform_Load6() ' ' Create the XsltSettings object with script enabled. - ' Warning: Script enabling (True parameter) will be obsolete in .NET 10 Dim settings As New XsltSettings(False, True) ' Create the XslCompiledTransform object and load the style sheet. @@ -144,8 +142,6 @@ Class XslCompiledTransformLoad ' ' Create the XsltSettings object with script enabled. Dim settings As New XsltSettings() - ' Warning: Starting in .NET 10, EnableScript is obsolete (SYSLIB0062) - ' and will throw PlatformNotSupportedException on .NET Core/.NET 5+ settings.EnableScript = True ' Create a resolver that will be used to resolve the style sheet. From 73efdff177317a91455be3b135138fdf5099cf2e Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Mon, 8 Sep 2025 14:38:26 -0700 Subject: [PATCH 6/6] add exception info --- docs/fundamentals/syslib-diagnostics/syslib0062.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/fundamentals/syslib-diagnostics/syslib0062.md b/docs/fundamentals/syslib-diagnostics/syslib0062.md index 22f0a1c44e5b1..cd86fc86946bc 100644 --- a/docs/fundamentals/syslib-diagnostics/syslib0062.md +++ b/docs/fundamentals/syslib-diagnostics/syslib0062.md @@ -11,7 +11,7 @@ Starting in .NET 10, the was thrown at run time. This obsoletion turns a run-time error into a build warning, which provides better guidance for migration. ## Workaround