From f62abb152439b51019c26153861a2d49565c8e4e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Jun 2025 05:42:53 +0000 Subject: [PATCH 01/17] Initial plan for issue From bde6dadefe622845315507cb5f27a9bb6364583d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Jun 2025 05:49:59 +0000 Subject: [PATCH 02/17] Fix incorrect ThreeLetterWindowsLanguageName example for zh-Hant (CHT -> ZHH) Co-authored-by: jeffhandley <1031940+jeffhandley@users.noreply.github.com> --- .../System.Globalization/CultureInfo/DisplayName/getcultures.cs | 2 +- .../VB/getcultures.vb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs b/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs index 8dbea378b36..6b7bdfe766c 100644 --- a/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs +++ b/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs @@ -41,7 +41,7 @@ en en eng ENU English English es es spa ESP Spanish Spanish fi fi fin FIN Finnish Finnish zh zh zho CHS Chinese Chinese -zh-Hant zh zho CHT Chinese (Traditional) Chinese (Traditional) +zh-Hant zh zho ZHH Chinese (Traditional) Chinese (Traditional) zh-CHS zh zho CHS Chinese (Simplified) Legacy Chinese (Simplified) Legacy zh-CHT zh zho CHT Chinese (Traditional) Legacy Chinese (Traditional) Legacy diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb index c2e2d571fd7..04176c022dc 100644 --- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb +++ b/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb @@ -38,7 +38,7 @@ Module Module1 'es es spa ESP Spanish Spanish 'fi fi fin FIN Finnish Finnish 'zh zh zho CHS Chinese Chinese -'zh-Hant zh zho CHT Chinese (Traditional) Chinese (Traditional) +'zh-Hant zh zho ZHH Chinese (Traditional) Chinese (Traditional) 'zh-CHS zh zho CHS Chinese (Simplified) Legacy Chinese (Simplified) Legacy 'zh-CHT zh zho CHT Chinese (Traditional) Legacy Chinese (Traditional) Legacy From ac7824bc6f8199ad61437a1f84d7f513a0a38d2e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Jun 2025 06:24:06 +0000 Subject: [PATCH 03/17] Verify and fix all culture codes in documentation examples - confirmed zh-Hant fix and corrected zh-CHS/zh-CHT legacy culture display names Co-authored-by: jeffhandley <1031940+jeffhandley@users.noreply.github.com> --- .../CultureInfo/DisplayName/getcultures.cs | 4 ++-- .../VB/getcultures.vb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs b/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs index 6b7bdfe766c..a93aaeb57a3 100644 --- a/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs +++ b/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs @@ -42,8 +42,8 @@ es es spa ESP Spanish Spanish fi fi fin FIN Finnish Finnish zh zh zho CHS Chinese Chinese zh-Hant zh zho ZHH Chinese (Traditional) Chinese (Traditional) -zh-CHS zh zho CHS Chinese (Simplified) Legacy Chinese (Simplified) Legacy -zh-CHT zh zho CHT Chinese (Traditional) Legacy Chinese (Traditional) Legacy +zh-CHS zh zho CHS Chinese (Simplified) Chinese (CHS) +zh-CHT zh zho CHT Chinese (Traditional) Chinese (CHT) */ // diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb index 04176c022dc..336669b1515 100644 --- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb +++ b/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb @@ -39,8 +39,8 @@ Module Module1 'fi fi fin FIN Finnish Finnish 'zh zh zho CHS Chinese Chinese 'zh-Hant zh zho ZHH Chinese (Traditional) Chinese (Traditional) -'zh-CHS zh zho CHS Chinese (Simplified) Legacy Chinese (Simplified) Legacy -'zh-CHT zh zho CHT Chinese (Traditional) Legacy Chinese (Traditional) Legacy +'zh-CHS zh zho CHS Chinese (Simplified) Chinese (CHS) +'zh-CHT zh zho CHT Chinese (Traditional) Chinese (CHT) End Module ' From 7b4f79e20ec0c6320fc027788d98e1f925fa56ee Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Jun 2025 06:33:13 +0000 Subject: [PATCH 04/17] Fix spacing inconsistencies in culture code examples Co-authored-by: jeffhandley <1031940+jeffhandley@users.noreply.github.com> --- .../CultureInfo/DisplayName/getcultures.cs | 2 +- .../VB/getcultures.vb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs b/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs index a93aaeb57a3..2d6b70fcfe6 100644 --- a/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs +++ b/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs @@ -42,7 +42,7 @@ es es spa ESP Spanish Spanish fi fi fin FIN Finnish Finnish zh zh zho CHS Chinese Chinese zh-Hant zh zho ZHH Chinese (Traditional) Chinese (Traditional) -zh-CHS zh zho CHS Chinese (Simplified) Chinese (CHS) +zh-CHS zh zho CHS Chinese (Simplified) Chinese (CHS) zh-CHT zh zho CHT Chinese (Traditional) Chinese (CHT) */ diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb index 336669b1515..be51616c02a 100644 --- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb +++ b/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb @@ -39,8 +39,8 @@ Module Module1 'fi fi fin FIN Finnish Finnish 'zh zh zho CHS Chinese Chinese 'zh-Hant zh zho ZHH Chinese (Traditional) Chinese (Traditional) -'zh-CHS zh zho CHS Chinese (Simplified) Chinese (CHS) -'zh-CHT zh zho CHT Chinese (Traditional) Chinese (CHT) +'zh-CHS zh zho CHS Chinese (Simplified) Chinese (CHS) +'zh-CHT zh zho CHT Chinese (Traditional) Chinese (CHT) End Module ' From 48fe2080a799ac10feb85ab8e55557ec8688afe3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Jun 2025 06:45:06 +0000 Subject: [PATCH 05/17] Fix spacing in VB file line 43 to align with reference pattern Co-authored-by: jeffhandley <1031940+jeffhandley@users.noreply.github.com> --- .../System.Globalization/CultureInfo/DisplayName/getcultures.cs | 2 +- .../VB/getcultures.vb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs b/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs index 2d6b70fcfe6..44fb1a9c7a7 100644 --- a/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs +++ b/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs @@ -43,7 +43,7 @@ fi fi fin FIN Finnish Finnish zh zh zho CHS Chinese Chinese zh-Hant zh zho ZHH Chinese (Traditional) Chinese (Traditional) zh-CHS zh zho CHS Chinese (Simplified) Chinese (CHS) -zh-CHT zh zho CHT Chinese (Traditional) Chinese (CHT) +zh-CHT zh zho CHT Chinese (Traditional) Chinese (CHT) */ // diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb index be51616c02a..71c1acab561 100644 --- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb +++ b/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb @@ -40,7 +40,7 @@ Module Module1 'zh zh zho CHS Chinese Chinese 'zh-Hant zh zho ZHH Chinese (Traditional) Chinese (Traditional) 'zh-CHS zh zho CHS Chinese (Simplified) Chinese (CHS) -'zh-CHT zh zho CHT Chinese (Traditional) Chinese (CHT) +'zh-CHT zh zho CHT Chinese (Traditional) Chinese (CHT) End Module ' From e31b1d1e52d05f695888034d4a6161d32157c09f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Jun 2025 07:44:02 +0000 Subject: [PATCH 06/17] Remove zh-CHS and zh-CHT from neutral cultures example - these legacy cultures are not returned by GetCultures(CultureTypes.NeutralCultures) Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --- .../CultureInfo/DisplayName/getcultures.cs | 2 -- .../VB/getcultures.vb | 4 +--- xml/System.Globalization/CultureInfo.xml | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs b/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs index 44fb1a9c7a7..639bd85f782 100644 --- a/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs +++ b/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs @@ -42,8 +42,6 @@ es es spa ESP Spanish Spanish fi fi fin FIN Finnish Finnish zh zh zho CHS Chinese Chinese zh-Hant zh zho ZHH Chinese (Traditional) Chinese (Traditional) -zh-CHS zh zho CHS Chinese (Simplified) Chinese (CHS) -zh-CHT zh zho CHT Chinese (Traditional) Chinese (CHT) */ // diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb index 71c1acab561..274a65dacf6 100644 --- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb +++ b/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb @@ -38,9 +38,7 @@ Module Module1 'es es spa ESP Spanish Spanish 'fi fi fin FIN Finnish Finnish 'zh zh zho CHS Chinese Chinese -'zh-Hant zh zho ZHH Chinese (Traditional) Chinese (Traditional) -'zh-CHS zh zho CHS Chinese (Simplified) Chinese (CHS) -'zh-CHT zh zho CHT Chinese (Traditional) Chinese (CHT) +'zh-Hant zh zho ZHH Chinese (Traditional) Chinese (Traditional) End Module ' diff --git a/xml/System.Globalization/CultureInfo.xml b/xml/System.Globalization/CultureInfo.xml index b438608fc5f..0ffe5e67dd2 100644 --- a/xml/System.Globalization/CultureInfo.xml +++ b/xml/System.Globalization/CultureInfo.xml @@ -3378,7 +3378,7 @@ The following code example shows that CultureInfo.Clone also clones the [!NOTE] -> The example displays the older `zh-CHS` and `zh-CHT` culture names with the 0x0004 and 0x7C04 culture identifiers, respectively. However, your Windows Vista applications should use the `zh-Hans` name instead of zh-CHS and the `zh-Hant` name instead of zh-CHT. The `zh-Hans` and `zh-Hant` names represent the current standard, and should be used unless you have a reason for using the older names. +> The `zh-Hans` and `zh-Hant` names represent the current standard for Chinese cultures. Older applications may reference the legacy `zh-CHS` and `zh-CHT` culture names, but these should be replaced with `zh-Hans` and `zh-Hant` respectively in modern applications. :::code language="csharp" source="~/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb" id="Snippet1"::: From 3e3ca3212ac9fdaa020920f8219f92333ccf9641 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Jun 2025 07:56:10 +0000 Subject: [PATCH 07/17] Fix writing style and culture ordering issues - change 'may' to 'might', fix zh cultures ordering Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --- .../System.Globalization/CultureInfo/DisplayName/getcultures.cs | 2 +- .../VB/getcultures.vb | 2 +- xml/System.Globalization/CultureInfo.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs b/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs index 639bd85f782..1f8b8ca3880 100644 --- a/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs +++ b/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs @@ -32,7 +32,6 @@ CULTURE ISO ISO WIN DISPLAYNAME ENGLISHNAME ar ar ara ARA Arabic Arabic bg bg bul BGR Bulgarian Bulgarian ca ca cat CAT Catalan Catalan -zh-Hans zh zho CHS Chinese (Simplified) Chinese (Simplified) cs cs ces CSY Czech Czech da da dan DAN Danish Danish de de deu DEU German German @@ -41,6 +40,7 @@ en en eng ENU English English es es spa ESP Spanish Spanish fi fi fin FIN Finnish Finnish zh zh zho CHS Chinese Chinese +zh-Hans zh zho CHS Chinese (Simplified) Chinese (Simplified) zh-Hant zh zho ZHH Chinese (Traditional) Chinese (Traditional) */ diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb index 274a65dacf6..b745bd5519d 100644 --- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb +++ b/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb @@ -29,7 +29,6 @@ Module Module1 'ar ar ara ARA Arabic Arabic 'bg bg bul BGR Bulgarian Bulgarian 'ca ca cat CAT Catalan Catalan -'zh-Hans zh zho CHS Chinese (Simplified) Chinese (Simplified) 'cs cs ces CSY Czech Czech 'da da dan DAN Danish Danish 'de de deu DEU German German @@ -38,6 +37,7 @@ Module Module1 'es es spa ESP Spanish Spanish 'fi fi fin FIN Finnish Finnish 'zh zh zho CHS Chinese Chinese +'zh-Hans zh zho CHS Chinese (Simplified) Chinese (Simplified) 'zh-Hant zh zho ZHH Chinese (Traditional) Chinese (Traditional) End Module diff --git a/xml/System.Globalization/CultureInfo.xml b/xml/System.Globalization/CultureInfo.xml index 0ffe5e67dd2..8dc23575fda 100644 --- a/xml/System.Globalization/CultureInfo.xml +++ b/xml/System.Globalization/CultureInfo.xml @@ -3378,7 +3378,7 @@ The following code example shows that CultureInfo.Clone also clones the [!NOTE] -> The `zh-Hans` and `zh-Hant` names represent the current standard for Chinese cultures. Older applications may reference the legacy `zh-CHS` and `zh-CHT` culture names, but these should be replaced with `zh-Hans` and `zh-Hant` respectively in modern applications. +> The `zh-Hans` and `zh-Hant` names represent the current standard for Chinese cultures. Older applications might reference the legacy `zh-CHS` and `zh-CHT` culture names, but these should be replaced with `zh-Hans` and `zh-Hant` respectively in modern applications. :::code language="csharp" source="~/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb" id="Snippet1"::: From bc7a52049975808fcbf977491d4df91d5a47371d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marie=20P=C3=ADchov=C3=A1?= <11718369+ManickaP@users.noreply.github.com> Date: Thu, 19 Jun 2025 13:01:31 +0200 Subject: [PATCH 08/17] [HTTP] Example for WinHttpHandler.ServerCertificateValidationCallback (#11463) * Improve example for ServerCertificateValidationCallback * Update snippets/csharp/System.Net.Http/WinHttpHandler/program.cs Co-authored-by: Anton Firszov * Update xml/System.Net.Http/WinHttpHandler.xml Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> * Fixed sample * Change description with changed example --------- Co-authored-by: Anton Firszov Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- .../WinHttpHandler/Project.csproj | 12 ++++++++ .../System.Net.Http/WinHttpHandler/program.cs | 29 +++++++++++++++++++ xml/System.Net.Http/WinHttpHandler.xml | 9 +++++- 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 snippets/csharp/System.Net.Http/WinHttpHandler/Project.csproj create mode 100644 snippets/csharp/System.Net.Http/WinHttpHandler/program.cs diff --git a/snippets/csharp/System.Net.Http/WinHttpHandler/Project.csproj b/snippets/csharp/System.Net.Http/WinHttpHandler/Project.csproj new file mode 100644 index 00000000000..c99f5065527 --- /dev/null +++ b/snippets/csharp/System.Net.Http/WinHttpHandler/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net9.0 + + + + + + + \ No newline at end of file diff --git a/snippets/csharp/System.Net.Http/WinHttpHandler/program.cs b/snippets/csharp/System.Net.Http/WinHttpHandler/program.cs new file mode 100644 index 00000000000..47d739424ca --- /dev/null +++ b/snippets/csharp/System.Net.Http/WinHttpHandler/program.cs @@ -0,0 +1,29 @@ +using System; +using System.Net; +using System.Net.Http; +using System.Net.Security; + +class WinHttpHandler_SecureExample +{ + static void Main() + { + if (!OperatingSystem.IsWindows()) + { + Console.WriteLine("This example requires Windows."); + return; + } + // + var handler = new WinHttpHandler(); + handler.ServerCertificateValidationCallback = (httpRequestMessage, certificate, chain, sslPolicyErrors) => + { + if (sslPolicyErrors == SslPolicyErrors.None) + { + // TODO: Implement additional custom certificate validation logic here. + return true; + } + // Do not allow this client to communicate with unauthenticated servers. + return false; + }; + // + } +} diff --git a/xml/System.Net.Http/WinHttpHandler.xml b/xml/System.Net.Http/WinHttpHandler.xml index 13d3f0dfc25..6f311881e4c 100644 --- a/xml/System.Net.Http/WinHttpHandler.xml +++ b/xml/System.Net.Http/WinHttpHandler.xml @@ -740,13 +740,20 @@ When this property is set to `true`, all HTTP redirect responses from the server Gets or sets a callback method to validate the server certificate. This callback is part of the SSL handshake. - The callback should return if the server certificate is considered valid and the request should be sent. Otherwise, return . + The callback should return if the server certificate is considered valid and the request should be sent. Otherwise, returns . value returned by this delegate determines whether the authentication is allowed to succeed. + +## Examples + +The following code example implements the callback. If there are validation errors, this method returns `false` preventing communication with the unauthenticated server. Otherwise, it allows for additional validation and return `true` if the certificate is valid. + + :::code language="csharp" source="~/snippets/csharp/System.Net.Http/WinHttpHandler/program.cs" id="Snippet1"::: ]]> From ce615108ae225b4f6d4d54875f791be13d77ec74 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Jun 2025 15:38:14 +0000 Subject: [PATCH 09/17] Add comment explaining zh-Hant ICU vs NLS behavior difference Co-authored-by: tarekgh <10833894+tarekgh@users.noreply.github.com> --- .../System.Globalization/CultureInfo/DisplayName/getcultures.cs | 2 ++ .../VB/getcultures.vb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs b/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs index 1f8b8ca3880..9379c6bbbc4 100644 --- a/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs +++ b/snippets/csharp/System.Globalization/CultureInfo/DisplayName/getcultures.cs @@ -43,5 +43,7 @@ zh zh zho CHS Chinese Chinese zh-Hans zh zho CHS Chinese (Simplified) Chinese (Simplified) zh-Hant zh zho ZHH Chinese (Traditional) Chinese (Traditional) +Note: zh-Hant returns ZHH when using ICU (default). When NLS mode is enabled, it returns CHT. + */ // diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb index b745bd5519d..3b4c6c22f38 100644 --- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb +++ b/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/VB/getcultures.vb @@ -39,6 +39,8 @@ Module Module1 'zh zh zho CHS Chinese Chinese 'zh-Hans zh zho CHS Chinese (Simplified) Chinese (Simplified) 'zh-Hant zh zho ZHH Chinese (Traditional) Chinese (Traditional) +' +'Note: zh-Hant returns ZHH when using ICU (default). When NLS mode is enabled, it returns CHT. End Module ' From 6339fcaf94ef0853d620097a04469511d0ae32c9 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Jun 2025 18:38:15 +0200 Subject: [PATCH 10/17] Fix Utf8JsonWriter WriteXValue methods documentation to remove array-specific language (#11476) --- xml/System.Text.Json/Utf8JsonWriter.xml | 66 ++++++++++++------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/xml/System.Text.Json/Utf8JsonWriter.xml b/xml/System.Text.Json/Utf8JsonWriter.xml index dba64dd07f6..b7de000ea3e 100644 --- a/xml/System.Text.Json/Utf8JsonWriter.xml +++ b/xml/System.Text.Json/Utf8JsonWriter.xml @@ -781,8 +781,8 @@ The bytes are encoded before writing. - The binary data to be written as a Base64 encoded JSON string element of a JSON array. - Writes the raw bytes value as a Base64 encoded JSON string as an element of a JSON array. + The binary data to be written as a Base64 encoded JSON string. + Writes the raw bytes value as a Base64 encoded JSON string. - The value to be written as a JSON literal true or false as an element of a JSON array. - Writes a value (as a JSON literal true or false) as an element of a JSON array. + The value to be written as a JSON literal true or false. + Writes a value (as a JSON literal true or false). To be added. Validation is enabled, and the operation would result in writing invalid JSON. @@ -1381,7 +1381,7 @@ The property name should already be escaped when the instance of - Writes the JSON literal null as an element of a JSON array. + Writes the JSON literal null. To be added. Validation is enabled, and the operation would result in writing invalid JSON. @@ -2720,8 +2720,8 @@ The property name should already be escaped when the instance of - The value to be written as a JSON number as an element of a JSON array. - Writes a value (as a JSON number) as an element of a JSON array. + The value to be written as a JSON number. + Writes a value (as a JSON number). value using the default - The value to be written as a JSON number as an element of a JSON array. - Writes a value (as a JSON number) as an element of a JSON array. + The value to be written as a JSON number. + Writes a value (as a JSON number). value using the default - The value to be written as a JSON number as an element of a JSON array. - Writes an value (as a JSON number) as an element of a JSON array. + The value to be written as a JSON number. + Writes an value (as a JSON number). value using the default - The value to be written as a JSON number as an element of a JSON array. - Writes an value (as a JSON number) as an element of a JSON array. + The value to be written as a JSON number. + Writes an value (as a JSON number). value using the default - The value to be written as a JSON number as an element of a JSON array. - Writes a value (as a JSON number) as an element of a JSON array. + The value to be written as a JSON number. + Writes a value (as a JSON number). value using the default - The value to be written as a JSON number as an element of a JSON array. - Writes a value (as a JSON number) as an element of a JSON array. + The value to be written as a JSON number. + Writes a value (as a JSON number). value using the default - The value to be written as a JSON number as an element of a JSON array. - Writes a value (as a JSON number) as an element of a JSON array. + The value to be written as a JSON number. + Writes a value (as a JSON number). - The value to be written as a JSON string as an element of a JSON array. - Writes a value (as a JSON string) as an element of a JSON array. + The value to be written as a JSON string. + Writes a value (as a JSON string). - The value to be written as a JSON string as an element of a JSON array. - Writes a value (as a JSON string) as an element of a JSON array. + The value to be written as a JSON string. + Writes a value (as a JSON string). using the ISO 8601-1 extende - The value to be written as a JSON string as an element of a JSON array. - Writes a value (as a JSON string) as an element of a JSON array. + The value to be written as a JSON string. + Writes a value (as a JSON string). value using the default - The UTF-8 encoded value to be written as a JSON string element of a JSON array. - Writes a UTF-8 text value (as a JSON string) as an element of a JSON array. + The UTF-8 encoded value to be written as a JSON string. + Writes a UTF-8 text value (as a JSON string). - The UTF-16 encoded value to be written as a UTF-8 transcoded JSON string element of a JSON array. - Writes a UTF-16 text value (as a JSON string) as an element of a JSON array. + The UTF-16 encoded value to be written as a UTF-8 transcoded JSON string. + Writes a UTF-16 text value (as a JSON string). - The UTF-16 encoded value to be written as a UTF-8 transcoded JSON string element of a JSON array. - Writes a string text value (as a JSON string) as an element of a JSON array. + The UTF-16 encoded value to be written as a UTF-8 transcoded JSON string. + Writes a string text value (as a JSON string). - The JSON encoded value to be written as a UTF-8 transcoded JSON string element of a JSON array. - Writes the pre-encoded text value (as a JSON string) as an element of a JSON array. + The JSON encoded value to be written as a UTF-8 transcoded JSON string. + Writes the pre-encoded text value (as a JSON string). Date: Thu, 19 Jun 2025 14:58:54 -0400 Subject: [PATCH 11/17] Fix X509Certificate.GetSerialNumberString to indicate correct endianness. (#11486) --- .../X509Certificate.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xml/System.Security.Cryptography.X509Certificates/X509Certificate.xml b/xml/System.Security.Cryptography.X509Certificates/X509Certificate.xml index 676251844af..0d6e23e2cda 100644 --- a/xml/System.Security.Cryptography.X509Certificates/X509Certificate.xml +++ b/xml/System.Security.Cryptography.X509Certificates/X509Certificate.xml @@ -3308,8 +3308,8 @@ The output of this method is equivalent to the output of the - Returns the serial number of the X.509v3 certificate as a little-endian hexadecimal string . - The serial number of the X.509 certificate as a little-endian hexadecimal string. + Returns the serial number of the X.509v3 certificate as a big-endian hexadecimal string. + The serial number of the X.509 certificate as a big-endian hexadecimal string. Date: Thu, 19 Jun 2025 21:04:01 +0200 Subject: [PATCH 12/17] port some docs from intellisense (#11487) --- xml/System.Net/IPAddress.xml | 8 ++++---- xml/System.Net/IPNetwork.xml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/xml/System.Net/IPAddress.xml b/xml/System.Net/IPAddress.xml index d5a2fc31892..817e73e22e8 100644 --- a/xml/System.Net/IPAddress.xml +++ b/xml/System.Net/IPAddress.xml @@ -2721,10 +2721,10 @@ The scope identifier is > 0x00000000FFFFFFFF - To be added. - To be added. - To be added. - To be added. + The span of UTF-8 characters to parse. + An object that provides culture-specific formatting information about . + Parses a span of UTF-8 characters into a value. + The result of parsing . To be added. diff --git a/xml/System.Net/IPNetwork.xml b/xml/System.Net/IPNetwork.xml index 1f35931338e..22dc3281225 100644 --- a/xml/System.Net/IPNetwork.xml +++ b/xml/System.Net/IPNetwork.xml @@ -678,10 +678,10 @@ - To be added. - To be added. - To be added. - To be added. + The span of UTF-8 characters to parse. + An object that provides culture-specific formatting information about . + Parses a span of UTF-8 characters into a value. + The result of parsing . To be added. From 037167bb0d8b18368d75df572b5cc92dce878c50 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Jun 2025 18:46:37 -0700 Subject: [PATCH 13/17] Add format specifier documentation links to DebuggerDisplayAttribute properties (#11478) * Initial plan for issue * Add format specifier documentation links to DebuggerDisplayAttribute properties Co-authored-by: jeffhandley <1031940+jeffhandley@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jeffhandley <1031940+jeffhandley@users.noreply.github.com> --- .../DebuggerDisplayAttribute.xml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/xml/System.Diagnostics/DebuggerDisplayAttribute.xml b/xml/System.Diagnostics/DebuggerDisplayAttribute.xml index 199078b9bb8..abffb2f1703 100644 --- a/xml/System.Diagnostics/DebuggerDisplayAttribute.xml +++ b/xml/System.Diagnostics/DebuggerDisplayAttribute.xml @@ -212,7 +212,7 @@ class MyTable Gets or sets the string to display in the type column of the debugger variable windows. The string to display in the type column of the debugger variable windows. - To be added. + + + @@ -432,9 +439,11 @@ class MyTable +The value can contain curly braces ({ and }). Text within a pair of braces is evaluated as the name of a field, property, or method. You can also use format specifiers within the braces to control how values are displayed. For information about debugger format specifiers, see [Format Specifiers in C#](/visualstudio/debugger/format-specifiers-in-csharp). + +]]> From 6a1b0a7ef0077bffca0833a2b636d9665805caa5 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Jun 2025 18:51:15 -0700 Subject: [PATCH 14/17] Document Base64Url character encoding details in API reference (#11470) * Initial plan for issue * Add Base64Url character documentation explaining URL-safe encoding Co-authored-by: jeffhandley <1031940+jeffhandley@users.noreply.github.com> * Fix Base64Url capitalization inconsistency in documentation Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jeffhandley <1031940+jeffhandley@users.noreply.github.com> Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --- xml/System.Buffers.Text/Base64Url.xml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/xml/System.Buffers.Text/Base64Url.xml b/xml/System.Buffers.Text/Base64Url.xml index 5f70c246fb9..e215cd16231 100644 --- a/xml/System.Buffers.Text/Base64Url.xml +++ b/xml/System.Buffers.Text/Base64Url.xml @@ -27,7 +27,7 @@ Converts between binary data and URL-safe ASCII encoded text that's represented in Base64Url characters. - To be added. + Base64Url encoding uses the same alphabet as standard Base64 encoding, except that the characters '+' and '/' are replaced with '-' and '_' respectively to make the output URL-safe. @@ -373,7 +373,7 @@ The input span which contains binary data that needs to be encoded. Encodes the span of binary data into unicode ASCII chars represented as Base64Url. A char array which contains the result of the operation, i.e. the ASCII chars in Base64Url. - This implementation of the base64url encoding omits the optional padding characters. + This implementation of the Base64Url encoding omits the optional padding characters. The encoding uses '-' and '_' instead of the '+' and '/' characters used in standard Base64 encoding. @@ -406,7 +406,7 @@ The output span which contains the result of the operation, i.e. the ASCII chars in Base64Url. Encodes the span of binary data into Unicode ASCII chars represented as Base64Url. The number of bytes written into the destination span. This can be used to slice the output for subsequent calls, if necessary. - This implementation of the base64url encoding omits the optional padding characters. + This implementation of the Base64Url encoding omits the optional padding characters. The encoding uses '-' and '_' instead of the '+' and '/' characters used in standard Base64 encoding. The buffer in is too small to hold the encoded output. @@ -449,7 +449,7 @@ Encodes the span of binary data into unicode ASCII chars represented as Base64Url. One of the enumeration values that indicates the success or failure of the operation. - This implementation of the base64url encoding omits the optional padding characters. + This implementation of the Base64Url encoding omits the optional padding characters. The encoding uses '-' and '_' instead of the '+' and '/' characters used in standard Base64 encoding. @@ -486,7 +486,7 @@ The input span that contains binary data that needs to be encoded. Encodes the span of binary data into Unicode string represented as Base64Url ASCII chars. A string that contains the result of the operation, i.e. the ASCII string in Base64Url. - This implementation of the base64url encoding omits the optional padding characters. + This implementation of the Base64Url encoding omits the optional padding characters. The encoding uses '-' and '_' instead of the '+' and '/' characters used in standard Base64 encoding. @@ -523,7 +523,7 @@ The input span which contains binary data that needs to be encoded. Encodes the span of binary data into UTF-8 encoded text represented as Base64Url. The output byte array which contains the result of the operation, i.e. the UTF-8 encoded text in Base64Url. - This implementation of the base64url encoding omits the optional padding characters. + This implementation of the Base64Url encoding omits the optional padding characters. The encoding uses '-' and '_' instead of the '+' and '/' characters used in standard Base64 encoding. @@ -556,7 +556,7 @@ The output span which contains the result of the operation, i.e. the UTF-8 encoded text in Base64Url. Encodes the span of binary data into UTF-8 encoded text represented as Base64Url. The number of bytes written into the destination span. This can be used to slice the output for subsequent calls, if necessary. - This implementation of the base64url encoding omits the optional padding characters. + This implementation of the Base64Url encoding omits the optional padding characters. The encoding uses '-' and '_' instead of the '+' and '/' characters used in standard Base64 encoding. The buffer in is too small to hold the encoded output. @@ -599,7 +599,7 @@ Encodes the span of binary data into UTF-8 encoded text represented as Base64Url. One of the enumeration values that indicates the success or failure of the operation. - This implementation of the base64url encoding omits the optional padding characters. + This implementation of the Base64Url encoding omits the optional padding characters. The encoding uses '-' and '_' instead of the '+' and '/' characters used in standard Base64 encoding. @@ -926,7 +926,7 @@ Encodes the span of binary data into Unicode ASCII chars represented as Base64Url. if chars encoded successfully; if is too small. - This implementation of the base64url encoding omits the optional padding characters. + This implementation of the Base64Url encoding omits the optional padding characters. The encoding uses '-' and '_' instead of the '+' and '/' characters used in standard Base64 encoding. @@ -962,7 +962,7 @@ Encodes the span of binary data into UTF-8 encoded chars represented as Base64Url. if bytes encoded successfully; if is too small. - This implementation of the base64url encoding omits the optional padding characters. + This implementation of the Base64Url encoding omits the optional padding characters. The encoding uses '-' and '_' instead of the '+' and '/' characters used in standard Base64 encoding. @@ -1007,7 +1007,7 @@ if bytes encoded successfully; if is too small to fit the result. - This implementation of the base64url encoding omits the optional padding characters. + This implementation of the Base64Url encoding omits the optional padding characters. The encoding uses '-' and '_' instead of the '+' and '/' characters used in standard Base64 encoding. From e219a0bdb991f15c8591a99133abad5243520ae0 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Jun 2025 23:42:28 -0700 Subject: [PATCH 15/17] Document Unicode encoding behavior in Uri.GetLeftPart method (#11479) --- xml/System/Uri.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xml/System/Uri.xml b/xml/System/Uri.xml index c0cec77e4be..7b9fda102ac 100644 --- a/xml/System/Uri.xml +++ b/xml/System/Uri.xml @@ -2442,6 +2442,12 @@ If you used an escaped string to construct this instance (for example, `"http:// The method returns a string containing the leftmost portion of the URI string, ending with the portion specified by `part`. +> [!IMPORTANT] +> The method performs Unicode character encoding and normalization as part of its processing. It is not a simple string manipulation method. The returned string may differ from the original URI string due to this encoding behavior. + +The method is equivalent to calling with the appropriate flags. For example: +- `GetLeftPart(UriPartial.Authority)` is equivalent to `GetComponents(UriComponents.Scheme | UriComponents.UserInfo | UriComponents.Host | UriComponents.Port, UriFormat.UriEscaped)` + includes delimiters in the following cases: - includes the scheme delimiter. From 1bab5788dde353dfbe61a5d6fa5492ed7be6fb39 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Fri, 20 Jun 2025 08:50:36 +0200 Subject: [PATCH 16/17] add copilot instructions (#11484) --- .github/copilot-instructions.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 00000000000..683b79f69d9 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,17 @@ +Code comments should end with a period. + +When you add a code snippet to the XML remarks of an API, add the code as a separate code file (.cs file) and not as an inline (```) code block. Also add a .csproj file to compile the code if one doesn't already exist in the snippet folder. + +Don't use the word "may". Use "might" to indicate possibility or "can" to indicate permission. + +There should always be a comma before a clause that begins with "which". + +Use a conversational tone with contractions. + +Be concise. + +Break up long sentences. + +Use the present tense for instructions and descriptions. For example, "The method returns a value" instead of "The method will return a value." + +Use the Oxford comma in lists of three or more items. From 20a51c98045fb35bd24f39b370a184ebc84b59c5 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Jun 2025 08:52:05 +0200 Subject: [PATCH 17/17] Document ordering guarantee for X509Chain.ChainElements collection (#11475) --- .../Overview/chainelements-ordering.cs | 25 +++++++++++++++++++ .../X509Chain.xml | 6 ++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 snippets/csharp/System.Security.Cryptography.X509Certificates/X509Chain/Overview/chainelements-ordering.cs diff --git a/snippets/csharp/System.Security.Cryptography.X509Certificates/X509Chain/Overview/chainelements-ordering.cs b/snippets/csharp/System.Security.Cryptography.X509Certificates/X509Chain/Overview/chainelements-ordering.cs new file mode 100644 index 00000000000..8e0071a11e4 --- /dev/null +++ b/snippets/csharp/System.Security.Cryptography.X509Certificates/X509Chain/Overview/chainelements-ordering.cs @@ -0,0 +1,25 @@ +using System; +using System.Security.Cryptography.X509Certificates; + +public class ChainElementsOrdering +{ + public static void DemonstrateChainElementsOrdering(X509Certificate2 certificate) + { +// + using var chain = new X509Chain(); + chain.Build(certificate); + + // chain.ChainElements[0] is the leaf (end-entity) certificate + // chain.ChainElements[^1] is the root (trust anchor) certificate + + Console.WriteLine("Certificate chain from leaf to root:"); + for (int i = 0; i < chain.ChainElements.Count; i++) + { + var cert = chain.ChainElements[i].Certificate; + var role = i == 0 ? "Leaf" : + i == chain.ChainElements.Count - 1 ? "Root" : "Intermediate"; + Console.WriteLine($"[{i}] {role}: {cert.Subject}"); + } +// + } +} \ No newline at end of file diff --git a/xml/System.Security.Cryptography.X509Certificates/X509Chain.xml b/xml/System.Security.Cryptography.X509Certificates/X509Chain.xml index 7beb89f252b..6a66282b914 100644 --- a/xml/System.Security.Cryptography.X509Certificates/X509Chain.xml +++ b/xml/System.Security.Cryptography.X509Certificates/X509Chain.xml @@ -464,9 +464,13 @@ A chain element consists of an object, an structure, and an extra information string. - + The `ChainElements` collection is ordered from the end-entity (leaf) certificate at index 0, through any intermediate certificates, to the trust anchor (root certificate) at the final index. This ordering is consistent across all platforms. ## Examples +The following code example demonstrates the ordering of chain elements: + +:::code language="csharp" source="~/snippets/csharp/System.Security.Cryptography.X509Certificates/X509Chain/Overview/chainelements-ordering.cs" id="Snippet6"::: + The following code example opens the current user's personal certificate store, allows you to select a certificate, then writes certificate and certificate chain information to the console. The output depends on the certificate you select. :::code language="csharp" source="~/snippets/csharp/System.Security.Cryptography.X509Certificates/X509Chain/Overview/x509chaintest.cs" id="Snippet4":::