From edf9b481d3098a4b81ef15db95fb564dea5310e8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 9 Nov 2024 13:36:07 +0000 Subject: [PATCH 001/106] [main] Update dependencies from dotnet/runtime (#12456) [main] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 58 ++++++------- global.json | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 06a4accb66f..dd42f5d20b9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 - + https://github.com/dotnet/runtime - 39afeecbe46df74e86b74f644be042026d2031dc + 60b84bb13e499e0866731dbe21973b92b7abed15 diff --git a/eng/Versions.props b/eng/Versions.props index 17a78f8451c..a4a5b51cb44 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 - 10.0.0-alpha.1.24557.15 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24558.9 diff --git a/global.json b/global.json index 93da36b9519..fd0fc9c2239 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24557.1", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24557.1", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24557.15" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24558.9" }, "native-tools": { "cmake": "latest" From ea82b0acefede6fa404004a463f2aac91b05a438 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 10 Nov 2024 13:41:54 +0000 Subject: [PATCH 002/106] [main] Update dependencies from dotnet/arcade (#12457) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 24 ++++++++++++------------ eng/Versions.props | 6 +++--- global.json | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index dd42f5d20b9..eb91544c418 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -191,29 +191,29 @@ Note: if the Uri is a new place, you will need to add a subscription from that p - + https://github.com/dotnet/arcade - 39290b60a9015b444a1762d67e26f0f187eb5cc2 + 74ee04447a9882906e02bb135787ce2eca67ee67 - + https://github.com/dotnet/arcade - 39290b60a9015b444a1762d67e26f0f187eb5cc2 + 74ee04447a9882906e02bb135787ce2eca67ee67 - + https://github.com/dotnet/arcade - 39290b60a9015b444a1762d67e26f0f187eb5cc2 + 74ee04447a9882906e02bb135787ce2eca67ee67 - + https://github.com/dotnet/arcade - 39290b60a9015b444a1762d67e26f0f187eb5cc2 + 74ee04447a9882906e02bb135787ce2eca67ee67 - + https://github.com/dotnet/arcade - 39290b60a9015b444a1762d67e26f0f187eb5cc2 + 74ee04447a9882906e02bb135787ce2eca67ee67 - + https://github.com/dotnet/arcade - 39290b60a9015b444a1762d67e26f0f187eb5cc2 + 74ee04447a9882906e02bb135787ce2eca67ee67 diff --git a/eng/Versions.props b/eng/Versions.props index a4a5b51cb44..584ddf2edde 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -56,9 +56,9 @@ - 10.0.0-beta.24557.1 - 10.0.0-beta.24557.1 - 10.0.0-beta.24557.1 + 10.0.0-beta.24558.2 + 10.0.0-beta.24558.2 + 10.0.0-beta.24558.2 17.4.0-preview-20220707-01 diff --git a/global.json b/global.json index fd0fc9c2239..c7054ae20d6 100644 --- a/global.json +++ b/global.json @@ -14,9 +14,9 @@ "version": "9.0.100-rc.2.24474.12" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24557.1", - "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24557.1", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24557.1", + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24558.2", + "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24558.2", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24558.2", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24558.9" }, From fae358b66661ccf60d44119bf2e0cc87ce8c75d4 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 10 Nov 2024 13:42:24 +0000 Subject: [PATCH 003/106] [main] Update dependencies from dotnet/runtime (#12458) [main] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 58 ++++++------- global.json | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index eb91544c418..3af808c08f4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 - + https://github.com/dotnet/runtime - 60b84bb13e499e0866731dbe21973b92b7abed15 + 5db0ce0fa2e206da664498044af233a044f9aeb7 diff --git a/eng/Versions.props b/eng/Versions.props index 584ddf2edde..955c34231ca 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 - 10.0.0-alpha.1.24558.9 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.1 diff --git a/global.json b/global.json index c7054ae20d6..7b3de5375a2 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24558.2", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24558.2", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24558.9" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24560.1" }, "native-tools": { "cmake": "latest" From 92c7722105c686a7091379ea2d9fed256cfaad03 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 13:37:06 +0000 Subject: [PATCH 004/106] [main] Update dependencies from dotnet/arcade (#12459) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 24 +++++++++++------------ eng/Versions.props | 6 +++--- eng/common/native/install-dependencies.sh | 6 +++--- global.json | 6 +++--- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3af808c08f4..386f2876a73 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -191,29 +191,29 @@ Note: if the Uri is a new place, you will need to add a subscription from that p - + https://github.com/dotnet/arcade - 74ee04447a9882906e02bb135787ce2eca67ee67 + 232061b49ae2157efbb83acde9acae79ef3d6d40 - + https://github.com/dotnet/arcade - 74ee04447a9882906e02bb135787ce2eca67ee67 + 232061b49ae2157efbb83acde9acae79ef3d6d40 - + https://github.com/dotnet/arcade - 74ee04447a9882906e02bb135787ce2eca67ee67 + 232061b49ae2157efbb83acde9acae79ef3d6d40 - + https://github.com/dotnet/arcade - 74ee04447a9882906e02bb135787ce2eca67ee67 + 232061b49ae2157efbb83acde9acae79ef3d6d40 - + https://github.com/dotnet/arcade - 74ee04447a9882906e02bb135787ce2eca67ee67 + 232061b49ae2157efbb83acde9acae79ef3d6d40 - + https://github.com/dotnet/arcade - 74ee04447a9882906e02bb135787ce2eca67ee67 + 232061b49ae2157efbb83acde9acae79ef3d6d40 diff --git a/eng/Versions.props b/eng/Versions.props index 955c34231ca..6db4e89d5bb 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -56,9 +56,9 @@ - 10.0.0-beta.24558.2 - 10.0.0-beta.24558.2 - 10.0.0-beta.24558.2 + 10.0.0-beta.24560.1 + 10.0.0-beta.24560.1 + 10.0.0-beta.24560.1 17.4.0-preview-20220707-01 diff --git a/eng/common/native/install-dependencies.sh b/eng/common/native/install-dependencies.sh index 03e47c48ac9..6d1f8a94a68 100644 --- a/eng/common/native/install-dependencies.sh +++ b/eng/common/native/install-dependencies.sh @@ -24,13 +24,13 @@ case "$os" in apt update apt install -y build-essential gettext locales cmake llvm clang lld lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \ - libssl-dev libkrb5-dev zlib1g-dev pigz + libssl-dev libkrb5-dev zlib1g-dev pigz cpio localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 elif [ "$ID" = "fedora" ]; then - dnf install -y cmake llvm lld lldb clang python curl libicu-devel openssl-devel krb5-devel zlib-devel lttng-ust-devel pigz + dnf install -y cmake llvm lld lldb clang python curl libicu-devel openssl-devel krb5-devel zlib-devel lttng-ust-devel pigz cpio elif [ "$ID" = "alpine" ]; then - apk add build-base cmake bash curl clang llvm-dev lld lldb krb5-dev lttng-ust-dev icu-dev zlib-dev openssl-dev pigz + apk add build-base cmake bash curl clang llvm-dev lld lldb krb5-dev lttng-ust-dev icu-dev zlib-dev openssl-dev pigz cpio else echo "Unsupported distro. distro: $ID" exit 1 diff --git a/global.json b/global.json index 7b3de5375a2..040aa0762ad 100644 --- a/global.json +++ b/global.json @@ -14,9 +14,9 @@ "version": "9.0.100-rc.2.24474.12" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24558.2", - "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24558.2", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24558.2", + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24560.1", + "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24560.1", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24560.1", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24560.1" }, From a3973fb1bf608e4eedf109a8d7336968f348aa03 Mon Sep 17 00:00:00 2001 From: v-zhgl <38325459+Zheng-Li01@users.noreply.github.com> Date: Mon, 11 Nov 2024 17:46:07 +0000 Subject: [PATCH 005/106] Add code coverage for TrackBarRenderer (#12427) * Add code coverage for TrackBarRenderer * Handle FeedBacks * Handle FeedBacks * Handle FeedBacks * Handle FeedBacks --- .../Windows/Forms/TrackBarRendererTests.cs | 169 ++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/TrackBarRendererTests.cs diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/TrackBarRendererTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/TrackBarRendererTests.cs new file mode 100644 index 00000000000..60df8a21fbd --- /dev/null +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/TrackBarRendererTests.cs @@ -0,0 +1,169 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using System.Drawing; +using System.Windows.Forms.VisualStyles; + +namespace System.Windows.Forms.Tests; + +public class TrackBarRendererTests : IDisposable +{ + private readonly Bitmap _bitmap; + private readonly Graphics _graphics; + + public TrackBarRendererTests() + { + _bitmap = new(100, 100); + _graphics = Graphics.FromImage(_bitmap); + } + + public void Dispose() + { + _graphics.Dispose(); + _bitmap.Dispose(); + } + + [WinFormsFact] + public void IsSupported_ReturnsExpected() + { + bool isSupported = TrackBarRenderer.IsSupported; + isSupported.Should().Be(VisualStyleRenderer.IsSupported); + } + + [WinFormsFact] + public void DrawTrack_ValidParameters_DoesNotThrow() + { + void TestDrawTrack(Action drawTrack, Rectangle bounds) + { + Action a = () => drawTrack(_graphics, bounds); + a.Should().NotThrow(); + } + + TestDrawTrack(TrackBarRenderer.DrawHorizontalTrack, new Rectangle(0, 0, 100, 10)); + TestDrawTrack(TrackBarRenderer.DrawVerticalTrack, new Rectangle(0, 0, 10, 100)); + } + + [WinFormsFact] + public void DrawTrack_InvalidParameters_DoesNotThrow() + { + void TestDrawTrackWithInvalidBounds(Action drawTrack, Rectangle[] invalidBounds) + { + foreach (Rectangle bounds in invalidBounds) + { + Action a = () => drawTrack(_graphics, bounds); + a.Should().NotThrow(); + } + } + + var invalidBounds = new[] + { + new Rectangle(0, 0, 0, 10), + new Rectangle(0, 0, 100, 0), + new Rectangle(0, 0, -100, 10), + new Rectangle(0, 0, 100, -10) + }; + + TestDrawTrackWithInvalidBounds(TrackBarRenderer.DrawHorizontalTrack, invalidBounds); + TestDrawTrackWithInvalidBounds(TrackBarRenderer.DrawVerticalTrack, invalidBounds); + } + + [WinFormsFact] + public void DrawThumb_ValidParameters_DoesNotThrow() + { + void TestDrawThumb(Action drawThumb, Rectangle bounds, TrackBarThumbState state) + { + Action a = () => drawThumb(_graphics, bounds, state); + a.Should().NotThrow(); + } + + Rectangle bounds = new(0, 0, 10, 10); + TrackBarThumbState state = TrackBarThumbState.Normal; + + TestDrawThumb(TrackBarRenderer.DrawHorizontalThumb, bounds, state); + TestDrawThumb(TrackBarRenderer.DrawVerticalThumb, bounds, state); + } + + [WinFormsFact] + public void GetPointingThumbSize_ValidParameters_ReturnsExpected() + { + void TestGetThumbSize(Func getThumbSize) + { + Size size = getThumbSize(_graphics, TrackBarThumbState.Normal); + size.Should().NotBe(Size.Empty); + } + + TestGetThumbSize(TrackBarRenderer.GetLeftPointingThumbSize); + TestGetThumbSize(TrackBarRenderer.GetRightPointingThumbSize); + TestGetThumbSize(TrackBarRenderer.GetTopPointingThumbSize); + TestGetThumbSize(TrackBarRenderer.GetBottomPointingThumbSize); + } + + [WinFormsFact] + public void DrawTicks_ValidParameters_DoesNotThrow() + { + void TestDrawTicks(Action drawTicks, Rectangle bounds, int tickCount, EdgeStyle edgeStyle) + { + Action a = () => drawTicks(_graphics, bounds, tickCount, edgeStyle); + a.Should().NotThrow(); + } + + Rectangle horizontalBounds = new(0, 0, 100, 10); + Rectangle verticalBounds = new(0, 0, 10, 100); + int tickCount = 5; + EdgeStyle edgeStyle = EdgeStyle.Raised; + + TestDrawTicks(TrackBarRenderer.DrawHorizontalTicks, horizontalBounds, tickCount, edgeStyle); + TestDrawTicks(TrackBarRenderer.DrawVerticalTicks, verticalBounds, tickCount, edgeStyle); + } + + [WinFormsFact] + public void DrawTicks_InvalidParameters_DoesNotThrow() + { + void TestDrawTicksWithInvalidParameters(Action drawTicks, Rectangle bounds, int[] invalidTickCounts, Rectangle[] invalidBounds) + { + foreach (int count in invalidTickCounts) + { + Action a = () => drawTicks(_graphics, bounds, count, EdgeStyle.Raised); + a.Should().NotThrow(); + } + + foreach (Rectangle invalidBound in invalidBounds) + { + Action a = () => drawTicks(_graphics, invalidBound, 5, EdgeStyle.Raised); + a.Should().NotThrow(); + } + } + + Rectangle Bounds = new(0, 0, 100, 10); + int[] invalidTickCounts = [0, -1]; + Rectangle[] invalidBounds = + [ + new(0, 0, 0, 10), + new(0, 0, 100, 0) + ]; + + TestDrawTicksWithInvalidParameters(TrackBarRenderer.DrawHorizontalTicks, Bounds, invalidTickCounts, invalidBounds); + TestDrawTicksWithInvalidParameters(TrackBarRenderer.DrawVerticalTicks, Bounds, invalidTickCounts, invalidBounds); + } + + [WinFormsFact] + public void DrawPointingThumb_ValidParameters_DoesNotThrow() + { + Rectangle bounds = new(0, 0, 10, 10); + var drawThumbActions = new Action[] + { + TrackBarRenderer.DrawLeftPointingThumb, + TrackBarRenderer.DrawRightPointingThumb, + TrackBarRenderer.DrawTopPointingThumb, + TrackBarRenderer.DrawBottomPointingThumb + }; + + foreach (Action drawThumb in drawThumbActions) + { + Action a = () => drawThumb(_graphics, bounds, TrackBarThumbState.Normal); + a.Should().NotThrow(); + } + } +} From a19c602bc82279e12c6c4a01a6d68f7124516dc9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 13:37:09 +0000 Subject: [PATCH 006/106] [main] Update dependencies from dotnet/arcade (#12464) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 24 ++++++++++++------------ eng/Versions.props | 6 +++--- global.json | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 386f2876a73..67d8c4266eb 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -191,29 +191,29 @@ Note: if the Uri is a new place, you will need to add a subscription from that p - + https://github.com/dotnet/arcade - 232061b49ae2157efbb83acde9acae79ef3d6d40 + 32b8acf5b6f79e78a7cc5f7b7c619f68ff0c97ad - + https://github.com/dotnet/arcade - 232061b49ae2157efbb83acde9acae79ef3d6d40 + 32b8acf5b6f79e78a7cc5f7b7c619f68ff0c97ad - + https://github.com/dotnet/arcade - 232061b49ae2157efbb83acde9acae79ef3d6d40 + 32b8acf5b6f79e78a7cc5f7b7c619f68ff0c97ad - + https://github.com/dotnet/arcade - 232061b49ae2157efbb83acde9acae79ef3d6d40 + 32b8acf5b6f79e78a7cc5f7b7c619f68ff0c97ad - + https://github.com/dotnet/arcade - 232061b49ae2157efbb83acde9acae79ef3d6d40 + 32b8acf5b6f79e78a7cc5f7b7c619f68ff0c97ad - + https://github.com/dotnet/arcade - 232061b49ae2157efbb83acde9acae79ef3d6d40 + 32b8acf5b6f79e78a7cc5f7b7c619f68ff0c97ad diff --git a/eng/Versions.props b/eng/Versions.props index 6db4e89d5bb..f6133973275 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -56,9 +56,9 @@ - 10.0.0-beta.24560.1 - 10.0.0-beta.24560.1 - 10.0.0-beta.24560.1 + 10.0.0-beta.24561.1 + 10.0.0-beta.24561.1 + 10.0.0-beta.24561.1 17.4.0-preview-20220707-01 diff --git a/global.json b/global.json index 040aa0762ad..d53dc747966 100644 --- a/global.json +++ b/global.json @@ -14,9 +14,9 @@ "version": "9.0.100-rc.2.24474.12" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24560.1", - "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24560.1", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24560.1", + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24561.1", + "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24561.1", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24561.1", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24560.1" }, From f7a53322868ee629e8302198908b5412dcc554da Mon Sep 17 00:00:00 2001 From: Jeremy Kuhne Date: Tue, 12 Nov 2024 14:37:48 -0800 Subject: [PATCH 007/106] Remove CLSCompliant attribute (#12469) It doesn't really matter anymore and is creating extra maintenance cost as we add new APIs. Remove versioning.targets as it did very little and all over the override attributes. See a discussion on this here: https://github.com/dotnet/runtime/issues/44194 --- Directory.Build.targets | 5 ++- eng/versioning.targets | 35 --------------- .../VisualBasic/Devices/ComputerInfo.vb | 4 -- .../src/CompatibilitySuppressions.xml | 44 ++++++++++++++++++- .../src/Special/NotSupported.cs | 3 -- .../src/System.Drawing.Common.csproj | 1 - .../src/System/Drawing/Imaging/ColorMatrix.cs | 1 - .../System/Drawing/Imaging/ImageCodecInfo.cs | 2 - .../src/System.Windows.Forms.Design.csproj | 1 - .../src/System/Drawing/Design/BitmapEditor.cs | 1 - .../src/System/Drawing/Design/ColorEditor.cs | 1 - .../src/System/Drawing/Design/CursorEditor.cs | 1 - .../src/System/Drawing/Design/FontEditor.cs | 1 - .../src/System/Drawing/Design/ImageEditor.cs | 1 - .../System/Drawing/Design/MetafileEditor.cs | 1 - .../Windows/Forms/Design/AnchorEditor.cs | 1 - .../Windows/Forms/Design/BorderSidesEditor.cs | 1 - .../Windows/Forms/Design/ComponentTray.cs | 2 - .../Forms/Design/CompositionDesigner.cs | 1 - .../System/Windows/Forms/Design/DockEditor.cs | 1 - .../Windows/Forms/Design/FileNameEditor.cs | 1 - .../Windows/Forms/Design/FolderNameEditor.cs | 1 - .../Forms/Design/ImageListImageEditor.cs | 1 - .../Forms/Design/ParentControlDesigner.cs | 4 -- .../Forms/Design/ShortcutKeysEditor.cs | 1 - .../System.Windows.Forms.Primitives.csproj | 1 - .../src/System.Windows.Forms.csproj | 1 - .../System/Windows/Forms/ActiveX/AxHost.cs | 2 - .../Windows/Forms/OLE/DataObject.DataStore.cs | 26 +++++------ 29 files changed, 60 insertions(+), 86 deletions(-) delete mode 100644 eng/versioning.targets diff --git a/Directory.Build.targets b/Directory.Build.targets index dc33b70b526..f5b1b4272f6 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -3,9 +3,12 @@ - + + $(AssemblyName) + + diff --git a/eng/versioning.targets b/eng/versioning.targets deleted file mode 100644 index 321b0599d4f..00000000000 --- a/eng/versioning.targets +++ /dev/null @@ -1,35 +0,0 @@ - - - true - - - - $(IntermediateOutputPath)_AssemblyInfo.g.cs - - - - $(AssemblyName) - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Devices/ComputerInfo.vb b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Devices/ComputerInfo.vb index d3552a0efab..6dfcf883681 100644 --- a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Devices/ComputerInfo.vb +++ b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Devices/ComputerInfo.vb @@ -47,7 +47,6 @@ Namespace Microsoft.VisualBasic.Devices ''' ''' Throw if we are unable to obtain the memory status. ''' - Public ReadOnly Property AvailablePhysicalMemory() As UInt64 Get Return MemoryStatus.AvailablePhysicalMemory @@ -64,7 +63,6 @@ Namespace Microsoft.VisualBasic.Devices ''' ''' Throw if we are unable to obtain the memory status. ''' - Public ReadOnly Property AvailableVirtualMemory() As UInt64 Get Return MemoryStatus.AvailableVirtualMemory @@ -131,7 +129,6 @@ Namespace Microsoft.VisualBasic.Devices ''' ''' Throw if we are unable to obtain the memory status. ''' - Public ReadOnly Property TotalPhysicalMemory() As UInt64 Get Return MemoryStatus.TotalPhysicalMemory @@ -148,7 +145,6 @@ Namespace Microsoft.VisualBasic.Devices ''' ''' Throw if we are unable to obtain the memory status. ''' - Public ReadOnly Property TotalVirtualMemory() As UInt64 Get Return MemoryStatus.TotalVirtualMemory diff --git a/src/System.Drawing.Common/src/CompatibilitySuppressions.xml b/src/System.Drawing.Common/src/CompatibilitySuppressions.xml index ef75f17f963..521f4adba7b 100644 --- a/src/System.Drawing.Common/src/CompatibilitySuppressions.xml +++ b/src/System.Drawing.Common/src/CompatibilitySuppressions.xml @@ -1,5 +1,5 @@  - + CP0002 @@ -25,6 +25,13 @@ lib/netstandard2.0/System.Drawing.Common.dll lib/net462/System.Drawing.Common.dll + + CP0014 + M:System.Drawing.Imaging.ColorMatrix.#ctor(System.Single[][]):[T:System.CLSCompliantAttribute] + lib/net8.0/System.Drawing.Common.dll + lib/net8.0/System.Drawing.Common.dll + true + CP0014 M:System.Drawing.Printing.PrintPageEventArgs.get_Graphics:[T:System.Runtime.CompilerServices.NullableContextAttribute] @@ -32,6 +39,20 @@ lib/net8.0/System.Drawing.Common.dll true + + CP0014 + P:System.Drawing.Imaging.ImageCodecInfo.SignatureMasks:[T:System.CLSCompliantAttribute] + lib/net8.0/System.Drawing.Common.dll + lib/net8.0/System.Drawing.Common.dll + true + + + CP0014 + P:System.Drawing.Imaging.ImageCodecInfo.SignaturePatterns:[T:System.CLSCompliantAttribute] + lib/net8.0/System.Drawing.Common.dll + lib/net8.0/System.Drawing.Common.dll + true + CP0014 P:System.Drawing.Printing.PrintPageEventArgs.Graphics:[T:System.Runtime.CompilerServices.NullableAttribute] @@ -123,6 +144,27 @@ lib/net8.0/System.Drawing.Common.dll true + + CP0014 + M:System.Drawing.Imaging.ColorMatrix.#ctor(System.Single[][]):[T:System.CLSCompliantAttribute] + lib/netstandard2.0/System.Drawing.Common.dll + lib/netstandard2.0/System.Drawing.Common.dll + true + + + CP0014 + P:System.Drawing.Imaging.ImageCodecInfo.SignatureMasks:[T:System.CLSCompliantAttribute] + lib/netstandard2.0/System.Drawing.Common.dll + lib/netstandard2.0/System.Drawing.Common.dll + true + + + CP0014 + P:System.Drawing.Imaging.ImageCodecInfo.SignaturePatterns:[T:System.CLSCompliantAttribute] + lib/netstandard2.0/System.Drawing.Common.dll + lib/netstandard2.0/System.Drawing.Common.dll + true + CP0015 T:System.Drawing.Printing.PrintPageEventArgs:[T:System.Runtime.CompilerServices.NullableContextAttribute] diff --git a/src/System.Drawing.Common/src/Special/NotSupported.cs b/src/System.Drawing.Common/src/Special/NotSupported.cs index 4a8321c0b36..b3fbf98babd 100644 --- a/src/System.Drawing.Common/src/Special/NotSupported.cs +++ b/src/System.Drawing.Common/src/Special/NotSupported.cs @@ -1976,7 +1976,6 @@ public enum ColorMapType public sealed partial class ColorMatrix { public ColorMatrix() { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } - [System.CLSCompliantAttribute(false)] public ColorMatrix(float[][] newColorMatrix) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } public float this[int row, int column] { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } set { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } public float Matrix00 { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } set { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } @@ -2473,9 +2472,7 @@ public sealed partial class ImageCodecInfo public string? FormatDescription { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } set { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } public System.Guid FormatID { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } set { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } public string? MimeType { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } set { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } - [System.CLSCompliantAttribute(false)] public byte[][]? SignatureMasks { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } set { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } - [System.CLSCompliantAttribute(false)] public byte[][]? SignaturePatterns { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } set { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } public int Version { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } set { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } public static System.Drawing.Imaging.ImageCodecInfo[] GetImageDecoders() { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } diff --git a/src/System.Drawing.Common/src/System.Drawing.Common.csproj b/src/System.Drawing.Common/src/System.Drawing.Common.csproj index 25aea9c4d95..4d1825db612 100644 --- a/src/System.Drawing.Common/src/System.Drawing.Common.csproj +++ b/src/System.Drawing.Common/src/System.Drawing.Common.csproj @@ -9,7 +9,6 @@ false enable disable - true true true true diff --git a/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorMatrix.cs b/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorMatrix.cs index 599d3ff0d16..aa5a4e1cb49 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorMatrix.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorMatrix.cs @@ -299,7 +299,6 @@ public float Matrix44 /// /// Initializes a new instance of the class with the elements in the specified matrix. /// - [CLSCompliant(false)] public ColorMatrix(float[][] newColorMatrix) { _matrix00 = newColorMatrix[0][0]; diff --git a/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageCodecInfo.cs b/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageCodecInfo.cs index c5a6131a14d..c6bc6cd819a 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageCodecInfo.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageCodecInfo.cs @@ -28,10 +28,8 @@ internal ImageCodecInfo() public int Version { get; set; } - [CLSCompliant(false)] public byte[][]? SignaturePatterns { get; set; } - [CLSCompliant(false)] public byte[][]? SignatureMasks { get; set; } // Encoder/Decoder selection APIs diff --git a/src/System.Windows.Forms.Design/src/System.Windows.Forms.Design.csproj b/src/System.Windows.Forms.Design/src/System.Windows.Forms.Design.csproj index 74ac5d4b609..d9ace26472a 100644 --- a/src/System.Windows.Forms.Design/src/System.Windows.Forms.Design.csproj +++ b/src/System.Windows.Forms.Design/src/System.Windows.Forms.Design.csproj @@ -2,7 +2,6 @@ System.Windows.Forms.Design - true true true enable diff --git a/src/System.Windows.Forms.Design/src/System/Drawing/Design/BitmapEditor.cs b/src/System.Windows.Forms.Design/src/System/Drawing/Design/BitmapEditor.cs index bc635b861a8..49458c97ef4 100644 --- a/src/System.Windows.Forms.Design/src/System/Drawing/Design/BitmapEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Drawing/Design/BitmapEditor.cs @@ -7,7 +7,6 @@ namespace System.Drawing.Design; /// Provides an editor that can perform default file searching for bitmap (.bmp) /// files. /// -[CLSCompliant(false)] public class BitmapEditor : ImageEditor { protected static List BitmapExtensions = ["bmp", "gif", "jpg", "jpeg", "png", "ico"]; diff --git a/src/System.Windows.Forms.Design/src/System/Drawing/Design/ColorEditor.cs b/src/System.Windows.Forms.Design/src/System/Drawing/Design/ColorEditor.cs index a6de6e142a2..6741c91e659 100644 --- a/src/System.Windows.Forms.Design/src/System/Drawing/Design/ColorEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Drawing/Design/ColorEditor.cs @@ -10,7 +10,6 @@ namespace System.Drawing.Design; /// /// Provides an editor for visually picking a color. /// -[CLSCompliant(false)] public partial class ColorEditor : UITypeEditor { /// diff --git a/src/System.Windows.Forms.Design/src/System/Drawing/Design/CursorEditor.cs b/src/System.Windows.Forms.Design/src/System/Drawing/Design/CursorEditor.cs index b3a5937aba9..a531476cd0f 100644 --- a/src/System.Windows.Forms.Design/src/System/Drawing/Design/CursorEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Drawing/Design/CursorEditor.cs @@ -9,7 +9,6 @@ namespace System.Drawing.Design; /// /// Provides an editor that can perform default file searching for cursor (.cur) files. /// -[CLSCompliant(false)] public partial class CursorEditor : UITypeEditor { private CursorUI? _cursorUI; diff --git a/src/System.Windows.Forms.Design/src/System/Drawing/Design/FontEditor.cs b/src/System.Windows.Forms.Design/src/System/Drawing/Design/FontEditor.cs index 9f9ba551aef..4bd3e80f730 100644 --- a/src/System.Windows.Forms.Design/src/System/Drawing/Design/FontEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Drawing/Design/FontEditor.cs @@ -10,7 +10,6 @@ namespace System.Drawing.Design; /// /// Provides a font editor that is used to visually select and configure a Font object. /// -[CLSCompliant(false)] public class FontEditor : UITypeEditor { private FontDialog? _fontDialog; diff --git a/src/System.Windows.Forms.Design/src/System/Drawing/Design/ImageEditor.cs b/src/System.Windows.Forms.Design/src/System/Drawing/Design/ImageEditor.cs index 0076eb366db..218986c6009 100644 --- a/src/System.Windows.Forms.Design/src/System/Drawing/Design/ImageEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Drawing/Design/ImageEditor.cs @@ -12,7 +12,6 @@ namespace System.Drawing.Design; /// /// Provides an editor for visually picking an image. /// -[CLSCompliant(false)] public class ImageEditor : UITypeEditor { private static readonly Type[] s_imageExtenders = [typeof(BitmapEditor), typeof(MetafileEditor)]; diff --git a/src/System.Windows.Forms.Design/src/System/Drawing/Design/MetafileEditor.cs b/src/System.Windows.Forms.Design/src/System/Drawing/Design/MetafileEditor.cs index a789af8f4fa..a28e719e723 100644 --- a/src/System.Windows.Forms.Design/src/System/Drawing/Design/MetafileEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Drawing/Design/MetafileEditor.cs @@ -8,7 +8,6 @@ namespace System.Drawing.Design; /// /// Extends Image's editor class to provide default file searching for metafile (.emf) files. /// -[CLSCompliant(false)] public class MetafileEditor : ImageEditor { protected override string GetFileDialogDescription() => SR.metafileFileDescription; diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/AnchorEditor.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/AnchorEditor.cs index 566452fcc52..204c3bf3f98 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/AnchorEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/AnchorEditor.cs @@ -9,7 +9,6 @@ namespace System.Windows.Forms.Design; /// /// Provides a design-time editor for specifying the property. /// -[CLSCompliant(false)] public sealed partial class AnchorEditor : UITypeEditor { private AnchorUI? _anchorUI; diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/BorderSidesEditor.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/BorderSidesEditor.cs index 86601d714f9..803bcbe564c 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/BorderSidesEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/BorderSidesEditor.cs @@ -9,7 +9,6 @@ namespace System.Windows.Forms.Design; /// /// Provides an editor for setting the ToolStripStatusLabel BorderSides property.. /// -[CLSCompliant(false)] public partial class BorderSidesEditor : UITypeEditor { private BorderSidesEditorUI? _borderSidesEditorUI; diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ComponentTray.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ComponentTray.cs index 067f443f996..f709f3b7139 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ComponentTray.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ComponentTray.cs @@ -745,7 +745,6 @@ public virtual void AddComponent(IComponent component) } } - [CLSCompliant(false)] protected virtual bool CanCreateComponentFromTool(ToolboxItem tool) { IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); @@ -813,7 +812,6 @@ protected virtual bool CanDisplayComponent(IComponent component) return TypeDescriptor.GetAttributes(component).Contains(DesignTimeVisibleAttribute.Yes); } - [CLSCompliant(false)] public void CreateComponentFromTool(ToolboxItem tool) { if (!CanCreateComponentFromTool(tool)) diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/CompositionDesigner.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/CompositionDesigner.cs index 3f1365b0e3a..04e858a3291 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/CompositionDesigner.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/CompositionDesigner.cs @@ -125,7 +125,6 @@ protected override void Dispose(bool disposing) /// Gets a value indicating whether the specified tool is supported by this /// designer. /// - [CLSCompliant(false)] protected virtual bool GetToolSupported(ToolboxItem tool) { throw new NotImplementedException(SR.NotImplementedByDesign); diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DockEditor.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DockEditor.cs index d2556254817..d8222031614 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DockEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DockEditor.cs @@ -9,7 +9,6 @@ namespace System.Windows.Forms.Design; /// /// Implements the design time editor for specifying the property. /// -[CLSCompliant(false)] public sealed partial class DockEditor : UITypeEditor { private DockUI? _dockUI; diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/FileNameEditor.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/FileNameEditor.cs index f22eaec150c..7ed6ecfd513 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/FileNameEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/FileNameEditor.cs @@ -9,7 +9,6 @@ namespace System.Windows.Forms.Design; /// /// Provides an editor for filenames. /// -[CLSCompliant(false)] public class FileNameEditor : UITypeEditor { private OpenFileDialog? _openFileDialog; diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/FolderNameEditor.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/FolderNameEditor.cs index 49c1d937950..77dc10325a5 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/FolderNameEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/FolderNameEditor.cs @@ -9,7 +9,6 @@ namespace System.Windows.Forms.Design; /// /// Provides an editor for choosing a folder from the filesystem. /// -[CLSCompliant(false)] public partial class FolderNameEditor : UITypeEditor { private FolderBrowser? _folderBrowser; diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ImageListImageEditor.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ImageListImageEditor.cs index 029d5e5bc94..c084c02a953 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ImageListImageEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ImageListImageEditor.cs @@ -11,7 +11,6 @@ namespace System.Windows.Forms.Design; /// /// Provides an editor that can perform default file searching for bitmap (.bmp) files. /// -[CLSCompliant(false)] public class ImageListImageEditor : ImageEditor { // Metafile types are not supported in the ImageListImageEditor and should not be displayed as an option. diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ParentControlDesigner.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ParentControlDesigner.cs index 188d78f9b40..004642a35ec 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ParentControlDesigner.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ParentControlDesigner.cs @@ -280,7 +280,6 @@ protected Size GridSize /// This property is used by deriving classes to determine if the designer is /// in a state where it has a valid MouseDragTool. /// - [CLSCompliant(false)] protected ToolboxItem MouseDragTool => _mouseDragTool; /// @@ -796,7 +795,6 @@ protected void CreateTool(ToolboxItem tool) /// Creates the given tool in the currently selected control at the /// given position. The default size for the tool is used. /// - [CLSCompliant(false)] protected void CreateTool(ToolboxItem tool, Point location) { CreateToolCore(tool, location.X, location.Y, 0, 0, true, false); @@ -806,7 +804,6 @@ protected void CreateTool(ToolboxItem tool, Point location) /// Creates the given tool in the currently selected control. The /// tool is created with the provided shape. /// - [CLSCompliant(false)] protected void CreateTool(ToolboxItem tool, Rectangle bounds) { CreateToolCore(tool, bounds.X, bounds.Y, bounds.Width, bounds.Height, true, true); @@ -816,7 +813,6 @@ protected void CreateTool(ToolboxItem tool, Rectangle bounds) /// This is the worker method of all CreateTool methods. It is the only one /// that can be overridden. /// - [CLSCompliant(false)] protected virtual IComponent[] CreateToolCore(ToolboxItem tool, int x, int y, int width, int height, bool hasLocation, bool hasSize) { IComponent[] comp = null; diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ShortcutKeysEditor.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ShortcutKeysEditor.cs index c8651883043..83dc2d5072f 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ShortcutKeysEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ShortcutKeysEditor.cs @@ -10,7 +10,6 @@ namespace System.Windows.Forms.Design; /// /// Provides an editor for picking shortcut keys. /// -[CLSCompliant(false)] public partial class ShortcutKeysEditor : UITypeEditor { private ShortcutKeysUI? _shortcutKeysUI; diff --git a/src/System.Windows.Forms.Primitives/src/System.Windows.Forms.Primitives.csproj b/src/System.Windows.Forms.Primitives/src/System.Windows.Forms.Primitives.csproj index c05a1eb50a1..58876a64667 100644 --- a/src/System.Windows.Forms.Primitives/src/System.Windows.Forms.Primitives.csproj +++ b/src/System.Windows.Forms.Primitives/src/System.Windows.Forms.Primitives.csproj @@ -3,7 +3,6 @@ System.Windows.Forms.Primitives true - true enable - + https://github.com/dotnet/arcade - 32b8acf5b6f79e78a7cc5f7b7c619f68ff0c97ad + e882d5925ca55013d5810ac51e36574a65c5da84 - + https://github.com/dotnet/arcade - 32b8acf5b6f79e78a7cc5f7b7c619f68ff0c97ad + e882d5925ca55013d5810ac51e36574a65c5da84 - + https://github.com/dotnet/arcade - 32b8acf5b6f79e78a7cc5f7b7c619f68ff0c97ad + e882d5925ca55013d5810ac51e36574a65c5da84 - + https://github.com/dotnet/arcade - 32b8acf5b6f79e78a7cc5f7b7c619f68ff0c97ad + e882d5925ca55013d5810ac51e36574a65c5da84 - + https://github.com/dotnet/arcade - 32b8acf5b6f79e78a7cc5f7b7c619f68ff0c97ad + e882d5925ca55013d5810ac51e36574a65c5da84 - + https://github.com/dotnet/arcade - 32b8acf5b6f79e78a7cc5f7b7c619f68ff0c97ad + e882d5925ca55013d5810ac51e36574a65c5da84 diff --git a/eng/Versions.props b/eng/Versions.props index f6133973275..c5a4bd70ed9 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -56,9 +56,9 @@ - 10.0.0-beta.24561.1 - 10.0.0-beta.24561.1 - 10.0.0-beta.24561.1 + 10.0.0-beta.24562.15 + 10.0.0-beta.24562.15 + 10.0.0-beta.24562.15 17.4.0-preview-20220707-01 diff --git a/global.json b/global.json index d53dc747966..44691b5eeee 100644 --- a/global.json +++ b/global.json @@ -14,9 +14,9 @@ "version": "9.0.100-rc.2.24474.12" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24561.1", - "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24561.1", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24561.1", + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24562.15", + "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24562.15", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24562.15", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24560.1" }, From 8d8deef5fbb3047d18668c140062a1df2dea7a37 Mon Sep 17 00:00:00 2001 From: Jeremy Kuhne Date: Wed, 13 Nov 2024 08:54:58 -0800 Subject: [PATCH 010/106] Error interop tweaks (#12470) Adds some macros that WPF needs, and moves NTSTATUS to the core assembly. --- .../src/NativeMethods.txt | 7 ++++++ .../src/Windows/Win32/Foundation/HRESULT.cs | 25 ++++++++++++++++++- .../src/NativeMethods.txt | 5 ---- .../CommonDialogs/FolderBrowserDialog.cs | 2 +- 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/System.Private.Windows.Core/src/NativeMethods.txt b/src/System.Private.Windows.Core/src/NativeMethods.txt index 41354b135f7..0786250e091 100644 --- a/src/System.Private.Windows.Core/src/NativeMethods.txt +++ b/src/System.Private.Windows.Core/src/NativeMethods.txt @@ -69,6 +69,7 @@ EnumChildWindows EnumDisplayMonitors EnumThreadWindows EnumWindows +FACILITY_CODE fdex* FDEX_PROP_FLAGS FILETIME @@ -166,7 +167,9 @@ MonitorFromWindow MONITORINFOEXW MONITORINFOF_* NONCLIENTMETRICSW +NTSTATUS OBJ_TYPE +OBJECT_IDENTIFIER OffsetViewportOrgEx OLE_E_ADVISENOTSUPPORTED OLE_E_INVALIDRECT @@ -214,11 +217,15 @@ SetTextAlign SetTextColor START_PAGE_GENERAL STATFLAG +STATUS_NO_MEMORY +STATUS_PENDING +STATUS_SUCCESS STG_E_FILENOTFOUND STG_E_INVALIDFLAG STG_E_INVALIDFUNCTION STG_E_INVALIDPOINTER STGTY +STILL_ACTIVE SystemParametersInfo SystemParametersInfoForDpi TYPE_E_BADMODULEKIND diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Foundation/HRESULT.cs b/src/System.Private.Windows.Core/src/Windows/Win32/Foundation/HRESULT.cs index df238605b58..d296a94dfae 100644 --- a/src/System.Private.Windows.Core/src/Windows/Win32/Foundation/HRESULT.cs +++ b/src/System.Private.Windows.Core/src/Windows/Win32/Foundation/HRESULT.cs @@ -1,11 +1,34 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using Windows.Win32.System.Diagnostics.Debug; + namespace Windows.Win32.Foundation; internal readonly partial struct HRESULT { - public static HRESULT HRESULT_FROM_WIN32(WIN32_ERROR error) + /// + /// Extracts the facility code of the HRESULT. [HRESULT_FACILITY] + /// + public FACILITY_CODE Facility + // https://learn.microsoft.com/windows/win32/api/winerror/nf-winerror-hresult_facility + // #define HRESULT_FACILITY(hr) (((hr) >> 16) & 0x1fff) + => (FACILITY_CODE)((Value >> 16) & 0x1fff); + + /// + /// Extracts the code portion of the HRESULT. [HRESULT_CODE] + /// + public int Code + // https://learn.microsoft.com/windows/win32/api/winerror/nf-winerror-hresult_code + // #define HRESULT_CODE(hr) ((hr) & 0xFFFF) + => Value & 0xFFFF; + + /// + /// Converts a Win32 error code into an HRESULT. [HRESULT_FROM_WIN32] + /// + public static HRESULT FromWin32(WIN32_ERROR error) + // https://learn.microsoft.com/windows/win32/api/winerror/nf-winerror-hresult_from_win32 + // return (HRESULT)(x) <= 0 ? (HRESULT)(x) : (HRESULT) (((x) & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000); => new(((int)error & 0x0000FFFF) | unchecked((int)0x80070000)); public static implicit operator HRESULT(Exception ex) diff --git a/src/System.Windows.Forms.Primitives/src/NativeMethods.txt b/src/System.Windows.Forms.Primitives/src/NativeMethods.txt index cef1c663efe..3947d715d06 100644 --- a/src/System.Windows.Forms.Primitives/src/NativeMethods.txt +++ b/src/System.Windows.Forms.Primitives/src/NativeMethods.txt @@ -511,8 +511,6 @@ NOTIFY_ICON_DATA_FLAGS NOTIFY_ICON_INFOTIP_FLAGS NOTIFY_ICON_MESSAGE NotifyWinEvent -NTSTATUS -OBJECT_IDENTIFIER OemKeyScan OLECLOSE OLECMDEXECOPT @@ -629,8 +627,6 @@ SIGDN SIZE_* START_PAGE_GENERAL STATIC_STYLES -STATUS_PENDING -STATUS_SUCCESS STATUSCLASSNAME stc4 STGC @@ -638,7 +634,6 @@ StgCreateDocfileOnILockBytes STGMEDIUM StgOpenStorageOnILockBytes STGTY -STILL_ACTIVE StretchDIBits StructureChangeType SYSBUTTONSTATES diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Dialogs/CommonDialogs/FolderBrowserDialog.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Dialogs/CommonDialogs/FolderBrowserDialog.cs index 458601e94d8..230c083acc3 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Dialogs/CommonDialogs/FolderBrowserDialog.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Dialogs/CommonDialogs/FolderBrowserDialog.cs @@ -305,7 +305,7 @@ private unsafe bool TryRunDialogVista(HWND owner, out bool returnValue) HRESULT hr = dialog->Show(owner); if (!hr.Succeeded) { - if (hr == HRESULT.HRESULT_FROM_WIN32(WIN32_ERROR.ERROR_CANCELLED)) + if (hr == HRESULT.FromWin32(WIN32_ERROR.ERROR_CANCELLED)) { returnValue = false; return true; From fc53ec3c4845784394051a21c8b6886bad0e85e4 Mon Sep 17 00:00:00 2001 From: Melon Wang1 <94418985+MelonWang1@users.noreply.github.com> Date: Wed, 13 Nov 2024 17:37:17 +0000 Subject: [PATCH 011/106] Add unit tests for ContextMenuStripActionListTests (#12442) * Add unit tests for ContextMenuStripActionListTests * Add blank line * Handle feedback! * Updated! --- .../Design/ContextMenuStripActionListTests.cs | 154 ++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ContextMenuStripActionListTests.cs diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ContextMenuStripActionListTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ContextMenuStripActionListTests.cs new file mode 100644 index 00000000000..2c05ad84401 --- /dev/null +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ContextMenuStripActionListTests.cs @@ -0,0 +1,154 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using System.ComponentModel.Design; +using System.ComponentModel; +using Moq; + +namespace System.Windows.Forms.Design.Tests; + +public sealed class ContextMenuStripActionListTests : IDisposable +{ + private readonly Mock _mockDesignerHost; + private readonly Mock _mockSelectionService; + private readonly Mock _mockComponentChangeService; + private readonly ToolStripDropDownMenu _toolStripDropDownMenu; + private readonly ToolStripDropDown _toolStripDropDown; + private readonly ToolStripDropDownDesigner _designer; + private readonly ContextMenuStripActionList _actionList; + + public ContextMenuStripActionListTests() + { + _mockDesignerHost = new(); + _mockSelectionService = new(); + _mockComponentChangeService = new(); + _toolStripDropDownMenu = new(); + _toolStripDropDown = new(); + InitializeMocks(); + + _designer = new(); + _designer.Initialize(_toolStripDropDownMenu); + _actionList = new(_designer); + + void InitializeMocks() + { + Mock mockSite = new(); + mockSite.Setup(s => s.GetService(typeof(IDesignerHost))).Returns(_mockDesignerHost.Object); + mockSite.Setup(s => s.GetService(typeof(ISelectionService))).Returns(_mockSelectionService.Object); + mockSite.Setup(s => s.GetService(typeof(IComponentChangeService))).Returns(_mockComponentChangeService.Object); + _toolStripDropDownMenu.Site = mockSite.Object; + + _mockDesignerHost.Setup(d => d.GetService(typeof(IComponentChangeService))).Returns(_mockComponentChangeService.Object); + } + } + + public void Dispose() + { + _toolStripDropDownMenu.Dispose(); + _toolStripDropDown.Dispose(); + _designer.Dispose(); + } + + [Fact] + public void Constructor_InitializesFields() + { + _actionList.Should().NotBeNull(); + _actionList.Should().BeOfType(); + + ToolStripDropDown toolStripDropDownValue = (ToolStripDropDown)_actionList.TestAccessor().Dynamic._toolStripDropDown; + ((ToolStripDropDownMenu)toolStripDropDownValue).Should().Be(_toolStripDropDownMenu); + } + + [Theory] + [BoolData] + public void AutoShow_GetSet_ReturnsExpected(bool value) + { + _actionList.AutoShow.Should().BeFalse(); + + _actionList.AutoShow = value; + _actionList.AutoShow.Should().Be(value); + } + + [Theory] + [BoolData] + public void ShowImageMargin_GetSet_ReturnsExpected(bool value) + { + _actionList.ShowImageMargin.Should().BeTrue(); + + _actionList.ShowImageMargin = value; + _actionList.ShowImageMargin.Should().Be(value); + } + + [Theory] + [BoolData] + public void ShowCheckMargin_GetSet_ReturnsExpected(bool value) + { + _actionList.ShowCheckMargin.Should().BeFalse(); + + _actionList.ShowCheckMargin = value; + _actionList.ShowCheckMargin.Should().Be(value); + } + + [Theory] + [EnumData] + public void RenderMode_GetSet_ReturnsExpected(ToolStripRenderMode renderMode) + { + if (renderMode == ToolStripRenderMode.Custom) + { + _actionList.Invoking(a => a.RenderMode = renderMode) + .Should().Throw(); + } + else + { + _actionList.RenderMode = renderMode; + _actionList.RenderMode.Should().Be(renderMode); + } + } + + [Fact] + public void GetSortedActionItems_AlwaysReturnsRenderMode() + { + var items = _actionList.GetSortedActionItems().Cast().ToList(); + + items.Select(item => item.MemberName) + .Should().Contain(nameof(ContextMenuStripActionList.RenderMode)); + + items.Select(item => item.DisplayName) + .Should().Contain(SR.ToolStripActionList_RenderMode); + + items.Select(item => item.Description) + .Should().Contain(SR.ToolStripActionList_RenderModeDesc); + } + + [Fact] + public void GetSortedActionItems_WithToolStripDropDownMenu_IncludesShowImageMarginAndShowCheckMargin() + { + var items = _actionList.GetSortedActionItems().Cast().ToList(); + + items.Select(item => item.MemberName) + .Should().Contain(nameof(ContextMenuStripActionList.RenderMode)) + .And.Contain(nameof(ContextMenuStripActionList.ShowImageMargin)) + .And.Contain(nameof(ContextMenuStripActionList.ShowCheckMargin)); + + items.Select(item => item.DisplayName) + .Should().Contain(SR.ContextMenuStripActionList_ShowImageMargin) + .And.Contain(SR.ContextMenuStripActionList_ShowCheckMargin); + } + + [Fact] + public void GetSortedActionItems_WithToolStripDropDown_OnlyIncludesRenderMode() + { + _toolStripDropDown.Site = _toolStripDropDownMenu.Site; + _designer.Initialize(_toolStripDropDown); + _actionList.TestAccessor().Dynamic._toolStripDropDown = _toolStripDropDown; + + var items = _actionList.GetSortedActionItems().Cast().ToList(); + + items.Select(item => item.MemberName) + .Should().Contain(nameof(ContextMenuStripActionList.RenderMode)) + .And.NotContain(nameof(ContextMenuStripActionList.ShowImageMargin)) + .And.NotContain(nameof(ContextMenuStripActionList.ShowCheckMargin)); + } +} From 551ca4ea795dceb9542df678eac5f2f32ca29769 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 18:09:28 +0000 Subject: [PATCH 012/106] [main] Update dependencies from dotnet/runtime (#12460) [main] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 58 ++++++------- global.json | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5d44d7d84bc..34aa6d64af4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 - + https://github.com/dotnet/runtime - 5db0ce0fa2e206da664498044af233a044f9aeb7 + 80cb4583c9079cf052e6148b51b43590771b4353 diff --git a/eng/Versions.props b/eng/Versions.props index c5a4bd70ed9..a28f530387e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 - 10.0.0-alpha.1.24560.1 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24560.2 diff --git a/global.json b/global.json index 44691b5eeee..4a75da80201 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24562.15", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24562.15", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24560.1" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24560.2" }, "native-tools": { "cmake": "latest" From eec894a3b30026178b9e716a37da3bf308763dfa Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 18:51:11 +0000 Subject: [PATCH 013/106] [main] Update dependencies from dotnet/runtime (#12474) [main] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 58 ++++++------- global.json | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 34aa6d64af4..333584bbe15 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f - + https://github.com/dotnet/runtime - 80cb4583c9079cf052e6148b51b43590771b4353 + a593d9cd39355593e87c6cb8c876c52f4bf5145f diff --git a/eng/Versions.props b/eng/Versions.props index a28f530387e..a0343ed2800 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 - 10.0.0-alpha.1.24560.2 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24562.13 diff --git a/global.json b/global.json index 4a75da80201..205e833050b 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24562.15", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24562.15", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24560.2" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24562.13" }, "native-tools": { "cmake": "latest" From 8dd924a291a9f4684a614608aed83a252312570c Mon Sep 17 00:00:00 2001 From: Adeel Mujahid <3840695+am11@users.noreply.github.com> Date: Wed, 13 Nov 2024 22:16:06 +0200 Subject: [PATCH 014/106] Fix nullability error CS8620 in tests (#12475) * Fix nullability error CS8620 in tests --- .../Windows/Forms/Design/ToolStripContentPanelDesignerTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripContentPanelDesignerTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripContentPanelDesignerTests.cs index 3da88318ee9..59d1cc85f85 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripContentPanelDesignerTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripContentPanelDesignerTests.cs @@ -36,7 +36,7 @@ public void SnapLines_ShouldReturnNonNullList() [Fact] public void SnapLines_ShouldCallAddPaddingSnapLines() { - string[] paddingFilters = [SnapLine.PaddingLeft, SnapLine.PaddingRight, SnapLine.PaddingTop, SnapLine.PaddingBottom]; + string?[] paddingFilters = [SnapLine.PaddingLeft, SnapLine.PaddingRight, SnapLine.PaddingTop, SnapLine.PaddingBottom]; List snapLines = _toolStripContentPanelDesigner.SnapLines.Cast().ToList(); From e30751e2431a16792efbc7dbfec21e87d686b727 Mon Sep 17 00:00:00 2001 From: Jeremy Kuhne Date: Wed, 13 Nov 2024 17:11:10 -0800 Subject: [PATCH 015/106] Revert "Remove CLSCompliant attribute (#12469)" This reverts commit f7a53322868ee629e8302198908b5412dcc554da. Didn't realize the impact this would have upstream if dependencies were building as CLSCompliant. --- Directory.Build.targets | 5 +-- eng/versioning.targets | 35 +++++++++++++++ .../VisualBasic/Devices/ComputerInfo.vb | 4 ++ .../src/CompatibilitySuppressions.xml | 44 +------------------ .../src/Special/NotSupported.cs | 3 ++ .../src/System.Drawing.Common.csproj | 1 + .../src/System/Drawing/Imaging/ColorMatrix.cs | 1 + .../System/Drawing/Imaging/ImageCodecInfo.cs | 2 + .../src/System.Windows.Forms.Design.csproj | 1 + .../src/System/Drawing/Design/BitmapEditor.cs | 1 + .../src/System/Drawing/Design/ColorEditor.cs | 1 + .../src/System/Drawing/Design/CursorEditor.cs | 1 + .../src/System/Drawing/Design/FontEditor.cs | 1 + .../src/System/Drawing/Design/ImageEditor.cs | 1 + .../System/Drawing/Design/MetafileEditor.cs | 1 + .../Windows/Forms/Design/AnchorEditor.cs | 1 + .../Windows/Forms/Design/BorderSidesEditor.cs | 1 + .../Windows/Forms/Design/ComponentTray.cs | 2 + .../Forms/Design/CompositionDesigner.cs | 1 + .../System/Windows/Forms/Design/DockEditor.cs | 1 + .../Windows/Forms/Design/FileNameEditor.cs | 1 + .../Windows/Forms/Design/FolderNameEditor.cs | 1 + .../Forms/Design/ImageListImageEditor.cs | 1 + .../Forms/Design/ParentControlDesigner.cs | 4 ++ .../Forms/Design/ShortcutKeysEditor.cs | 1 + .../System.Windows.Forms.Primitives.csproj | 1 + .../src/System.Windows.Forms.csproj | 1 + .../System/Windows/Forms/ActiveX/AxHost.cs | 2 + .../Windows/Forms/OLE/DataObject.DataStore.cs | 26 +++++------ 29 files changed, 86 insertions(+), 60 deletions(-) create mode 100644 eng/versioning.targets diff --git a/Directory.Build.targets b/Directory.Build.targets index f5b1b4272f6..dc33b70b526 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -3,12 +3,9 @@ + - - $(AssemblyName) - - diff --git a/eng/versioning.targets b/eng/versioning.targets new file mode 100644 index 00000000000..321b0599d4f --- /dev/null +++ b/eng/versioning.targets @@ -0,0 +1,35 @@ + + + true + + + + $(IntermediateOutputPath)_AssemblyInfo.g.cs + + + + $(AssemblyName) + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Devices/ComputerInfo.vb b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Devices/ComputerInfo.vb index 6dfcf883681..d3552a0efab 100644 --- a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Devices/ComputerInfo.vb +++ b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Devices/ComputerInfo.vb @@ -47,6 +47,7 @@ Namespace Microsoft.VisualBasic.Devices ''' ''' Throw if we are unable to obtain the memory status. ''' + Public ReadOnly Property AvailablePhysicalMemory() As UInt64 Get Return MemoryStatus.AvailablePhysicalMemory @@ -63,6 +64,7 @@ Namespace Microsoft.VisualBasic.Devices ''' ''' Throw if we are unable to obtain the memory status. ''' + Public ReadOnly Property AvailableVirtualMemory() As UInt64 Get Return MemoryStatus.AvailableVirtualMemory @@ -129,6 +131,7 @@ Namespace Microsoft.VisualBasic.Devices ''' ''' Throw if we are unable to obtain the memory status. ''' + Public ReadOnly Property TotalPhysicalMemory() As UInt64 Get Return MemoryStatus.TotalPhysicalMemory @@ -145,6 +148,7 @@ Namespace Microsoft.VisualBasic.Devices ''' ''' Throw if we are unable to obtain the memory status. ''' + Public ReadOnly Property TotalVirtualMemory() As UInt64 Get Return MemoryStatus.TotalVirtualMemory diff --git a/src/System.Drawing.Common/src/CompatibilitySuppressions.xml b/src/System.Drawing.Common/src/CompatibilitySuppressions.xml index 521f4adba7b..ef75f17f963 100644 --- a/src/System.Drawing.Common/src/CompatibilitySuppressions.xml +++ b/src/System.Drawing.Common/src/CompatibilitySuppressions.xml @@ -1,5 +1,5 @@  - + CP0002 @@ -25,13 +25,6 @@ lib/netstandard2.0/System.Drawing.Common.dll lib/net462/System.Drawing.Common.dll - - CP0014 - M:System.Drawing.Imaging.ColorMatrix.#ctor(System.Single[][]):[T:System.CLSCompliantAttribute] - lib/net8.0/System.Drawing.Common.dll - lib/net8.0/System.Drawing.Common.dll - true - CP0014 M:System.Drawing.Printing.PrintPageEventArgs.get_Graphics:[T:System.Runtime.CompilerServices.NullableContextAttribute] @@ -39,20 +32,6 @@ lib/net8.0/System.Drawing.Common.dll true - - CP0014 - P:System.Drawing.Imaging.ImageCodecInfo.SignatureMasks:[T:System.CLSCompliantAttribute] - lib/net8.0/System.Drawing.Common.dll - lib/net8.0/System.Drawing.Common.dll - true - - - CP0014 - P:System.Drawing.Imaging.ImageCodecInfo.SignaturePatterns:[T:System.CLSCompliantAttribute] - lib/net8.0/System.Drawing.Common.dll - lib/net8.0/System.Drawing.Common.dll - true - CP0014 P:System.Drawing.Printing.PrintPageEventArgs.Graphics:[T:System.Runtime.CompilerServices.NullableAttribute] @@ -144,27 +123,6 @@ lib/net8.0/System.Drawing.Common.dll true - - CP0014 - M:System.Drawing.Imaging.ColorMatrix.#ctor(System.Single[][]):[T:System.CLSCompliantAttribute] - lib/netstandard2.0/System.Drawing.Common.dll - lib/netstandard2.0/System.Drawing.Common.dll - true - - - CP0014 - P:System.Drawing.Imaging.ImageCodecInfo.SignatureMasks:[T:System.CLSCompliantAttribute] - lib/netstandard2.0/System.Drawing.Common.dll - lib/netstandard2.0/System.Drawing.Common.dll - true - - - CP0014 - P:System.Drawing.Imaging.ImageCodecInfo.SignaturePatterns:[T:System.CLSCompliantAttribute] - lib/netstandard2.0/System.Drawing.Common.dll - lib/netstandard2.0/System.Drawing.Common.dll - true - CP0015 T:System.Drawing.Printing.PrintPageEventArgs:[T:System.Runtime.CompilerServices.NullableContextAttribute] diff --git a/src/System.Drawing.Common/src/Special/NotSupported.cs b/src/System.Drawing.Common/src/Special/NotSupported.cs index b3fbf98babd..4a8321c0b36 100644 --- a/src/System.Drawing.Common/src/Special/NotSupported.cs +++ b/src/System.Drawing.Common/src/Special/NotSupported.cs @@ -1976,6 +1976,7 @@ public enum ColorMapType public sealed partial class ColorMatrix { public ColorMatrix() { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } + [System.CLSCompliantAttribute(false)] public ColorMatrix(float[][] newColorMatrix) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } public float this[int row, int column] { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } set { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } public float Matrix00 { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } set { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } @@ -2472,7 +2473,9 @@ public sealed partial class ImageCodecInfo public string? FormatDescription { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } set { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } public System.Guid FormatID { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } set { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } public string? MimeType { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } set { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } + [System.CLSCompliantAttribute(false)] public byte[][]? SignatureMasks { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } set { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } + [System.CLSCompliantAttribute(false)] public byte[][]? SignaturePatterns { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } set { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } public int Version { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } set { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } public static System.Drawing.Imaging.ImageCodecInfo[] GetImageDecoders() { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } diff --git a/src/System.Drawing.Common/src/System.Drawing.Common.csproj b/src/System.Drawing.Common/src/System.Drawing.Common.csproj index 4d1825db612..25aea9c4d95 100644 --- a/src/System.Drawing.Common/src/System.Drawing.Common.csproj +++ b/src/System.Drawing.Common/src/System.Drawing.Common.csproj @@ -9,6 +9,7 @@ false enable disable + true true true true diff --git a/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorMatrix.cs b/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorMatrix.cs index aa5a4e1cb49..599d3ff0d16 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorMatrix.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorMatrix.cs @@ -299,6 +299,7 @@ public float Matrix44 /// /// Initializes a new instance of the class with the elements in the specified matrix. /// + [CLSCompliant(false)] public ColorMatrix(float[][] newColorMatrix) { _matrix00 = newColorMatrix[0][0]; diff --git a/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageCodecInfo.cs b/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageCodecInfo.cs index c6bc6cd819a..c5a6131a14d 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageCodecInfo.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageCodecInfo.cs @@ -28,8 +28,10 @@ internal ImageCodecInfo() public int Version { get; set; } + [CLSCompliant(false)] public byte[][]? SignaturePatterns { get; set; } + [CLSCompliant(false)] public byte[][]? SignatureMasks { get; set; } // Encoder/Decoder selection APIs diff --git a/src/System.Windows.Forms.Design/src/System.Windows.Forms.Design.csproj b/src/System.Windows.Forms.Design/src/System.Windows.Forms.Design.csproj index d9ace26472a..74ac5d4b609 100644 --- a/src/System.Windows.Forms.Design/src/System.Windows.Forms.Design.csproj +++ b/src/System.Windows.Forms.Design/src/System.Windows.Forms.Design.csproj @@ -2,6 +2,7 @@ System.Windows.Forms.Design + true true true enable diff --git a/src/System.Windows.Forms.Design/src/System/Drawing/Design/BitmapEditor.cs b/src/System.Windows.Forms.Design/src/System/Drawing/Design/BitmapEditor.cs index 49458c97ef4..bc635b861a8 100644 --- a/src/System.Windows.Forms.Design/src/System/Drawing/Design/BitmapEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Drawing/Design/BitmapEditor.cs @@ -7,6 +7,7 @@ namespace System.Drawing.Design; /// Provides an editor that can perform default file searching for bitmap (.bmp) /// files. /// +[CLSCompliant(false)] public class BitmapEditor : ImageEditor { protected static List BitmapExtensions = ["bmp", "gif", "jpg", "jpeg", "png", "ico"]; diff --git a/src/System.Windows.Forms.Design/src/System/Drawing/Design/ColorEditor.cs b/src/System.Windows.Forms.Design/src/System/Drawing/Design/ColorEditor.cs index 6741c91e659..a6de6e142a2 100644 --- a/src/System.Windows.Forms.Design/src/System/Drawing/Design/ColorEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Drawing/Design/ColorEditor.cs @@ -10,6 +10,7 @@ namespace System.Drawing.Design; /// /// Provides an editor for visually picking a color. /// +[CLSCompliant(false)] public partial class ColorEditor : UITypeEditor { /// diff --git a/src/System.Windows.Forms.Design/src/System/Drawing/Design/CursorEditor.cs b/src/System.Windows.Forms.Design/src/System/Drawing/Design/CursorEditor.cs index a531476cd0f..b3a5937aba9 100644 --- a/src/System.Windows.Forms.Design/src/System/Drawing/Design/CursorEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Drawing/Design/CursorEditor.cs @@ -9,6 +9,7 @@ namespace System.Drawing.Design; /// /// Provides an editor that can perform default file searching for cursor (.cur) files. /// +[CLSCompliant(false)] public partial class CursorEditor : UITypeEditor { private CursorUI? _cursorUI; diff --git a/src/System.Windows.Forms.Design/src/System/Drawing/Design/FontEditor.cs b/src/System.Windows.Forms.Design/src/System/Drawing/Design/FontEditor.cs index 4bd3e80f730..9f9ba551aef 100644 --- a/src/System.Windows.Forms.Design/src/System/Drawing/Design/FontEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Drawing/Design/FontEditor.cs @@ -10,6 +10,7 @@ namespace System.Drawing.Design; /// /// Provides a font editor that is used to visually select and configure a Font object. /// +[CLSCompliant(false)] public class FontEditor : UITypeEditor { private FontDialog? _fontDialog; diff --git a/src/System.Windows.Forms.Design/src/System/Drawing/Design/ImageEditor.cs b/src/System.Windows.Forms.Design/src/System/Drawing/Design/ImageEditor.cs index 218986c6009..0076eb366db 100644 --- a/src/System.Windows.Forms.Design/src/System/Drawing/Design/ImageEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Drawing/Design/ImageEditor.cs @@ -12,6 +12,7 @@ namespace System.Drawing.Design; /// /// Provides an editor for visually picking an image. /// +[CLSCompliant(false)] public class ImageEditor : UITypeEditor { private static readonly Type[] s_imageExtenders = [typeof(BitmapEditor), typeof(MetafileEditor)]; diff --git a/src/System.Windows.Forms.Design/src/System/Drawing/Design/MetafileEditor.cs b/src/System.Windows.Forms.Design/src/System/Drawing/Design/MetafileEditor.cs index a28e719e723..a789af8f4fa 100644 --- a/src/System.Windows.Forms.Design/src/System/Drawing/Design/MetafileEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Drawing/Design/MetafileEditor.cs @@ -8,6 +8,7 @@ namespace System.Drawing.Design; /// /// Extends Image's editor class to provide default file searching for metafile (.emf) files. /// +[CLSCompliant(false)] public class MetafileEditor : ImageEditor { protected override string GetFileDialogDescription() => SR.metafileFileDescription; diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/AnchorEditor.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/AnchorEditor.cs index 204c3bf3f98..566452fcc52 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/AnchorEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/AnchorEditor.cs @@ -9,6 +9,7 @@ namespace System.Windows.Forms.Design; /// /// Provides a design-time editor for specifying the property. /// +[CLSCompliant(false)] public sealed partial class AnchorEditor : UITypeEditor { private AnchorUI? _anchorUI; diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/BorderSidesEditor.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/BorderSidesEditor.cs index 803bcbe564c..86601d714f9 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/BorderSidesEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/BorderSidesEditor.cs @@ -9,6 +9,7 @@ namespace System.Windows.Forms.Design; /// /// Provides an editor for setting the ToolStripStatusLabel BorderSides property.. /// +[CLSCompliant(false)] public partial class BorderSidesEditor : UITypeEditor { private BorderSidesEditorUI? _borderSidesEditorUI; diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ComponentTray.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ComponentTray.cs index f709f3b7139..067f443f996 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ComponentTray.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ComponentTray.cs @@ -745,6 +745,7 @@ public virtual void AddComponent(IComponent component) } } + [CLSCompliant(false)] protected virtual bool CanCreateComponentFromTool(ToolboxItem tool) { IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); @@ -812,6 +813,7 @@ protected virtual bool CanDisplayComponent(IComponent component) return TypeDescriptor.GetAttributes(component).Contains(DesignTimeVisibleAttribute.Yes); } + [CLSCompliant(false)] public void CreateComponentFromTool(ToolboxItem tool) { if (!CanCreateComponentFromTool(tool)) diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/CompositionDesigner.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/CompositionDesigner.cs index 04e858a3291..3f1365b0e3a 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/CompositionDesigner.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/CompositionDesigner.cs @@ -125,6 +125,7 @@ protected override void Dispose(bool disposing) /// Gets a value indicating whether the specified tool is supported by this /// designer. /// + [CLSCompliant(false)] protected virtual bool GetToolSupported(ToolboxItem tool) { throw new NotImplementedException(SR.NotImplementedByDesign); diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DockEditor.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DockEditor.cs index d8222031614..d2556254817 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DockEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DockEditor.cs @@ -9,6 +9,7 @@ namespace System.Windows.Forms.Design; /// /// Implements the design time editor for specifying the property. /// +[CLSCompliant(false)] public sealed partial class DockEditor : UITypeEditor { private DockUI? _dockUI; diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/FileNameEditor.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/FileNameEditor.cs index 7ed6ecfd513..f22eaec150c 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/FileNameEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/FileNameEditor.cs @@ -9,6 +9,7 @@ namespace System.Windows.Forms.Design; /// /// Provides an editor for filenames. /// +[CLSCompliant(false)] public class FileNameEditor : UITypeEditor { private OpenFileDialog? _openFileDialog; diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/FolderNameEditor.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/FolderNameEditor.cs index 77dc10325a5..49c1d937950 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/FolderNameEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/FolderNameEditor.cs @@ -9,6 +9,7 @@ namespace System.Windows.Forms.Design; /// /// Provides an editor for choosing a folder from the filesystem. /// +[CLSCompliant(false)] public partial class FolderNameEditor : UITypeEditor { private FolderBrowser? _folderBrowser; diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ImageListImageEditor.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ImageListImageEditor.cs index c084c02a953..029d5e5bc94 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ImageListImageEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ImageListImageEditor.cs @@ -11,6 +11,7 @@ namespace System.Windows.Forms.Design; /// /// Provides an editor that can perform default file searching for bitmap (.bmp) files. /// +[CLSCompliant(false)] public class ImageListImageEditor : ImageEditor { // Metafile types are not supported in the ImageListImageEditor and should not be displayed as an option. diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ParentControlDesigner.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ParentControlDesigner.cs index 004642a35ec..188d78f9b40 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ParentControlDesigner.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ParentControlDesigner.cs @@ -280,6 +280,7 @@ protected Size GridSize /// This property is used by deriving classes to determine if the designer is /// in a state where it has a valid MouseDragTool. /// + [CLSCompliant(false)] protected ToolboxItem MouseDragTool => _mouseDragTool; /// @@ -795,6 +796,7 @@ protected void CreateTool(ToolboxItem tool) /// Creates the given tool in the currently selected control at the /// given position. The default size for the tool is used. /// + [CLSCompliant(false)] protected void CreateTool(ToolboxItem tool, Point location) { CreateToolCore(tool, location.X, location.Y, 0, 0, true, false); @@ -804,6 +806,7 @@ protected void CreateTool(ToolboxItem tool, Point location) /// Creates the given tool in the currently selected control. The /// tool is created with the provided shape. /// + [CLSCompliant(false)] protected void CreateTool(ToolboxItem tool, Rectangle bounds) { CreateToolCore(tool, bounds.X, bounds.Y, bounds.Width, bounds.Height, true, true); @@ -813,6 +816,7 @@ protected void CreateTool(ToolboxItem tool, Rectangle bounds) /// This is the worker method of all CreateTool methods. It is the only one /// that can be overridden. /// + [CLSCompliant(false)] protected virtual IComponent[] CreateToolCore(ToolboxItem tool, int x, int y, int width, int height, bool hasLocation, bool hasSize) { IComponent[] comp = null; diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ShortcutKeysEditor.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ShortcutKeysEditor.cs index 83dc2d5072f..c8651883043 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ShortcutKeysEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ShortcutKeysEditor.cs @@ -10,6 +10,7 @@ namespace System.Windows.Forms.Design; /// /// Provides an editor for picking shortcut keys. /// +[CLSCompliant(false)] public partial class ShortcutKeysEditor : UITypeEditor { private ShortcutKeysUI? _shortcutKeysUI; diff --git a/src/System.Windows.Forms.Primitives/src/System.Windows.Forms.Primitives.csproj b/src/System.Windows.Forms.Primitives/src/System.Windows.Forms.Primitives.csproj index 58876a64667..c05a1eb50a1 100644 --- a/src/System.Windows.Forms.Primitives/src/System.Windows.Forms.Primitives.csproj +++ b/src/System.Windows.Forms.Primitives/src/System.Windows.Forms.Primitives.csproj @@ -3,6 +3,7 @@ System.Windows.Forms.Primitives true + true enable - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef - + https://github.com/dotnet/runtime - a593d9cd39355593e87c6cb8c876c52f4bf5145f + 1c4c0093a6f2008bafc034e35e08d019bef44cef diff --git a/eng/Versions.props b/eng/Versions.props index a0343ed2800..71f58a840ae 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 - 10.0.0-alpha.1.24562.13 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24563.7 diff --git a/global.json b/global.json index 205e833050b..6d4a9c6cd9e 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24562.15", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24562.15", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24562.13" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24563.7" }, "native-tools": { "cmake": "latest" From 43dfefde09f4e300a1227e2c776349614be4e7cc Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 13:43:18 +0000 Subject: [PATCH 018/106] [main] Update dependencies from dotnet/arcade (#12482) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 24 +++++++++---------- eng/Versions.props | 6 ++--- .../core-templates/job/source-build.yml | 5 ++-- .../core-templates/steps/source-build.yml | 7 +++++- eng/common/sdk-task.ps1 | 2 +- eng/common/tools.ps1 | 4 ++-- global.json | 10 ++++---- 7 files changed, 32 insertions(+), 26 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index fb3bdd407eb..009ba1cd4ae 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -191,29 +191,29 @@ Note: if the Uri is a new place, you will need to add a subscription from that p - + https://github.com/dotnet/arcade - e882d5925ca55013d5810ac51e36574a65c5da84 + 16010cc5b14ca0b6aacd591bb06352ccbe016cbe - + https://github.com/dotnet/arcade - e882d5925ca55013d5810ac51e36574a65c5da84 + 16010cc5b14ca0b6aacd591bb06352ccbe016cbe - + https://github.com/dotnet/arcade - e882d5925ca55013d5810ac51e36574a65c5da84 + 16010cc5b14ca0b6aacd591bb06352ccbe016cbe - + https://github.com/dotnet/arcade - e882d5925ca55013d5810ac51e36574a65c5da84 + 16010cc5b14ca0b6aacd591bb06352ccbe016cbe - + https://github.com/dotnet/arcade - e882d5925ca55013d5810ac51e36574a65c5da84 + 16010cc5b14ca0b6aacd591bb06352ccbe016cbe - + https://github.com/dotnet/arcade - e882d5925ca55013d5810ac51e36574a65c5da84 + 16010cc5b14ca0b6aacd591bb06352ccbe016cbe diff --git a/eng/Versions.props b/eng/Versions.props index 71f58a840ae..8f9110df3d6 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -56,9 +56,9 @@ - 10.0.0-beta.24562.15 - 10.0.0-beta.24562.15 - 10.0.0-beta.24562.15 + 10.0.0-beta.24563.7 + 10.0.0-beta.24563.7 + 10.0.0-beta.24563.7 17.4.0-preview-20220707-01 diff --git a/eng/common/core-templates/job/source-build.yml b/eng/common/core-templates/job/source-build.yml index c4713c8b6ed..05f7ad6ef0d 100644 --- a/eng/common/core-templates/job/source-build.yml +++ b/eng/common/core-templates/job/source-build.yml @@ -12,9 +12,10 @@ parameters: # The name of the job. This is included in the job ID. # targetRID: '' # The name of the target RID to use, instead of the one auto-detected by Arcade. - # nonPortable: false + # portableBuild: false # Enables non-portable mode. This means a more specific RID (e.g. fedora.32-x64 rather than - # linux-x64), and compiling against distro-provided packages rather than portable ones. + # linux-x64), and compiling against distro-provided packages rather than portable ones. The + # default is portable mode. # skipPublishValidation: false # Disables publishing validation. By default, a check is performed to ensure no packages are # published by source-build. diff --git a/eng/common/core-templates/steps/source-build.yml b/eng/common/core-templates/steps/source-build.yml index c9271c01158..4da05afe054 100644 --- a/eng/common/core-templates/steps/source-build.yml +++ b/eng/common/core-templates/steps/source-build.yml @@ -76,6 +76,11 @@ steps: assetManifestFileName=SourceBuild_${{ parameters.platform.name }}.xml fi + portableBuildArgs= + if [ '${{ parameters.platform.portableBuild }}' != '' ]; then + portableBuildArgs='/p:PortabelBuild=${{ parameters.platform.portableBuild }}' + fi + ${{ coalesce(parameters.platform.buildScript, './build.sh') }} --ci \ --configuration $buildConfig \ --restore --build --pack $publishArgs -bl \ @@ -85,7 +90,7 @@ steps: $targetRidArgs \ $runtimeOsArgs \ $baseOsArgs \ - /p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \ + $portableBuildArgs \ /p:DotNetBuildSourceOnly=true \ /p:DotNetBuildRepo=true \ /p:AssetManifestFileName=$assetManifestFileName diff --git a/eng/common/sdk-task.ps1 b/eng/common/sdk-task.ps1 index aab40de3fd9..4f0546dce12 100644 --- a/eng/common/sdk-task.ps1 +++ b/eng/common/sdk-task.ps1 @@ -64,7 +64,7 @@ try { $GlobalJson.tools | Add-Member -Name "vs" -Value (ConvertFrom-Json "{ `"version`": `"16.5`" }") -MemberType NoteProperty } if( -not ($GlobalJson.tools.PSObject.Properties.Name -match "xcopy-msbuild" )) { - $GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "17.10.0-pre.4.0" -MemberType NoteProperty + $GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "17.12.0" -MemberType NoteProperty } if ($GlobalJson.tools."xcopy-msbuild".Trim() -ine "none") { $xcopyMSBuildToolsFolder = InitializeXCopyMSBuild $GlobalJson.tools."xcopy-msbuild" -install $true diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 7bd54b6ba9b..bd80ccccb51 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -383,8 +383,8 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = # If the version of msbuild is going to be xcopied, # use this version. Version matches a package here: - # https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet-eng/NuGet/Microsoft.DotNet.Arcade.MSBuild.Xcopy/versions/17.10.0-pre.4.0 - $defaultXCopyMSBuildVersion = '17.10.0-pre.4.0' + # https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet-eng/NuGet/Microsoft.DotNet.Arcade.MSBuild.Xcopy/versions/17.12.0 + $defaultXCopyMSBuildVersion = '17.12.0' if (!$vsRequirements) { if (Get-Member -InputObject $GlobalJson.tools -Name 'vs') { diff --git a/global.json b/global.json index 6d4a9c6cd9e..979ba5acdde 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "tools": { - "dotnet": "9.0.100-rc.2.24474.12", + "dotnet": "9.0.100", "runtimes": { "dotnet/x64": [ "$(VSRedistCommonNetCoreSharedFrameworkx64100PackageVersion)" @@ -11,12 +11,12 @@ } }, "sdk": { - "version": "9.0.100-rc.2.24474.12" + "version": "9.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24562.15", - "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24562.15", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24562.15", + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24563.7", + "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24563.7", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24563.7", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24563.7" }, From b685bfcd2e60a739924e6181c696dafb5087aa0e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 19:05:09 +0000 Subject: [PATCH 019/106] [main] Update dependencies from dotnet/runtime (#12485) [main] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 58 ++++++------- global.json | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 009ba1cd4ae..b837c5164d5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc - + https://github.com/dotnet/runtime - 1c4c0093a6f2008bafc034e35e08d019bef44cef + c65320833210f3df7412e2fcd11d6751fa374adc diff --git a/eng/Versions.props b/eng/Versions.props index 8f9110df3d6..522a83bf1c5 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 - 10.0.0-alpha.1.24563.7 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.3 diff --git a/global.json b/global.json index 979ba5acdde..c7bab5d0cda 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24563.7", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24563.7", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24563.7" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24564.3" }, "native-tools": { "cmake": "latest" From d5bd0706a1ef6ddae97ce791bc972b4b29cfa756 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 22:43:38 +0000 Subject: [PATCH 020/106] [main] Update dependencies from dotnet/runtime (#12488) [main] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 58 ++++++------- global.json | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b837c5164d5..c93cdcaad90 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 - + https://github.com/dotnet/runtime - c65320833210f3df7412e2fcd11d6751fa374adc + 31e28adfc107ddc5484391251a34e46317c7be99 diff --git a/eng/Versions.props b/eng/Versions.props index 522a83bf1c5..dd7c7ce1db1 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 - 10.0.0-alpha.1.24564.3 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.7 diff --git a/global.json b/global.json index c7bab5d0cda..a3b6621c2e1 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24563.7", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24563.7", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24564.3" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24564.7" }, "native-tools": { "cmake": "latest" From 9b6e9a5a0925a8d8bd528a362514e8002bb85bcc Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2024 13:42:19 +0000 Subject: [PATCH 021/106] [main] Update dependencies from dotnet/arcade (#12492) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 24 ++++++++++++------------ eng/Versions.props | 6 +++--- global.json | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c93cdcaad90..bc01c2d5415 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -191,29 +191,29 @@ Note: if the Uri is a new place, you will need to add a subscription from that p - + https://github.com/dotnet/arcade - 16010cc5b14ca0b6aacd591bb06352ccbe016cbe + c1852b9ac37df9a86630c2f078dbee43f7b186e7 - + https://github.com/dotnet/arcade - 16010cc5b14ca0b6aacd591bb06352ccbe016cbe + c1852b9ac37df9a86630c2f078dbee43f7b186e7 - + https://github.com/dotnet/arcade - 16010cc5b14ca0b6aacd591bb06352ccbe016cbe + c1852b9ac37df9a86630c2f078dbee43f7b186e7 - + https://github.com/dotnet/arcade - 16010cc5b14ca0b6aacd591bb06352ccbe016cbe + c1852b9ac37df9a86630c2f078dbee43f7b186e7 - + https://github.com/dotnet/arcade - 16010cc5b14ca0b6aacd591bb06352ccbe016cbe + c1852b9ac37df9a86630c2f078dbee43f7b186e7 - + https://github.com/dotnet/arcade - 16010cc5b14ca0b6aacd591bb06352ccbe016cbe + c1852b9ac37df9a86630c2f078dbee43f7b186e7 diff --git a/eng/Versions.props b/eng/Versions.props index dd7c7ce1db1..75a80f57b00 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -56,9 +56,9 @@ - 10.0.0-beta.24563.7 - 10.0.0-beta.24563.7 - 10.0.0-beta.24563.7 + 10.0.0-beta.24564.1 + 10.0.0-beta.24564.1 + 10.0.0-beta.24564.1 17.4.0-preview-20220707-01 diff --git a/global.json b/global.json index a3b6621c2e1..e5d8d94c48e 100644 --- a/global.json +++ b/global.json @@ -14,9 +14,9 @@ "version": "9.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24563.7", - "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24563.7", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24563.7", + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24564.1", + "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24564.1", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24564.1", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24564.7" }, From 0e776b8c1fcb447d12dd0030009d226ce7418ffb Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2024 17:21:08 +0000 Subject: [PATCH 022/106] [main] Update dependencies from dotnet/runtime (#12493) [main] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 58 ++++++------- global.json | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index bc01c2d5415..9814d98b418 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 - + https://github.com/dotnet/runtime - 31e28adfc107ddc5484391251a34e46317c7be99 + 5aee7c2379d1e99f7df13b13a88e908b27890b91 diff --git a/eng/Versions.props b/eng/Versions.props index 75a80f57b00..51b953b737e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 - 10.0.0-alpha.1.24564.7 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24564.12 diff --git a/global.json b/global.json index e5d8d94c48e..5ba31c90fca 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24564.1", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24564.1", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24564.7" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24564.12" }, "native-tools": { "cmake": "latest" From 44914916c61088f7e322bb0a0d71fa15c03fb765 Mon Sep 17 00:00:00 2001 From: Tanya Solyanik Date: Fri, 15 Nov 2024 10:28:29 -0800 Subject: [PATCH 023/106] Test switch scopes should read switch default values dynamically at initialization time (#12490) Test switch scopes should read switch default value dynamically --- .../src/LocalAppContextSwitches.Common.cs | 20 ++----- .../TestUtilities/AppContextSwitchScope.cs | 10 +++- .../TestUtilities/BinaryFormatterScope.cs | 4 +- .../LocalAppContextSwitches.cs | 53 +++++++++---------- .../TestUtilities/TargetFrameworkNameScope.cs | 41 -------------- .../Forms/LocalAppContextSwitchesTest.cs | 21 -------- .../TestUtilities/AnchorLayoutV2Scope.cs | 8 ++- .../ApplyParentFontToMenusScope.cs | 8 ++- ...DataGridViewUIAStartRowCountAtZeroScope.cs | 8 ++- .../NoClientNotificationsScope.cs | 8 ++- .../ScaleTopLevelFormMinMaxSizeForDpiScope.cs | 8 ++- .../ServicePointManagerCheckCrlScope.cs | 8 ++- ...ollectionAddRangeRespectsSortOrderScope.cs | 9 +++- 13 files changed, 92 insertions(+), 114 deletions(-) delete mode 100644 src/System.Windows.Forms.Primitives/tests/TestUtilities/TargetFrameworkNameScope.cs delete mode 100644 src/System.Windows.Forms.Primitives/tests/UnitTests/System/Windows/Forms/LocalAppContextSwitchesTest.cs diff --git a/src/Common/src/LocalAppContextSwitches.Common.cs b/src/Common/src/LocalAppContextSwitches.Common.cs index c5acac36236..9dd582ca44a 100644 --- a/src/Common/src/LocalAppContextSwitches.Common.cs +++ b/src/Common/src/LocalAppContextSwitches.Common.cs @@ -30,7 +30,7 @@ private static bool GetCachedSwitchValueInternal(string switchName, ref int cach bool hasSwitch = AppContext.TryGetSwitch(switchName, out bool isSwitchEnabled); if (!hasSwitch) { - isSwitchEnabled = GetSwitchDefaultValue(switchName); + isSwitchEnabled = false; } AppContext.TryGetSwitch("TestSwitch.LocalAppContext.DisableCaching", out bool disableCaching); @@ -38,23 +38,11 @@ private static bool GetCachedSwitchValueInternal(string switchName, ref int cach { cachedSwitchValue = isSwitchEnabled ? 1 /*true*/ : -1 /*false*/; } - - return isSwitchEnabled; - } - - // Provides default values for switches if they're not always false by default - private static bool GetSwitchDefaultValue(string switchName) - { - if (switchName == "Switch.System.Runtime.Serialization.SerializationGuard") + else if (!hasSwitch) { - return true; + AppContext.SetSwitch(switchName, isSwitchEnabled); } - if (switchName == "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization") - { - return true; - } - - return false; + return isSwitchEnabled; } } diff --git a/src/Common/tests/TestUtilities/AppContextSwitchScope.cs b/src/Common/tests/TestUtilities/AppContextSwitchScope.cs index ff771db020b..32ba35a75c7 100644 --- a/src/Common/tests/TestUtilities/AppContextSwitchScope.cs +++ b/src/Common/tests/TestUtilities/AppContextSwitchScope.cs @@ -18,6 +18,11 @@ public readonly ref struct AppContextSwitchScope private readonly bool _originalState; public AppContextSwitchScope(string switchName, bool enable) + : this (switchName, getDefaultValue: null, enable) + { + } + + public AppContextSwitchScope(string switchName, Func? getDefaultValue, bool enable) { if (!AppContext.TryGetSwitch(AppContextSwitchNames.LocalAppContext_DisableCaching, out bool isEnabled) || !isEnabled) @@ -26,7 +31,10 @@ public AppContextSwitchScope(string switchName, bool enable) throw new InvalidOperationException("LocalAppContext switch caching is not disabled."); } - AppContext.TryGetSwitch(switchName, out _originalState); + if (!AppContext.TryGetSwitch(switchName, out _originalState)) + { + _originalState = getDefaultValue is not null && getDefaultValue(); + } AppContext.SetSwitch(switchName, enable); if (!AppContext.TryGetSwitch(switchName, out isEnabled) || isEnabled != enable) diff --git a/src/Common/tests/TestUtilities/BinaryFormatterScope.cs b/src/Common/tests/TestUtilities/BinaryFormatterScope.cs index c278df02a90..b6c12b2bc50 100644 --- a/src/Common/tests/TestUtilities/BinaryFormatterScope.cs +++ b/src/Common/tests/TestUtilities/BinaryFormatterScope.cs @@ -17,7 +17,7 @@ public BinaryFormatterScope(bool enable) // Prevent multiple BinaryFormatterScopes from running simultaneously. Using Monitor to allow recursion on // the same thread. Monitor.Enter(typeof(BinaryFormatterScope)); - _switchScope = new(AppContextSwitchNames.EnableUnsafeBinaryFormatterSerialization, enable); + _switchScope = new(AppContextSwitchNames.EnableUnsafeBinaryFormatterSerialization, GetDefaultValue, enable); } public void Dispose() @@ -31,4 +31,6 @@ public void Dispose() Monitor.Exit(typeof(BinaryFormatterScope)); } } + + public static bool GetDefaultValue() => false; } diff --git a/src/System.Windows.Forms.Primitives/src/System/LocalAppContextSwitches/LocalAppContextSwitches.cs b/src/System.Windows.Forms.Primitives/src/System/LocalAppContextSwitches/LocalAppContextSwitches.cs index 394794d313e..2b4b42128d5 100644 --- a/src/System.Windows.Forms.Primitives/src/System/LocalAppContextSwitches/LocalAppContextSwitches.cs +++ b/src/System.Windows.Forms.Primitives/src/System/LocalAppContextSwitches/LocalAppContextSwitches.cs @@ -91,48 +91,47 @@ private static bool GetSwitchValue(string switchName, ref int cachedSwitchValue) { cachedSwitchValue = isSwitchEnabled ? 1 /*true*/ : -1 /*false*/; } + else if (!hasSwitch) + { + AppContext.SetSwitch(switchName, isSwitchEnabled); + } return isSwitchEnabled; + } - static bool GetSwitchDefaultValue(string switchName) + private static bool GetSwitchDefaultValue(string switchName) + { + if (switchName == TreeNodeCollectionAddRangeRespectsSortOrderSwitchName) { - if (TargetFrameworkName is not { } framework) - { - return false; - } + return true; + } - if (switchName == NoClientNotificationsSwitchName) + if (TargetFrameworkName is not { } framework) + { + return false; + } + + if (framework.Version.Major >= 8) + { + // Behavior changes added in .NET 8 + + if (switchName == ScaleTopLevelFormMinMaxSizeForDpiSwitchName) { - return false; + return true; } - if (switchName == TreeNodeCollectionAddRangeRespectsSortOrderSwitchName) + if (switchName == TrackBarModernRenderingSwitchName) { return true; } - if (framework.Version.Major >= 8) + if (switchName == ServicePointManagerCheckCrlSwitchName) { - // Behavior changes added in .NET 8 - - if (switchName == ScaleTopLevelFormMinMaxSizeForDpiSwitchName) - { - return true; - } - - if (switchName == TrackBarModernRenderingSwitchName) - { - return true; - } - - if (switchName == ServicePointManagerCheckCrlSwitchName) - { - return true; - } + return true; } - - return false; } + + return false; } /// diff --git a/src/System.Windows.Forms.Primitives/tests/TestUtilities/TargetFrameworkNameScope.cs b/src/System.Windows.Forms.Primitives/tests/TestUtilities/TargetFrameworkNameScope.cs deleted file mode 100644 index e34a06518bf..00000000000 --- a/src/System.Windows.Forms.Primitives/tests/TestUtilities/TargetFrameworkNameScope.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Runtime.Versioning; -using System.Windows.Forms.Primitives; - -namespace System; - -#nullable enable - -/// -/// Scope for setting the see temporarily. -/// Use in a statement. -/// -public readonly ref struct TargetFrameworkNameScope -{ - private readonly FrameworkName? _previousTargetFrameworkName; - private readonly dynamic _testAccessor; - - public TargetFrameworkNameScope(string targetFrameworkName) - { - _testAccessor = typeof(LocalAppContextSwitches).TestAccessor().Dynamic; - ResetLocalSwitches(); - _previousTargetFrameworkName = LocalAppContextSwitches.TargetFrameworkName; - _testAccessor.s_targetFrameworkName = new FrameworkName(targetFrameworkName); - } - - public void Dispose() - { - _testAccessor.s_targetFrameworkName = _previousTargetFrameworkName; - ResetLocalSwitches(); - } - - private void ResetLocalSwitches() - { - _testAccessor.s_anchorLayoutV2 = 0; - _testAccessor.s_scaleTopLevelFormMinMaxSizeForDpi = 0; - _testAccessor.s_trackBarModernRendering = 0; - _testAccessor.s_servicePointManagerCheckCrl = 0; - } -} diff --git a/src/System.Windows.Forms.Primitives/tests/UnitTests/System/Windows/Forms/LocalAppContextSwitchesTest.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/System/Windows/Forms/LocalAppContextSwitchesTest.cs deleted file mode 100644 index a619f5d526d..00000000000 --- a/src/System.Windows.Forms.Primitives/tests/UnitTests/System/Windows/Forms/LocalAppContextSwitchesTest.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Windows.Forms.Primitives; - -namespace System.Windows.Forms.Tests; - -public class LocalAppContextSwitchesTest -{ - [WinFormsTheory] - [InlineData(".NETCoreApp,Version=v8.0", true)] - [InlineData(".NETCoreApp,Version=v7.0", false)] - [InlineData(".NET Framework,Version=v4.8", false)] - public void Validate_Default_Switch_Values(string targetFrameworkName, bool expected) - { - using TargetFrameworkNameScope scope = new(targetFrameworkName); - Assert.Equal(expected, LocalAppContextSwitches.TrackBarModernRendering); - Assert.Equal(expected, LocalAppContextSwitches.ScaleTopLevelFormMinMaxSizeForDpi); - Assert.Equal(expected, LocalAppContextSwitches.ServicePointManagerCheckCrl); - } -} diff --git a/src/System.Windows.Forms/tests/TestUtilities/AnchorLayoutV2Scope.cs b/src/System.Windows.Forms/tests/TestUtilities/AnchorLayoutV2Scope.cs index 76915aef94f..bba826fd967 100644 --- a/src/System.Windows.Forms/tests/TestUtilities/AnchorLayoutV2Scope.cs +++ b/src/System.Windows.Forms/tests/TestUtilities/AnchorLayoutV2Scope.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Windows.Forms.Primitives; + namespace System; /// @@ -16,7 +18,7 @@ public AnchorLayoutV2Scope(bool enable) // Prevent multiple AnchorLayoutV2Scope instances from running simultaneously. // Using Monitor to allow recursion on the same thread. Monitor.Enter(typeof(AnchorLayoutV2Scope)); - _switchScope = new(WinFormsAppContextSwitchNames.AnchorLayoutV2, enable); + _switchScope = new(WinFormsAppContextSwitchNames.AnchorLayoutV2, GetDefaultValue, enable); } public void Dispose() @@ -30,4 +32,8 @@ public void Dispose() Monitor.Exit(typeof(AnchorLayoutV2Scope)); } } + + public static bool GetDefaultValue() => + typeof(LocalAppContextSwitches).TestAccessor() + .CreateDelegate>("GetSwitchDefaultValue")(WinFormsAppContextSwitchNames.AnchorLayoutV2); } diff --git a/src/System.Windows.Forms/tests/TestUtilities/ApplyParentFontToMenusScope.cs b/src/System.Windows.Forms/tests/TestUtilities/ApplyParentFontToMenusScope.cs index 5a6366cf9ef..22907a86edd 100644 --- a/src/System.Windows.Forms/tests/TestUtilities/ApplyParentFontToMenusScope.cs +++ b/src/System.Windows.Forms/tests/TestUtilities/ApplyParentFontToMenusScope.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Windows.Forms.Primitives; + namespace System; /// @@ -16,7 +18,7 @@ public ApplyParentFontToMenusScope(bool enable) // Prevent multiple ApplyParentFontToMenusScopes from running simultaneously. Using Monitor to allow recursion on // the same thread. Monitor.Enter(typeof(ApplyParentFontToMenusScope)); - _switchScope = new(WinFormsAppContextSwitchNames.ApplyParentFontToMenus, enable); + _switchScope = new(WinFormsAppContextSwitchNames.ApplyParentFontToMenus, GetDefaultValue, enable); } public void Dispose() @@ -30,4 +32,8 @@ public void Dispose() Monitor.Exit(typeof(ApplyParentFontToMenusScope)); } } + + public static bool GetDefaultValue() => + typeof(LocalAppContextSwitches).TestAccessor() + .CreateDelegate>("GetSwitchDefaultValue")(WinFormsAppContextSwitchNames.ApplyParentFontToMenus); } diff --git a/src/System.Windows.Forms/tests/TestUtilities/DataGridViewUIAStartRowCountAtZeroScope.cs b/src/System.Windows.Forms/tests/TestUtilities/DataGridViewUIAStartRowCountAtZeroScope.cs index 7df6754afff..96837ed6718 100644 --- a/src/System.Windows.Forms/tests/TestUtilities/DataGridViewUIAStartRowCountAtZeroScope.cs +++ b/src/System.Windows.Forms/tests/TestUtilities/DataGridViewUIAStartRowCountAtZeroScope.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Windows.Forms.Primitives; + namespace System; /// /// Scope for enabling / disabling the DataGridViewUIAStartRowCountAtZero Switch. @@ -15,7 +17,7 @@ public DataGridViewUIAStartRowCountAtZeroScope(bool enable) // Prevent multiple BinaryFormatterScopes from running simultaneously. Using Monitor to allow recursion on // the same thread. Monitor.Enter(typeof(DataGridViewUIAStartRowCountAtZeroScope)); - _switchScope = new(WinFormsAppContextSwitchNames.DataGridViewUIAStartRowCountAtZero, enable); + _switchScope = new(WinFormsAppContextSwitchNames.DataGridViewUIAStartRowCountAtZero, GetDefaultValue, enable); } public void Dispose() @@ -29,4 +31,8 @@ public void Dispose() Monitor.Exit(typeof(DataGridViewUIAStartRowCountAtZeroScope)); } } + + public static bool GetDefaultValue() => + typeof(LocalAppContextSwitches).TestAccessor() + .CreateDelegate>("GetSwitchDefaultValue")(WinFormsAppContextSwitchNames.DataGridViewUIAStartRowCountAtZero); } diff --git a/src/System.Windows.Forms/tests/TestUtilities/NoClientNotificationsScope.cs b/src/System.Windows.Forms/tests/TestUtilities/NoClientNotificationsScope.cs index 05f4e146262..305daa6da5d 100644 --- a/src/System.Windows.Forms/tests/TestUtilities/NoClientNotificationsScope.cs +++ b/src/System.Windows.Forms/tests/TestUtilities/NoClientNotificationsScope.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Windows.Forms.Primitives; + namespace System; /// @@ -16,7 +18,7 @@ public NoClientNotificationsScope(bool enable) // Prevent multiple NoClientNotificationsScopes from running simultaneously. Using Monitor to allow recursion on // the same thread. Monitor.Enter(typeof(NoClientNotificationsScope)); - _switchScope = new(WinFormsAppContextSwitchNames.NoClientNotifications, enable); + _switchScope = new(WinFormsAppContextSwitchNames.NoClientNotifications, GetDefaultValue, enable); } public void Dispose() @@ -30,4 +32,8 @@ public void Dispose() Monitor.Exit(typeof(NoClientNotificationsScope)); } } + + public static bool GetDefaultValue() => + typeof(LocalAppContextSwitches).TestAccessor() + .CreateDelegate>("GetSwitchDefaultValue")(WinFormsAppContextSwitchNames.NoClientNotifications); } diff --git a/src/System.Windows.Forms/tests/TestUtilities/ScaleTopLevelFormMinMaxSizeForDpiScope.cs b/src/System.Windows.Forms/tests/TestUtilities/ScaleTopLevelFormMinMaxSizeForDpiScope.cs index 4019ff4c55c..680465e267a 100644 --- a/src/System.Windows.Forms/tests/TestUtilities/ScaleTopLevelFormMinMaxSizeForDpiScope.cs +++ b/src/System.Windows.Forms/tests/TestUtilities/ScaleTopLevelFormMinMaxSizeForDpiScope.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Windows.Forms.Primitives; + namespace System; /// @@ -16,7 +18,7 @@ public ScaleTopLevelFormMinMaxSizeForDpiScope(bool enable) // Prevent multiple ScaleTopLevelFormMinMaxSizeForDpi from running simultaneously. // Using Monitor to allow recursion on the same thread. Monitor.Enter(typeof(ScaleTopLevelFormMinMaxSizeForDpiScope)); - _switchScope = new(WinFormsAppContextSwitchNames.ScaleTopLevelFormMinMaxSizeForDpi, enable); + _switchScope = new(WinFormsAppContextSwitchNames.ScaleTopLevelFormMinMaxSizeForDpi, GetDefaultValue, enable); } public void Dispose() @@ -30,4 +32,8 @@ public void Dispose() Monitor.Exit(typeof(ScaleTopLevelFormMinMaxSizeForDpiScope)); } } + + public static bool GetDefaultValue() => + typeof(LocalAppContextSwitches).TestAccessor() + .CreateDelegate>("GetSwitchDefaultValue")(WinFormsAppContextSwitchNames.ScaleTopLevelFormMinMaxSizeForDpi); } diff --git a/src/System.Windows.Forms/tests/TestUtilities/ServicePointManagerCheckCrlScope.cs b/src/System.Windows.Forms/tests/TestUtilities/ServicePointManagerCheckCrlScope.cs index 1db15540067..ae74fd34bf4 100644 --- a/src/System.Windows.Forms/tests/TestUtilities/ServicePointManagerCheckCrlScope.cs +++ b/src/System.Windows.Forms/tests/TestUtilities/ServicePointManagerCheckCrlScope.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Windows.Forms.Primitives; + namespace System; /// @@ -16,7 +18,7 @@ public ServicePointManagerCheckCrlScope(bool enable) // Prevent multiple ServicePointManagerCheckCrlScope instances from running simultaneously. // Using Monitor to allow recursion on the same thread. Monitor.Enter(typeof(ServicePointManagerCheckCrlScope)); - _switchScope = new(WinFormsAppContextSwitchNames.ServicePointManagerCheckCrl, enable); + _switchScope = new(WinFormsAppContextSwitchNames.ServicePointManagerCheckCrl, GetDefaultValue, enable); } public void Dispose() @@ -30,4 +32,8 @@ public void Dispose() Monitor.Exit(typeof(ServicePointManagerCheckCrlScope)); } } + + public static bool GetDefaultValue() => + typeof(LocalAppContextSwitches).TestAccessor() + .CreateDelegate>("GetSwitchDefaultValue")(WinFormsAppContextSwitchNames.ServicePointManagerCheckCrl); } diff --git a/src/System.Windows.Forms/tests/TestUtilities/TreeNodeCollectionAddRangeRespectsSortOrderScope.cs b/src/System.Windows.Forms/tests/TestUtilities/TreeNodeCollectionAddRangeRespectsSortOrderScope.cs index 8a9261388f8..ee4ec700747 100644 --- a/src/System.Windows.Forms/tests/TestUtilities/TreeNodeCollectionAddRangeRespectsSortOrderScope.cs +++ b/src/System.Windows.Forms/tests/TestUtilities/TreeNodeCollectionAddRangeRespectsSortOrderScope.cs @@ -1,7 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Windows.Forms.Primitives; + namespace System; + /// /// Scope for enabling / disabling the TreeNodeCollectionAddRangeRespectsSortOrder Switch. /// Use in a statement. @@ -15,7 +18,7 @@ public TreeNodeCollectionAddRangeRespectsSortOrderScope(bool enable) // Prevent multiple TreeNodeCollectionAddRangeRespectsSortOrderScopes from running simultaneously. // Using Monitor to allow recursion on the same thread. Monitor.Enter(typeof(TreeNodeCollectionAddRangeRespectsSortOrderScope)); - _switchScope = new(WinFormsAppContextSwitchNames.TreeNodeCollectionAddRangeRespectsSortOrder, enable); + _switchScope = new(WinFormsAppContextSwitchNames.TreeNodeCollectionAddRangeRespectsSortOrder, GetDefaultValue, enable); } public void Dispose() @@ -29,4 +32,8 @@ public void Dispose() Monitor.Exit(typeof(TreeNodeCollectionAddRangeRespectsSortOrderScope)); } } + + public static bool GetDefaultValue() => + typeof(LocalAppContextSwitches).TestAccessor() + .CreateDelegate>("GetSwitchDefaultValue")(WinFormsAppContextSwitchNames.TreeNodeCollectionAddRangeRespectsSortOrder); } From 98c761f4d9863f99cdb48ac9e87feef01d5c595e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 16 Nov 2024 13:41:21 +0000 Subject: [PATCH 024/106] [main] Update dependencies from dotnet/runtime (#12499) [main] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 58 ++++++------- global.json | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9814d98b418..f3d96d24a13 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 - + https://github.com/dotnet/runtime - 5aee7c2379d1e99f7df13b13a88e908b27890b91 + 55eee324653e01cf28809d02b25a5b0894b58d22 diff --git a/eng/Versions.props b/eng/Versions.props index 51b953b737e..209c08066b5 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 - 10.0.0-alpha.1.24564.12 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24565.3 diff --git a/global.json b/global.json index 5ba31c90fca..739b968e259 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24564.1", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24564.1", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24564.12" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24565.3" }, "native-tools": { "cmake": "latest" From f0e509cd30c40b925247b82518a28be691dedb6a Mon Sep 17 00:00:00 2001 From: Jeremy Kuhne Date: Sun, 17 Nov 2024 18:23:23 -0800 Subject: [PATCH 025/106] Ensure GDI+ is initialized for all codepaths (#12501) A few places slipped through the cracks. If you call GetImageEncoders before any other System.Drawing code you will get a fatal error. --- .../src/System/Drawing/Graphics.cs | 1 + .../src/System/Drawing/Imaging/ImageCodecInfo.cs | 4 ++++ .../src/NativeMethods.txt | 3 +++ .../Graphics/GdiPlus/GdiPlusInitialization.cs | 16 ++++++++++++++++ 4 files changed, 24 insertions(+) diff --git a/src/System.Drawing.Common/src/System/Drawing/Graphics.cs b/src/System.Drawing.Common/src/System/Drawing/Graphics.cs index 4df928ac00b..69d47c5f467 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Graphics.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Graphics.cs @@ -3525,6 +3525,7 @@ public static IntPtr GetHalftonePalette() { if (s_halftonePalette.IsNull) { + GdiPlusInitialization.EnsureInitialized(); s_halftonePalette = PInvokeCore.GdipCreateHalftonePalette(); } } diff --git a/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageCodecInfo.cs b/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageCodecInfo.cs index c5a6131a14d..ab81457c57b 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageCodecInfo.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageCodecInfo.cs @@ -38,6 +38,8 @@ internal ImageCodecInfo() public static ImageCodecInfo[] GetImageDecoders() { + GdiPlusInitialization.EnsureInitialized(); + ImageCodecInfo[] imageCodecs; uint numDecoders; uint size; @@ -57,6 +59,8 @@ public static ImageCodecInfo[] GetImageDecoders() public static ImageCodecInfo[] GetImageEncoders() { + GdiPlusInitialization.EnsureInitialized(); + ImageCodecInfo[] imageCodecs; uint numEncoders; uint size; diff --git a/src/System.Private.Windows.Core/src/NativeMethods.txt b/src/System.Private.Windows.Core/src/NativeMethods.txt index 0786250e091..806f9fd414d 100644 --- a/src/System.Private.Windows.Core/src/NativeMethods.txt +++ b/src/System.Private.Windows.Core/src/NativeMethods.txt @@ -77,6 +77,9 @@ GetCurrentThreadId GetSysColorBrush GetWindowText GetWindowTextLength +// All callers of these APIs MUST call GdiPlusInitialization.EnsureInitialized() before use. +// There is no easy way to do this in Core as we want to make sure it is only done when needed. +// (If using another GDI+ handle or wrapped object you can assume GDI+ is initialized.) GdipBitmapLockBits GdipBitmapUnlockBits GdipCreateFromHWND diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/GdiPlusInitialization.cs b/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/GdiPlusInitialization.cs index f5dc769a4ee..b399831ef0f 100644 --- a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/GdiPlusInitialization.cs +++ b/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/GdiPlusInitialization.cs @@ -3,6 +3,9 @@ namespace Windows.Win32.Graphics.GdiPlus; +/// +/// Helper to ensure GDI+ is initialized before making calls. +/// internal static partial class GdiPlusInitialization { private static readonly nuint s_initToken = Init(); @@ -23,5 +26,18 @@ private static unsafe nuint Init() /// /// Returns true if GDI+ has been started. /// + /// + /// + /// This should be called anywhere you make calls to GDI+ where you don't + /// already have a GDI+ handle. In System.Drawing.Common, this is done in the PInvoke static constructor + /// so it is not necessary for methods defined there. + /// + /// + /// We don't do this implicitly in the Core assembly to avoid unnecessary loading of GDI+. + /// + /// + /// https://github.com/microsoft/CsWin32/issues/1308 tracks a proposal to make this more automatic. + /// + /// internal static bool EnsureInitialized() => s_initToken != 0; } From ed8c9f299534d816e73924b444b398f4e4911db5 Mon Sep 17 00:00:00 2001 From: Emmanuel Ferdman Date: Mon, 18 Nov 2024 19:34:22 +0200 Subject: [PATCH 026/106] Update `Microsoft.WindowsDesktop.App.Ref.sfxproj` reference (#12500) Signed-off-by: Emmanuel Ferdman --- pkg/Microsoft.Private.Winforms/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/Microsoft.Private.Winforms/README.md b/pkg/Microsoft.Private.Winforms/README.md index 963387fe861..7328ea5c1ad 100644 --- a/pkg/Microsoft.Private.Winforms/README.md +++ b/pkg/Microsoft.Private.Winforms/README.md @@ -8,7 +8,7 @@ This is a transport package consumed by [WPF](https://github.com/dotnet/wpf/) an This folder contains props and targets used to ingest our assemblies into the [Windows Desktop SDK](https://github.com/dotnet/windowsdesktop/) for purpose of bundling of our analyzers into Microsoft.WindowsDesktop.App.Ref pack. * [`System.Windows.Forms.FileClassification.props`](sdk\dotnet-windowsdesktop\System.Windows.Forms.FileClassification.props) contains a manifest for the "WindowsForms" SDK[¹](#ref1), i.e. a list of our assemblies that form it. -The file is imported by [Microsoft.WindowsDesktop.App.Ref project](https://github.com/dotnet/windowsdesktop/blob/main/pkg/windowsdesktop/sfx/Microsoft.WindowsDesktop.App.Ref.sfxproj).
+The file is imported by [Microsoft.WindowsDesktop.App.Ref project](https://github.com/dotnet/windowsdesktop/blob/main/src/windowsdesktop/src/sfx/Microsoft.WindowsDesktop.App.Ref.sfxproj).
The manifest will need to be rebuilt if there are changes in the solution with respect to the SDK assemblies, e.g. a new assembly is added or an existing assembly is removed. ### How to update System.Windows.Forms.FileClassification.props From 9b23f84c740d35634ba3f5d224172a26baf47937 Mon Sep 17 00:00:00 2001 From: Paul M Cohen Date: Tue, 19 Nov 2024 05:44:26 +1200 Subject: [PATCH 027/106] Code coverage for WindowsFormsApplicationBase (#12455) * Add stome test for WindowsFormsApplicationBase * Add more test coverage * Add more tests * Add more tests Make some Private items Friend to enable better code coverage * Add tests for ShowSplashScreen and ApplicationContext * Improve code coverage * Rename some variable for clearity Add more tests for MainForm and SplashScreen * Pr Feedback * Symplify WindowsFormsApplicationBaseTests * PR Feedback * resort WindowsFormsApplicationBase.vb * Create separate classes that can output all valid and sample invalid data and use in tests. --- .../WindowsFormsApplicationBase.vb | 142 ++++++++--------- .../Windows/Forms/TestUtilitiesTests.vb | 15 ++ .../Forms/WindowsFormsApplicationBaseTests.vb | 149 ++++++++++++++++++ .../TestData/EnumTestInvalidData.vb | 20 +++ .../TestData/EnumTestValidData.vb | 21 +++ .../EnumValueAndThrowIndicatorData.vb | 28 ++++ 6 files changed, 304 insertions(+), 71 deletions(-) create mode 100644 src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/WindowsFormsApplicationBaseTests.vb create mode 100644 src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/TestUtilities/TestData/EnumTestInvalidData.vb create mode 100644 src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/TestUtilities/TestData/EnumTestValidData.vb create mode 100644 src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/TestUtilities/TestData/EnumValueAndThrowIndicatorData.vb diff --git a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBase.vb b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBase.vb index f5ac6664952..69b3aaf9143 100644 --- a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBase.vb +++ b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBase.vb @@ -263,29 +263,6 @@ Namespace Microsoft.VisualBasic.ApplicationServices End Get End Property - ''' - ''' The splash screen timeout specifies whether there is a minimum time that the splash - ''' screen should be displayed for. When not set then the splash screen is hidden - ''' as soon as the main form becomes active. - ''' - ''' The minimum amount of time, in milliseconds, to display the splash screen. - ''' - ''' This property, although public, used to be set in an `Overrides Function OnInitialize` _before_ - ''' calling `MyBase.OnInitialize`. We want to phase this out, and with the introduction of the - ''' ApplyApplicationDefaults events have it handled in that event, rather than as awkwardly - ''' as it is currently suggested to be used in the docs. - ''' First step for that is to make it hidden in IntelliSense. - ''' - - Public Property MinimumSplashScreenDisplayTime() As Integer - Get - Return _minimumSplashExposure - End Get - Set(value As Integer) - _minimumSplashExposure = value - End Set - End Property - ''' ''' Informs My.Settings whether to save the settings on exit or not ''' @@ -334,6 +311,29 @@ Namespace Microsoft.VisualBasic.ApplicationServices End Set End Property + ''' + ''' The splash screen timeout specifies whether there is a minimum time that the splash + ''' screen should be displayed for. When not set then the splash screen is hidden + ''' as soon as the main form becomes active. + ''' + ''' The minimum amount of time, in milliseconds, to display the splash screen. + ''' + ''' This property, although public, used to be set in an `Overrides Function OnInitialize` _before_ + ''' calling `MyBase.OnInitialize`. We want to phase this out, and with the introduction of the + ''' ApplyApplicationDefaults events have it handled in that event, rather than as awkwardly + ''' as it is currently suggested to be used in the docs. + ''' First step for that is to make it hidden in IntelliSense. + ''' + + Public Property MinimumSplashScreenDisplayTime() As Integer + Get + Return _minimumSplashExposure + End Get + Set(value As Integer) + _minimumSplashExposure = value + End Set + End Property + ''' ''' Returns the collection of forms that are open. We no longer have thread ''' affinity meaning that this is the WinForms collection that contains Forms that may @@ -487,54 +487,6 @@ Namespace Microsoft.VisualBasic.ApplicationServices End RaiseEvent End Event - ''' - ''' Generates the name for the remote singleton that we use to channel multiple instances - ''' to the same application model thread. - ''' - ''' - ''' - ''' A string unique to the application that should be the same for versions of - ''' the application that have the same Major and Minor Version Number. - ''' - ''' If GUID Attribute does not exist fall back to unique ModuleVersionId. - Private Shared Function GetApplicationInstanceID(entry As Assembly) As String - - Dim guidAttrib As GuidAttribute = entry.GetCustomAttribute(Of GuidAttribute)() - - If guidAttrib IsNot Nothing Then - - Dim version As Version = entry.GetName.Version - - If version IsNot Nothing Then - Return $"{guidAttrib.Value}{version.Major}.{version.Minor}" - Else - Return guidAttrib.Value - End If - End If - - Return entry.ManifestModule.ModuleVersionId.ToString() - End Function - - ''' - ''' Validates that the value being passed as an AuthenticationMode enum is a legal value - ''' - ''' - Private Shared Sub ValidateAuthenticationModeEnumValue(value As AuthenticationMode, paramName As String) - If value < AuthenticationMode.Windows OrElse value > AuthenticationMode.ApplicationDefined Then - Throw New InvalidEnumArgumentException(paramName, value, GetType(AuthenticationMode)) - End If - End Sub - - ''' - ''' Validates that the value being passed as an ShutdownMode enum is a legal value - ''' - ''' - Private Shared Sub ValidateShutdownModeEnumValue(value As ShutdownMode, paramName As String) - If value < ShutdownMode.AfterMainFormCloses OrElse value > ShutdownMode.AfterAllFormsClose Then - Throw New InvalidEnumArgumentException(paramName, value, GetType(ShutdownMode)) - End If - End Sub - ''' ''' Displays the splash screen. We get called here from a different thread than what the ''' main form is starting up on. This allows us to process events for the Splash screen so @@ -1015,6 +967,54 @@ Namespace Microsoft.VisualBasic.ApplicationServices End If End Sub + ''' + ''' Generates the name for the remote singleton that we use to channel multiple instances + ''' to the same application model thread. + ''' + ''' + ''' + ''' A string unique to the application that should be the same for versions of + ''' the application that have the same Major and Minor Version Number. + ''' + ''' If GUID Attribute does not exist fall back to unique ModuleVersionId. + Friend Shared Function GetApplicationInstanceID(entry As Assembly) As String + + Dim guidAttrib As GuidAttribute = entry.GetCustomAttribute(Of GuidAttribute)() + + If guidAttrib IsNot Nothing Then + + Dim version As Version = entry.GetName.Version + + If version IsNot Nothing Then + Return $"{guidAttrib.Value}{version.Major}.{version.Minor}" + Else + Return guidAttrib.Value + End If + End If + + Return entry.ManifestModule.ModuleVersionId.ToString() + End Function + + ''' + ''' Validates that the value being passed as an AuthenticationMode enum is a legal value + ''' + ''' + Friend Shared Sub ValidateAuthenticationModeEnumValue(value As AuthenticationMode, paramName As String) + If value < AuthenticationMode.Windows OrElse value > AuthenticationMode.ApplicationDefined Then + Throw New InvalidEnumArgumentException(paramName, value, GetType(AuthenticationMode)) + End If + End Sub + + ''' + ''' Validates that the value being passed as an ShutdownMode enum is a legal value + ''' + ''' + Friend Shared Sub ValidateShutdownModeEnumValue(value As ShutdownMode, paramName As String) + If value < ShutdownMode.AfterMainFormCloses OrElse value > ShutdownMode.AfterAllFormsClose Then + Throw New InvalidEnumArgumentException(paramName, value, GetType(ShutdownMode)) + End If + End Sub + ''' ''' Processes all windows messages currently in the message queue ''' diff --git a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/TestUtilitiesTests.vb b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/TestUtilitiesTests.vb index 27de04540c1..970251e2476 100644 --- a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/TestUtilitiesTests.vb +++ b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/TestUtilitiesTests.vb @@ -2,12 +2,27 @@ ' The .NET Foundation licenses this file to you under the MIT license. Imports FluentAssertions +Imports Microsoft.VisualBasic.ApplicationServices Imports Xunit Namespace Microsoft.VisualBasic.Forms.Tests Public Class TestUtilitiesTests + + Public Sub EnumTestInvalidDataIteratorTests() + Dim testClass As New EnumTestValidData(Of AuthenticationMode) + testClass.IEnumerable_GetEnumerator.Should.NotBeNull() + testClass.Any.Should.BeTrue() + End Sub + + + Public Sub EnumTestValidDataIteratorTests() + Dim testClass As New EnumTestValidData(Of AuthenticationMode) + testClass.IEnumerable_GetEnumerator.Should.NotBeNull() + testClass.Any.Should.BeTrue() + End Sub + Public Sub TimeTestDataIteratorTests() Dim testClass As New TimeTestData diff --git a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/WindowsFormsApplicationBaseTests.vb b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/WindowsFormsApplicationBaseTests.vb new file mode 100644 index 00000000000..4bccd1cd23d --- /dev/null +++ b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/WindowsFormsApplicationBaseTests.vb @@ -0,0 +1,149 @@ +' Licensed to the .NET Foundation under one or more agreements. +' The .NET Foundation licenses this file to you under the MIT license. + +Imports System.ComponentModel +Imports System.Windows.Forms +Imports FluentAssertions +Imports Microsoft.VisualBasic.ApplicationServices +Imports Xunit + +Namespace Microsoft.VisualBasic.Forms.Tests + + Partial Public Class WindowsFormsApplicationBaseTests + Inherits WindowsFormsApplicationBase + + + Public Sub Properties() + UseCompatibleTextRendering.Should.BeFalse() + +#Disable Warning WFO5001 ' Type is for evaluation purposes only and is subject to change or removal in future updates. + ColorMode.Should.Be(SystemColorMode.Classic) + ColorMode = SystemColorMode.Dark + ColorMode.Should.Be(SystemColorMode.Dark) +#Enable Warning WFO5001 + + EnableVisualStyles.Should.Be(False) + EnableVisualStyles = True + EnableVisualStyles.Should.Be(True) + + HighDpiMode.Should.Be(HighDpiMode.SystemAware) + HighDpiMode = HighDpiMode.PerMonitorV2 + HighDpiMode.Should.Be(HighDpiMode.PerMonitorV2) + + IsSingleInstance.Should.Be(False) + IsSingleInstance = True + IsSingleInstance.Should.Be(True) + + ShutdownStyle.Should.Be(ShutdownMode.AfterMainFormCloses) + ShutdownStyle = ShutdownMode.AfterAllFormsClose + ShutdownStyle.Should.Be(ShutdownMode.AfterAllFormsClose) + + MinimumSplashScreenDisplayTime.Should.Be(MinimumSplashExposureDefault) + MinimumSplashScreenDisplayTime = 1000 + MinimumSplashScreenDisplayTime.Should.Be(1000) + + SaveMySettingsOnExit.Should.Be(False) + SaveMySettingsOnExit = True + SaveMySettingsOnExit.Should.Be(True) + + SplashScreen.Should.BeNull() + + Dim testCode As Action = Sub() MainForm = Nothing + testCode.Should.Throw(Of ArgumentNullException)() + + Using form1 As New Form + SplashScreen = form1 + SplashScreen.Should.Be(form1) + + testCode = Sub() MainForm = form1 + testCode.Should.Throw(Of ArgumentException)() + SplashScreen = Nothing + End Using + + Using form1 As New Form + MainForm = form1 + MainForm.Should.Be(form1) + + testCode = Sub() SplashScreen = form1 + testCode.Should.Throw(Of ArgumentException)() + End Using + + Using splashScreenForm As New Form + Using form2 As New Form + SplashScreen = form2 + splashScreenForm.Name = NameOf(splashScreenForm) + MainForm = splashScreenForm + MainForm.Should.Be(splashScreenForm) + SplashScreen.Should.Be(form2) + ApplicationContext.Should.NotBeNull() + ApplicationContext.MainForm.Name.Should.Be(NameOf(splashScreenForm)) + + testCode = Sub() SplashScreen = splashScreenForm + testCode.Should.Throw(Of ArgumentException)() + + OpenForms.Count.Should.Be(0) + SplashScreen.Show() + OpenForms.Count.Should.Be(1) + SplashScreen = Nothing + End Using + End Using + End Sub + + + Public Sub Run_DoEvents() + Dim testCode As Action = Sub() DoEvents() + testCode.Should.NotThrow() + End Sub + + + Public Sub Run_SingleInstanceNoStartupFormException() + IsSingleInstance = True + Dim testCode As Action = Sub() Run(commandLine:={"1"}) + testCode.Should.Throw(Of NoStartupFormException)() + End Sub + + + Public Sub ShowHideSplashScreenSuccess() + Dim testCode As Action + Using form1 As New Form + SplashScreen = form1 + testCode = Sub() ShowSplashScreen() + testCode.Should.NotThrow() + End Using + testCode = Sub() HideSplashScreen() + testCode.Should.NotThrow() + SplashScreen = Nothing + End Sub + + + + + Public Sub ValidateAuthenticationModeEnumValues(testData As EnumValueAndThrowIndicatorData(Of AuthenticationMode)) + Dim testCode As Action = + Sub() ValidateAuthenticationModeEnumValue(testData.Value, NameOf(AuthenticationMode)) + + If testData.Throws Then + testCode.Should.Throw(Of InvalidEnumArgumentException)() + Else + testCode.Should.NotThrow() + End If + End Sub + + + + + Public Sub ValidateShutdownModeEnumValues(testData As EnumValueAndThrowIndicatorData(Of ShutdownMode)) + Dim testCode As Action = + Sub() + ValidateShutdownModeEnumValue(testData.Value, NameOf(ShutdownMode)) + End Sub + + If testData.Throws Then + testCode.Should.Throw(Of InvalidEnumArgumentException)() + Else + testCode.Should.NotThrow() + End If + End Sub + + End Class +End Namespace diff --git a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/TestUtilities/TestData/EnumTestInvalidData.vb b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/TestUtilities/TestData/EnumTestInvalidData.vb new file mode 100644 index 00000000000..868e99609c9 --- /dev/null +++ b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/TestUtilities/TestData/EnumTestInvalidData.vb @@ -0,0 +1,20 @@ +' Licensed to the .NET Foundation under one or more agreements. +' The .NET Foundation licenses this file to you under the MIT license. + +Namespace Microsoft.VisualBasic.Forms.Tests + + Public Class EnumTestInvalidData(Of T) + Implements IEnumerable(Of Object()) + + Public Iterator Function GetEnumerator() As IEnumerator(Of Object()) Implements IEnumerable(Of Object()).GetEnumerator + Yield {New EnumValueAndThrowIndicatorData(Of T)(CType(CObj(-1), T), True)} + Yield {New EnumValueAndThrowIndicatorData(Of T)(CType(CObj(Integer.MaxValue), T), True)} + End Function + + Public Function IEnumerable_GetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator + Return GetEnumerator() + End Function + + End Class + +End Namespace diff --git a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/TestUtilities/TestData/EnumTestValidData.vb b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/TestUtilities/TestData/EnumTestValidData.vb new file mode 100644 index 00000000000..af7324bb3e9 --- /dev/null +++ b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/TestUtilities/TestData/EnumTestValidData.vb @@ -0,0 +1,21 @@ +' Licensed to the .NET Foundation under one or more agreements. +' The .NET Foundation licenses this file to you under the MIT license. + +Namespace Microsoft.VisualBasic.Forms.Tests + + Public Class EnumTestValidData(Of T) + Implements IEnumerable(Of Object()) + + Public Iterator Function GetEnumerator() As IEnumerator(Of Object()) Implements IEnumerable(Of Object()).GetEnumerator + For Each mode As [Enum] In [Enum].GetValues(GetType(T)) + Yield {New EnumValueAndThrowIndicatorData(Of T)(CType(CObj(mode), T), False)} + Next + End Function + + Public Function IEnumerable_GetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator + Return GetEnumerator() + End Function + + End Class + +End Namespace diff --git a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/TestUtilities/TestData/EnumValueAndThrowIndicatorData.vb b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/TestUtilities/TestData/EnumValueAndThrowIndicatorData.vb new file mode 100644 index 00000000000..212abf58946 --- /dev/null +++ b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/TestUtilities/TestData/EnumValueAndThrowIndicatorData.vb @@ -0,0 +1,28 @@ +' Licensed to the .NET Foundation under one or more agreements. +' The .NET Foundation licenses this file to you under the MIT license. + +Namespace Microsoft.VisualBasic.Forms.Tests + ''' + ''' This holds one Enum Value of any type and in indicator is it is valid for the class. + ''' + ''' Any Enum Type + Public Class EnumValueAndThrowIndicatorData(Of T) + ''' + ''' Type T can be and but Flags are not supported if they + ''' use all bits of an . + ''' + ''' Any Enum value + ''' + ''' indicates the value is an invalid value for T + ''' and is expected to . + ''' if value is valid for T. + ''' + Public Sub New(value As T, throws As Boolean) + Me.Value = value + Me.Throws = throws + End Sub + + Public Property Throws As Boolean + Public Property Value As T + End Class +End Namespace From ddfbcd1d9722d93040b6d8d5ed46c8a0337cd6bf Mon Sep 17 00:00:00 2001 From: Ricardo Bossan Date: Mon, 18 Nov 2024 15:18:58 -0300 Subject: [PATCH 028/106] Adds coverage to ControlDesigner (#12410) * Adds code coverage to ControlDesigner * Handles nullability erros and modifies test * Arranges code in the constructor * Cleans repeated code * Reintroduces InitializeTest * Handles feedback * Handle feedbacks * Adds AssemblyInfo.cs with mock public key * handle feedbacks * Makes mock initialization reusable by extracting it to TestControlDesigner.Mocks * Removes reflection * Adds new test case --------- Co-authored-by: Ricardo Bossan (BEYONDSOFT CONSULTING INC) (from Dev Box) --- .../src/AssemblyInfo.cs | 6 + .../tests/UnitTests/ControlDesignerTests.cs | 428 +++++++++++------- .../UnitTests/TestControlDesigner.Mocks.cs | 116 +++++ .../tests/UnitTests/TestControlDesigner.cs | 16 +- 4 files changed, 402 insertions(+), 164 deletions(-) create mode 100644 src/System.Windows.Forms.Design/src/AssemblyInfo.cs create mode 100644 src/System.Windows.Forms.Design/tests/UnitTests/TestControlDesigner.Mocks.cs diff --git a/src/System.Windows.Forms.Design/src/AssemblyInfo.cs b/src/System.Windows.Forms.Design/src/AssemblyInfo.cs new file mode 100644 index 00000000000..a222e2b9d87 --- /dev/null +++ b/src/System.Windows.Forms.Design/src/AssemblyInfo.cs @@ -0,0 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo($"DynamicProxyGenAssembly2, PublicKey={PublicKeys.Moq}")] diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/ControlDesignerTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/ControlDesignerTests.cs index 5a2e5279f9d..1e9cd5c2533 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/ControlDesignerTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/ControlDesignerTests.cs @@ -1,26 +1,50 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.ComponentModel.Design; +#nullable enable + +using System.ComponentModel; +using System.Windows.Forms.Design.Behavior; using System.Windows.Forms.Design.Tests.Mocks; using Moq; using Windows.Win32; namespace System.Windows.Forms.Design.Tests; -public class ControlDesignerTests +public class ControlDesignerTests : IDisposable { + private readonly TestControlDesigner _designer = new(); + + public void Dispose() + { + _designer.Dispose(); + } + [WinFormsFact] public void ControlDesigner_Ctor_Default() { - using TestControlDesigner controlDesigner = new(); - Assert.False(controlDesigner.AutoResizeHandles); - Assert.Throws(() => controlDesigner.Control); - Assert.True(controlDesigner.ControlSupportsSnaplines); - Assert.Throws(() => controlDesigner.Component); - Assert.True(controlDesigner.ForceVisible); - Assert.Throws(controlDesigner.GetParentComponentProperty); - Assert.False(controlDesigner.SerializePerformLayout); + using TestControlDesigner controlDesigner = new(isInitialized: false); + + controlDesigner.AutoResizeHandles.Should().BeFalse(); + controlDesigner.ControlSupportsSnaplines.Should().BeTrue(); + controlDesigner.ForceVisible.Should().BeTrue(); + controlDesigner.SerializePerformLayout.Should().BeFalse(); + + Action action1 = () => + { + Control _ = controlDesigner.Control; + }; + + Action action2 = () => + { + IComponent component = controlDesigner.Component; + }; + + Action action3 = () => controlDesigner.GetParentComponentProperty(); + + action1.Should().Throw(); + action2.Should().Throw(); + action3.Should().Throw(); } [WinFormsFact] @@ -28,251 +52,329 @@ public void ControlDesigner_PropertiesTest() { using TestControlDesigner controlDesigner = new(); using Button button = new(); + controlDesigner.Initialize(button); - Assert.Empty(controlDesigner.AssociatedComponents); - Assert.False(controlDesigner.IsRootDesigner); - Assert.NotNull(controlDesigner.SnapLines); - Assert.Equal(8, controlDesigner.SnapLines.Count); - Assert.NotNull(controlDesigner.StandardBehavior); - Assert.Equal(Cursors.Default, controlDesigner.StandardBehavior.Cursor); + + controlDesigner.AssociatedComponents.Count.Should().Be(0); + controlDesigner.IsRootDesigner.Should().BeFalse(); + controlDesigner.SnapLines.Should().NotBeNull(); + controlDesigner.SnapLines.Count.Should().Be(8); + controlDesigner.StandardBehavior.Should().NotBeNull(); + controlDesigner.StandardBehavior.Cursor.Should().Be(Cursors.Default); } [Fact] - public void AccessibleObjectField() + public void InitializeControlDefaults() { - using TestControlDesigner controlDesigner = new(); - using Button button = new(); - controlDesigner.Initialize(button); - Assert.Null(controlDesigner.GetAccessibleObjectField()); + _designer.GetAccessibleObjectField().Should().BeNull(); + _designer.GetBehaviorServiceProperty().Should().BeNull(); + _designer.AccessibilityObject.Should().NotBeNull(); + _designer.GetEnableDragRectProperty().Should().BeFalse(); + _designer.ParticipatesWithSnapLines.Should().BeTrue(); + _designer.AutoResizeHandles.Should().BeFalse(); + _designer.GetInheritanceAttributeProperty().Should().NotBeNull(); + _designer.NumberOfInternalControlDesigners().Should().Be(0); + _designer.GetHitTestMethod(default).Should().BeFalse(); + _designer.HookChildControlsMethod(_designer._control); } [Fact] - public void BehaviorServiceProperty() + public void AutoResizeHandles_Set_GetReturnsExpected() { - using TestControlDesigner controlDesigner = new(); - using Button button = new(); - controlDesigner.Initialize(button); - Assert.Null(controlDesigner.GetBehaviorServiceProperty()); + _designer.AutoResizeHandles = true; + _designer.AutoResizeHandles.Should().BeTrue(); } - [Fact] - public void AccessibilityObjectField() + [Theory] + [InlineData(DockStyle.Top, SelectionRules.Moveable | SelectionRules.TopSizeable | SelectionRules.LeftSizeable | SelectionRules.RightSizeable)] + [InlineData(DockStyle.Left, SelectionRules.Moveable | SelectionRules.TopSizeable | SelectionRules.LeftSizeable | SelectionRules.BottomSizeable)] + [InlineData(DockStyle.Right, SelectionRules.Moveable | SelectionRules.TopSizeable | SelectionRules.BottomSizeable | SelectionRules.RightSizeable)] + [InlineData(DockStyle.Bottom, SelectionRules.Moveable | SelectionRules.LeftSizeable | SelectionRules.BottomSizeable | SelectionRules.RightSizeable)] + [InlineData(DockStyle.Fill, SelectionRules.Moveable | SelectionRules.TopSizeable | SelectionRules.LeftSizeable | SelectionRules.RightSizeable | SelectionRules.BottomSizeable)] + public void DockStyle_DefinesProperSelectionRules(DockStyle dockStyle, SelectionRules selectionRulesParam) { - using TestControlDesigner controlDesigner = new(); - using Button button = new(); - controlDesigner.Initialize(button); - Assert.NotNull(controlDesigner.AccessibilityObject); + _designer._control.Dock = dockStyle; + SelectionRules finalSelectionRules = _designer.SelectionRules; + + using (new NoAssertContext()) + { + finalSelectionRules &= ~selectionRulesParam; + } + + _designer.SelectionRules.Should().Be(finalSelectionRules); } [Fact] - public void EnableDragRectProperty() + public void BaseWndProc_Call_DoesNotThrow() { - using TestControlDesigner controlDesigner = new(); - using Button button = new(); - controlDesigner.Initialize(button); - Assert.False(controlDesigner.GetEnableDragRectProperty()); + Action action = () => + { + Message m = default; + _designer.BaseWndProcMethod(ref m); + }; + + action.Should().NotThrow(); } [Fact] - public void ParticipatesWithSnapLinesProperty() + public void CanBeParentedTo_WithValidParentControl_ReturnsTrue() { - using TestControlDesigner controlDesigner = new(); - using Button button = new(); - controlDesigner.Initialize(button); - Assert.True(controlDesigner.ParticipatesWithSnapLines); + using ParentControlDesigner parentDesigner = new(); + using Button parentButton = new(); + parentDesigner.Initialize(parentButton); + + _designer.CanBeParentedTo(parentDesigner).Should().BeTrue(); } - [Fact] - public void AutoResizeHandlesProperty() + [Theory] + [BoolData] + public void EnableDragDrop_DoesNotThrow(bool val) { - using TestControlDesigner controlDesigner = new(); - using Button button = new(); - controlDesigner.Initialize(button); - Assert.True(controlDesigner.AutoResizeHandles = true); - Assert.True(controlDesigner.AutoResizeHandles); + Action action = () => _designer.EnableDragDropMethod(val); + action.Should().NotThrow(); } [Fact] - public void SelectionRulesProperty() + public void Initialize_DoesNotThrow() { - using TestControlDesigner controlDesigner = new(); - using Button button = new(); - controlDesigner.Initialize(button); - - SelectionRules selectionRules; - using (new NoAssertContext()) + Action action = () => { - selectionRules = controlDesigner.SelectionRules; - } + using TestControlDesigner controlDesigner = new(); + using Button button = new(); - Assert.Equal(SelectionRules.Visible | SelectionRules.AllSizeable | SelectionRules.Moveable, selectionRules); + controlDesigner.Initialize(button); + }; + + action.Should().NotThrow(); } [Fact] - public void InheritanceAttributeProperty() + public void Uninitialized_ShouldThrowInvalidOperationException() { - using TestControlDesigner controlDesigner = new(); - using Button button = new(); - controlDesigner.Initialize(button); - Assert.NotNull(controlDesigner.GetInheritanceAttributeProperty()); + Action action = () => + { + using TestControlDesigner _designer = new(isInitialized: false); + using Control control = _designer.Control; + }; + + action.Should().Throw(); } [Fact] - public void NumberOfInternalControlDesignersTest() + public void OnSetComponentDefaultsTest() { - using TestControlDesigner controlDesigner = new(); - using Button button = new(); - controlDesigner.Initialize(button); - Assert.Equal(0, controlDesigner.NumberOfInternalControlDesigners()); +#pragma warning disable CS0618 // Type or member is obsolete + Action action = _designer.OnSetComponentDefaults; + action.Should().NotThrow(); +#pragma warning restore CS0618 } [Fact] - public void BaseWndProcTest() + public void OnContextMenu_DoesNotThrow() { - using TestControlDesigner controlDesigner = new(); - using Button button = new(); - controlDesigner.Initialize(button); - Message m = default; - controlDesigner.BaseWndProcMethod(ref m); + Action action = () => _designer.OnContextMenuMethod(0, 0); + action.Should().NotThrow(); } [Fact] - public void CanBeParentedToTest() + public void OnCreateHandle_DoesNotThrow() { - using TestControlDesigner controlDesigner = new(); - using Button button = new(); - controlDesigner.Initialize(button); - using ParentControlDesigner parentDesigner = new(); - using Button parentButton = new(); - parentDesigner.Initialize(parentButton); - Assert.True(controlDesigner.CanBeParentedTo(parentDesigner)); + Action action = _designer.OnCreateHandleMethod; + action.Should().NotThrow(); } - [Theory] - [BoolData] - public void EnableDragDropTest(bool val) + [WinFormsFact] + public void ControlDesigner_WndProc_InvokePaint_DoesNotThrow() { - using TestControlDesigner controlDesigner = new(); - using Button button = new(); - controlDesigner.Initialize(button); - controlDesigner.EnableDragDropMethod(val); + Action action = () => + { + Message m = new Message { Msg = (int)PInvokeCore.WM_PAINT }; + _designer.TestAccessor().Dynamic.WndProc(ref m); + }; + + action.Should().NotThrow(); } [Fact] - public void GetHitTest() + public void ControlDesigner_AssociatedComponents_NullSite_ShouldBeEmpty() { - using TestControlDesigner controlDesigner = new(); - using Button button = new(); - controlDesigner.Initialize(button); - Assert.False(controlDesigner.GetHitTestMethod(default)); + using Control childControl = new(); + + _designer.AssociatedComponents.Count.Should().Be(0); + + _designer._control.Controls.Add(childControl); + + _designer.AssociatedComponents.Count.Should().Be(0); } - [Fact] - public void HookChildControlsTest() + [WinFormsFact] + public void ControlDesigner_AssociatedComponentsCount_ShouldBeCorrectAmount() { - using TestControlDesigner controlDesigner = new(); - using Button button = new(); - controlDesigner.Initialize(button); - controlDesigner.HookChildControlsMethod(new Control()); + var mockSite = MockSite.CreateMockSiteWithDesignerHost(_designer._mockDesignerHost.Object); + _designer._control.Site = mockSite.Object; + + _designer.AssociatedComponents.Count.Should().Be(0); + + using Control childControl = new(); + childControl.Site = mockSite.Object; + _designer._control.Controls.Add(childControl); + + _designer.AssociatedComponents.Count.Should().Be(1); } [Fact] - public void InitializeTest() + public void GetGlyphs_Locked_ReturnsLockedGlyphs() { - using TestControlDesigner controlDesigner = new(); - using Button button = new(); - controlDesigner.Initialize(button); + Mock mockServiceProvider = new(); + mockServiceProvider.Setup(s => s.GetService(It.IsAny())).Returns((object?)null); + + Mock mockDesignerFrame = new(_designer._control.Site!) { CallBase = true }; + BehaviorService behaviorService = new(mockServiceProvider.Object, mockDesignerFrame.Object); + + _designer.TestAccessor().Dynamic._behaviorService = behaviorService; + _designer.TestAccessor().Dynamic.Locked = true; + + GlyphCollection glyphs = _designer.GetGlyphs(GlyphSelectionType.SelectedPrimary); + + glyphs.Count.Should().BeGreaterThan(0); + glyphs.Should().BeOfType(); + glyphs[0].Should().BeOfType(); } [Fact] - public void UninitializedTest() + public void GetGlyphs_GlyphSelectionTypeNotSelected_ReturnsEmptyCollection() { - using TestControlDesigner controlDesigner = new(); - Assert.Throws(() => controlDesigner.Control); + GlyphCollection glyphs = _designer.GetGlyphs(GlyphSelectionType.NotSelected); + + glyphs.Count.Should().Be(0); } [Fact] - public void OnSetComponentDefaultsTest() + public void GetGlyphs_WithNullBehaviorService_ThrowsException() { - using TestControlDesigner controlDesigner = new(); - using Button button = new(); - controlDesigner.Initialize(button); -#pragma warning disable CS0618 // Type or member is obsolete - controlDesigner.OnSetComponentDefaults(); -#pragma warning restore CS0618 + _designer.TestAccessor().Dynamic._behaviorService = null; + + Action action = () => _designer.GetGlyphs(GlyphSelectionType.SelectedPrimary); + action.Should().Throw(); } [Fact] - public void OnContextMenuTest() + public void GetGlyphs_NonSizeableControl_ReturnsNoResizeHandleGlyphs() { - using TestControlDesigner controlDesigner = new(); - using Button button = new(); - controlDesigner.Initialize(button); - controlDesigner.OnContextMenuMethod(0, 0); + _designer._control.Dock = DockStyle.Fill; + _designer._control.AutoSize = false; + + Mock mockDesignerFrame = new(_designer._mockSite.Object) { CallBase = true }; + Mock mockServiceProvider = new(); + BehaviorService behaviorService = new(mockServiceProvider.Object, mockDesignerFrame.Object); + _designer._mockSite.Setup(s => s.GetService(typeof(BehaviorService))).Returns(behaviorService); + + _designer.TestAccessor().Dynamic._behaviorService = behaviorService; + + GlyphCollection glyphs = _designer.GetGlyphs(GlyphSelectionType.SelectedPrimary); + + glyphs[0].Should().BeOfType(); + ((SelectionRules)glyphs[0].TestAccessor().Dynamic.rules).Should().Be(SelectionRules.None); + glyphs[1].Should().BeOfType(); + ((SelectionRules)glyphs[1].TestAccessor().Dynamic.rules).Should().Be(SelectionRules.None); + glyphs[2].Should().BeOfType(); + ((SelectionRules)glyphs[2].TestAccessor().Dynamic.rules).Should().Be(SelectionRules.None); + glyphs[3].Should().BeOfType(); + ((SelectionRules)glyphs[3].TestAccessor().Dynamic.rules).Should().Be(SelectionRules.None); + glyphs[4].Should().BeOfType(); + ((SelectionRules)glyphs[4].TestAccessor().Dynamic.rules).Should().Be(SelectionRules.None); } [Fact] - public void OnCreateHandleTest() + public void GetGlyphs_ResizableGlyphs_ReturnsExpected() { - using TestControlDesigner controlDesigner = new(); - using Button button = new(); - controlDesigner.Initialize(button); - controlDesigner.OnCreateHandleMethod(); - } + _designer._control.Dock = DockStyle.None; + _designer._control.AutoSize = false; - [WinFormsFact] - public void ControlDesigner_WndProc_InvokePaint_Success() - { - using ControlDesigner designer = new(); - using Button button = new(); - designer.Initialize(button); - Message m = new Message + Mock mockServiceProvider = new(); + mockServiceProvider.Setup(s => s.GetService(It.IsAny())).Returns((object?)null); + _designer._mockSite.Setup(s => s.GetService(typeof(IServiceProvider))).Returns(mockServiceProvider.Object); + + Mock mockDesignerFrame = new(_designer._mockSite.Object) { CallBase = true }; + BehaviorService behaviorService = new(mockServiceProvider.Object, mockDesignerFrame.Object); + + _designer.TestAccessor().Dynamic._behaviorService = behaviorService; + + GlyphCollection glyphs = _designer.GetGlyphs(GlyphSelectionType.SelectedPrimary); + + var expectedGlyphs = new (Type glyphType, SelectionRules rules)[] { - Msg = (int)PInvokeCore.WM_PAINT + (typeof(GrabHandleGlyph), SelectionRules.None), + (typeof(GrabHandleGlyph), SelectionRules.TopSizeable | SelectionRules.LeftSizeable), + (typeof(GrabHandleGlyph), SelectionRules.TopSizeable | SelectionRules.RightSizeable), + (typeof(GrabHandleGlyph), SelectionRules.None), + (typeof(GrabHandleGlyph), SelectionRules.BottomSizeable | SelectionRules.LeftSizeable), + (typeof(GrabHandleGlyph), SelectionRules.BottomSizeable | SelectionRules.RightSizeable), + (typeof(GrabHandleGlyph), SelectionRules.None), + (typeof(GrabHandleGlyph), SelectionRules.None), + (typeof(SelectionBorderGlyph), SelectionRules.TopSizeable), + (typeof(SelectionBorderGlyph), SelectionRules.BottomSizeable), + (typeof(SelectionBorderGlyph), SelectionRules.LeftSizeable), + (typeof(SelectionBorderGlyph), SelectionRules.RightSizeable), }; - designer.TestAccessor().Dynamic.WndProc(ref m); + + for (int i = 0; i < expectedGlyphs.Length; i++) + { + glyphs[i].Should().BeOfType(expectedGlyphs[i].glyphType); + ((SelectionRules)glyphs[i].TestAccessor().Dynamic.rules).Should().Be(expectedGlyphs[i].rules); + } } - [Fact] - public void ControlDesigner_AssociatedComponents_NullSite_Test() + [Theory] + [InlineData(DockingBehavior.Never, DockStyle.None)] + [InlineData(DockingBehavior.AutoDock, DockStyle.Fill)] + public void InitializeNewComponent_DockingBehavior_DefinesDockStyle(DockingBehavior dockingBehavior, DockStyle dockStyle) { - using ControlDesigner controlDesigner = new(); - using Control control = new(); + TypeDescriptor.AddAttributes(_designer._control, new DockingAttribute(dockingBehavior)); - using Control childControl = new(); - controlDesigner.Initialize(control); + Mock mockParentDesigner = new(); + _designer._mockDesignerHost.Setup(h => h.GetDesigner(It.IsAny())).Returns(mockParentDesigner.Object); - Assert.Empty(controlDesigner.AssociatedComponents); + Dictionary defaultValues = new() + { + { "Parent", new Control() } + }; - control.Controls.Add(childControl); + _designer.InitializeNewComponent(defaultValues); - Assert.Empty(controlDesigner.AssociatedComponents); + PropertyDescriptor? dockPropDescriptor = TypeDescriptor.GetProperties(_designer._control)[nameof(Control.Dock)]; + dockPropDescriptor.Should().NotBeNull(); + dockPropDescriptor.Should().BeAssignableTo(); + dockPropDescriptor?.GetValue(_designer._control).Should().Be(dockStyle); } - [WinFormsFact] - public void ControlDesigner_AssociatedComponentsTest() + [Fact] + public void InitializeExistingComponent_DockingBehavior_DefinesDockStyle() { - using Control control = new(); - using ControlDesigner controlDesigner = new(); + TypeDescriptor.AddAttributes(_designer._control, new DockingAttribute(DockingBehavior.AutoDock)); - Mock mockDesignerHost = new(MockBehavior.Strict); - mockDesignerHost - .Setup(h => h.RootComponent) - .Returns(control); - mockDesignerHost - .Setup(s => s.GetDesigner(It.IsAny())) - .Returns(() => null); - var mockSite = MockSite.CreateMockSiteWithDesignerHost(mockDesignerHost.Object); - control.Site = mockSite.Object; + Mock mockParentDesigner = new(); + _designer._mockDesignerHost.Setup(h => h.GetDesigner(It.IsAny())).Returns(mockParentDesigner.Object); + Dictionary defaultValues = new() + { + { nameof(mockParentDesigner.Object.Component), new Control() } + }; - controlDesigner.Initialize(control); + Action action = () => _designer.InitializeExistingComponent(defaultValues); - Assert.Empty(controlDesigner.AssociatedComponents); + action.Should().Throw(SR.NotImplementedByDesign); + } - using Control childControl = new(); - childControl.Site = mockSite.Object; - control.Controls.Add(childControl); + [Fact] + public void WndProc_CallsOnMouseDragEnd_WhenLeftMouseButtonReleased() + { + var msg = Message.Create(_designer._control.Handle, 0x0202, IntPtr.Zero, IntPtr.Zero); + + _designer.WndProc(ref msg); + + _designer.OnMouseDragEndCalled.Should().BeTrue(); - Assert.Single(controlDesigner.AssociatedComponents); + bool _ctrlSelect = (bool)_designer.TestAccessor().Dynamic._ctrlSelect; + _ctrlSelect.Should().BeFalse(); } } diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/TestControlDesigner.Mocks.cs b/src/System.Windows.Forms.Design/tests/UnitTests/TestControlDesigner.Mocks.cs new file mode 100644 index 00000000000..8e631a92288 --- /dev/null +++ b/src/System.Windows.Forms.Design/tests/UnitTests/TestControlDesigner.Mocks.cs @@ -0,0 +1,116 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using System.ComponentModel; +using System.ComponentModel.Design; +using Moq; + +namespace System.Windows.Forms.Design.Tests; + +internal partial class TestControlDesigner +{ + internal readonly Control _control = new(); + internal readonly Mock _mockDesignerHost = new(); + internal readonly Mock _mockSite = new(); + + public TestControlDesigner(bool isInitialized = true) + { + _mockDesignerHost + .Setup(h => h.RootComponent) + .Returns(_control); + _mockDesignerHost + .Setup(s => s.GetDesigner(It.IsAny())) + .Returns(this); + Mock mockComponentChangeService = new(); + _mockDesignerHost + .Setup(s => s.GetService(typeof(IComponentChangeService))) + .Returns(mockComponentChangeService.Object); + _mockSite = CreateMockSiteWithDesignerHost(_mockDesignerHost.Object); + _control.Site = _mockSite.Object; + + if (isInitialized) + { + Initialize(_control); + } + } + + public new void Dispose() + { + _control.Dispose(); + } + + public static Mock CreateMockSiteWithDesignerHost(object designerHost) + { + Mock mockSite = new(); + mockSite + .Setup(s => s.GetService(typeof(IDesignerHost))) + .Returns(designerHost); + mockSite + .Setup(s => s.GetService(typeof(IInheritanceService))) + .Returns((object?)null); + mockSite + .Setup(s => s.GetService(typeof(IDictionaryService))) + .Returns((object?)null); + mockSite + .Setup(s => s.GetService(typeof(IExtenderListService))) + .Returns((object?)null); + mockSite + .Setup(s => s.GetService(typeof(ITypeDescriptorFilterService))) + .Returns((object?)null); + mockSite + .Setup(s => s.GetService(typeof(AmbientProperties))) + .Returns((object?)null); + mockSite + .Setup(s => s.GetService(typeof(DesignerActionService))) + .Returns((object?)null); + mockSite + .Setup(s => s.GetService(typeof(IComponentChangeService))) + .Returns((object?)null); + mockSite + .Setup(s => s.GetService(typeof(ToolStripKeyboardHandlingService))) + .Returns((object?)null); + mockSite + .Setup(s => s.GetService(typeof(ISupportInSituService))) + .Returns((object?)null); + mockSite + .Setup(s => s.GetService(typeof(INestedContainer))) + .Returns((object?)null); + mockSite + .Setup(s => s.GetService(typeof(ToolStripMenuItem))) + .Returns((object?)null); + + Mock mockServiceProvider = new(); + + mockSite + .Setup(s => s.GetService(typeof(IServiceProvider))) + .Returns(mockServiceProvider.Object); + mockSite + .Setup(s => s.GetService(typeof(ToolStripAdornerWindowService))) + .Returns((object?)null); + mockSite + .Setup(s => s.GetService(typeof(DesignerOptionService))) + .Returns(mockServiceProvider.Object); + + Mock mockSelectionService = new(); + + mockSite + .Setup(s => s.GetService(typeof(ISelectionService))) + .Returns(mockSelectionService.Object); + mockSite + .Setup(s => s.Container) + .Returns((IContainer?)null); + mockSite + .Setup(s => s.Name) + .Returns("Site"); + mockSite + .Setup(s => s.DesignMode) + .Returns(true); + mockSite + .Setup(s => s.GetService(typeof(UndoEngine))) + .Returns((object?)null); + + return mockSite; + } +} diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/TestControlDesigner.cs b/src/System.Windows.Forms.Design/tests/UnitTests/TestControlDesigner.cs index 1f8e465d66d..3f227316583 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/TestControlDesigner.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/TestControlDesigner.cs @@ -7,8 +7,10 @@ namespace System.Windows.Forms.Design.Tests; -internal class TestControlDesigner : ControlDesigner +internal partial class TestControlDesigner : ControlDesigner { + internal bool OnMouseDragEndCalled { get; private set; } + internal AccessibleObject GetAccessibleObjectField() { return accessibilityObj; @@ -88,4 +90,16 @@ internal void OnCreateHandleMethod() { OnCreateHandle(); } + + internal new void WndProc(ref Message m) + { + base.WndProc(ref m); + } + + protected override void OnMouseDragEnd(bool cancel) + { + OnMouseDragEndCalled = true; + + base.OnMouseDragEnd(cancel); + } } From abad7ec56eb3abe50d39b9f5563179a7cdae8f13 Mon Sep 17 00:00:00 2001 From: Tanya Solyanik Date: Mon, 18 Nov 2024 15:42:24 -0800 Subject: [PATCH 029/106] Sealed the internal DataStore class, and some minor clean-up (#12503) * Seal the internal DataStore, and some minor clean-up * Run test that sets HighDpiMode in a separate process using RemoteExecutor --- Winforms.sln | 1 + .../WindowsFormsApplicationBase.vb | 2 +- .../Forms/WindowsFormsApplicationBaseTests.vb | 23 ++++-- .../VisualBasic/Devices/ComputerTests.cs | 5 +- .../BinaryFormatWriterTests.cs | 4 +- .../SerializationRecordExtensionsTests.cs | 2 +- .../src/System/Resources/ResXDataNode.cs | 2 +- ...ect.Composition.NativeToWinFormsAdapter.cs | 8 ++- ...ect.Composition.WinFormsToNativeAdapter.cs | 10 +-- .../Forms/OLE/DataObject.Composition.cs | 24 +++---- .../DataObject.DataStore.DataStoreEntry.cs | 22 ++++++ .../Windows/Forms/OLE/DataObject.DataStore.cs | 71 +++++++------------ .../Windows/Forms/OLE/DragDropFormat.cs | 2 +- .../ComDisabledTests/ClipboardComTests.cs | 5 +- .../UIIntegrationTests/DragDropTests.cs | 20 +++--- .../Forms/BinaryFormatUtilitiesTests.cs | 38 +++++----- .../System/Windows/Forms/ClipboardTests.cs | 32 ++++++--- .../Forms/DataObjectTests.ClipboardTests.cs | 5 +- .../Windows/Forms/DragDropHelperTests.cs | 25 +++---- .../Windows/Forms/DragEventArgsTests.cs | 11 --- .../Windows/Forms/ToolStripItemTests.cs | 19 ----- 21 files changed, 167 insertions(+), 164 deletions(-) create mode 100644 src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.DataStore.DataStoreEntry.cs diff --git a/Winforms.sln b/Winforms.sln index 6ffe8d242b9..2e590cb4b85 100644 --- a/Winforms.sln +++ b/Winforms.sln @@ -55,6 +55,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "documentation", "documentat docs\developer-guide.md = docs\developer-guide.md docs\getting-started.md = docs\getting-started.md docs\issue-guide.md = docs\issue-guide.md + docs\list-of-diagnostics.md = docs\list-of-diagnostics.md docs\porting-guidelines.md = docs\porting-guidelines.md README.md = README.md docs\roadmap.md = docs\roadmap.md diff --git a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBase.vb b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBase.vb index 69b3aaf9143..da8e9275442 100644 --- a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBase.vb +++ b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBase.vb @@ -776,7 +776,7 @@ Namespace Microsoft.VisualBasic.ApplicationServices If dpiSetResult Then _highDpiMode = Application.HighDpiMode End If - Debug.Assert(dpiSetResult, "We could net set the HighDpiMode.") + Debug.Assert(dpiSetResult, "We could not set the HighDpiMode.") ' Now, let's set VisualStyles and ColorMode: If _enableVisualStyles Then diff --git a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/WindowsFormsApplicationBaseTests.vb b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/WindowsFormsApplicationBaseTests.vb index 4bccd1cd23d..7e1008676a2 100644 --- a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/WindowsFormsApplicationBaseTests.vb +++ b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/WindowsFormsApplicationBaseTests.vb @@ -4,6 +4,7 @@ Imports System.ComponentModel Imports System.Windows.Forms Imports FluentAssertions +Imports Microsoft.DotNet.RemoteExecutor Imports Microsoft.VisualBasic.ApplicationServices Imports Xunit @@ -89,17 +90,27 @@ Namespace Microsoft.VisualBasic.Forms.Tests End Using End Sub - - Public Sub Run_DoEvents() + Public Sub DoEvents_DoesNotThrow() Dim testCode As Action = Sub() DoEvents() testCode.Should.NotThrow() End Sub - Public Sub Run_SingleInstanceNoStartupFormException() - IsSingleInstance = True - Dim testCode As Action = Sub() Run(commandLine:={"1"}) - testCode.Should.Throw(Of NoStartupFormException)() + Public Sub Run_SingleInstance_ThrowsNoStartupFormException() + ' WindowsFormsApplicationBase.Run method can change process-wide settings, such as HighDpiMode, + ' it should run in a dedicated process. + If (RemoteExecutor.IsSupported) Then + Dim test As Action = + Sub() + IsSingleInstance = True + Dim testCode As Action = Sub() Run(commandLine:={"1"}) + testCode.Should.Throw(Of NoStartupFormException)() + End Sub + + Using handle As RemoteInvokeHandle = RemoteExecutor.Invoke(test) + handle.ExitCode.Should.Be(RemoteExecutor.SuccessExitCode) + End Using + End If End Sub diff --git a/src/Microsoft.VisualBasic/tests/UnitTests/Microsoft/VisualBasic/Devices/ComputerTests.cs b/src/Microsoft.VisualBasic/tests/UnitTests/Microsoft/VisualBasic/Devices/ComputerTests.cs index 1f63c084fd7..77e823131e9 100644 --- a/src/Microsoft.VisualBasic/tests/UnitTests/Microsoft/VisualBasic/Devices/ComputerTests.cs +++ b/src/Microsoft.VisualBasic/tests/UnitTests/Microsoft/VisualBasic/Devices/ComputerTests.cs @@ -3,12 +3,11 @@ namespace Microsoft.VisualBasic.Devices.Tests; -[Collection("Sequential")] -[CollectionDefinition("Sequential", DisableParallelization = true)] -[UISettings(MaxAttempts = 3)] // Try up to 3 times before failing. public class ComputerTests { [Fact] + // This test does not modify the system clipboard state, do not move it into the + // sequential collection, it is safe to run in parallel with other tests in this assembly. public void Properties() { Computer computer = new(); diff --git a/src/System.Private.Windows.Core/tests/BinaryFormatTests/FormatTests/FormattedObject/BinaryFormatWriterTests.cs b/src/System.Private.Windows.Core/tests/BinaryFormatTests/FormatTests/FormattedObject/BinaryFormatWriterTests.cs index 771fd2fb064..046c76e8e9e 100644 --- a/src/System.Private.Windows.Core/tests/BinaryFormatTests/FormatTests/FormattedObject/BinaryFormatWriterTests.cs +++ b/src/System.Private.Windows.Core/tests/BinaryFormatTests/FormatTests/FormattedObject/BinaryFormatWriterTests.cs @@ -162,8 +162,8 @@ public void BinaryFormatWriter_TryWriteDrawingPrimitivesObject_UnsupportedObject stream.Position.Should().Be(0); } - public static IEnumerable TryWriteFrameworkObject_SupportedObjects_TestData => - ((IEnumerable)HashtableTests.Hashtables_TestData).Concat( + public static IEnumerable TryWriteFrameworkObject_SupportedObjects_TestData => + ((IEnumerable)HashtableTests.Hashtables_TestData).Concat( ListTests.PrimitiveLists_TestData).Concat( ListTests.ArrayLists_TestData).Concat( PrimitiveTypeTests.Primitive_Data).Concat( diff --git a/src/System.Private.Windows.Core/tests/BinaryFormatTests/SerializationRecordExtensionsTests.cs b/src/System.Private.Windows.Core/tests/BinaryFormatTests/SerializationRecordExtensionsTests.cs index 8008039091d..ab9c11d1b9c 100644 --- a/src/System.Private.Windows.Core/tests/BinaryFormatTests/SerializationRecordExtensionsTests.cs +++ b/src/System.Private.Windows.Core/tests/BinaryFormatTests/SerializationRecordExtensionsTests.cs @@ -11,7 +11,7 @@ namespace System.Windows.Forms.Nrbf.Tests; public class SerializationRecordExtensionsTests { - public static IEnumerable TryGetFrameworkObject_SupportedObjects_TestData => + public static IEnumerable TryGetFrameworkObject_SupportedObjects_TestData => BinaryFormatWriterTests.TryWriteFrameworkObject_SupportedObjects_TestData; [Theory] diff --git a/src/System.Windows.Forms/src/System/Resources/ResXDataNode.cs b/src/System.Windows.Forms/src/System/Resources/ResXDataNode.cs index de384a8e37e..c52897a0d83 100644 --- a/src/System.Windows.Forms/src/System/Resources/ResXDataNode.cs +++ b/src/System.Windows.Forms/src/System/Resources/ResXDataNode.cs @@ -160,7 +160,7 @@ public string Name } set { - ArgumentException.ThrowIfNullOrEmpty(value, nameof(Name)); + ArgumentException.ThrowIfNullOrEmpty(value); _name = value; } } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs index 147e8f6bc15..6cb0aff2209 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs @@ -111,8 +111,10 @@ DataFormats.TextConstant or DataFormats.RtfConstant or DataFormats.OemTextConsta static object ReadObjectFromHGLOBAL(HGLOBAL hglobal, bool restrictDeserialization) { - MemoryStream stream = ReadByteStreamFromHGLOBAL(hglobal, out bool isSerializedObject); - return !isSerializedObject ? stream : BinaryFormatUtilities.ReadObjectFromStream(stream, restrictDeserialization); + MemoryStream stream = ReadByteStreamFromHGLOBAL(hglobal, out bool isSerializedObject); + return !isSerializedObject + ? stream + : BinaryFormatUtilities.ReadObjectFromStream(stream, restrictDeserialization); } } @@ -132,7 +134,7 @@ private static unsafe MemoryStream ReadByteStreamFromHGLOBAL(HGLOBAL hglobal, ou int index = 0; // The object here can either be a stream or a serialized object. We identify a serialized object - // by writing the bytes for the guid serializedObjectID at the front of the stream. + // by writing the bytes for the GUID serializedObjectID at the front of the stream. if (isSerializedObject = bytes.AsSpan().StartsWith(s_serializedObjectID)) { diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.WinFormsToNativeAdapter.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.WinFormsToNativeAdapter.cs index 02968c2e6f7..2f5511e7074 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.WinFormsToNativeAdapter.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.WinFormsToNativeAdapter.cs @@ -29,9 +29,9 @@ public WinFormsToNativeAdapter(IDataObject dataObject) } /// - /// Returns true if the tymed is useable. + /// Returns true if the tymed is usable. /// - private static bool GetTymedUseable(TYMED tymed) => (tymed & AllowedTymeds) != 0; + private static bool GetTymedUsable(TYMED tymed) => (tymed & AllowedTymeds) != 0; HRESULT Com.IDataObject.Interface.GetData(FORMATETC* pformatetcIn, STGMEDIUM* pmedium) { @@ -63,7 +63,7 @@ HRESULT Com.IDataObject.Interface.GetData(FORMATETC* pformatetcIn, STGMEDIUM* pm *pmedium = default; - if (!GetTymedUseable((TYMED)pformatetcIn->tymed)) + if (!GetTymedUsable((TYMED)pformatetcIn->tymed)) { return HRESULT.DV_E_TYMED; } @@ -104,7 +104,7 @@ HRESULT Com.IDataObject.Interface.GetDataHere(FORMATETC* pformatetc, STGMEDIUM* return HRESULT.E_POINTER; } - if (!GetTymedUseable((TYMED)pformatetc->tymed) || !GetTymedUseable(pmedium->tymed)) + if (!GetTymedUsable((TYMED)pformatetc->tymed) || !GetTymedUsable(pmedium->tymed)) { return HRESULT.DV_E_TYMED; } @@ -191,7 +191,7 @@ HRESULT Com.IDataObject.Interface.QueryGetData(FORMATETC* pformatetc) return HRESULT.DV_E_DVASPECT; } - if (!GetTymedUseable((TYMED)pformatetc->tymed)) + if (!GetTymedUsable((TYMED)pformatetc->tymed)) { return HRESULT.DV_E_TYMED; } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.cs index 95441e38688..10f0869a1a0 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.cs @@ -104,18 +104,18 @@ or DataFormats.PaletteConstant or DataFormats.WmfConstant; #region IDataObject - object? IDataObject.GetData(string format, bool autoConvert) => _winFormsDataObject.GetData(format, autoConvert); - object? IDataObject.GetData(string format) => _winFormsDataObject.GetData(format); - object? IDataObject.GetData(Type format) => _winFormsDataObject.GetData(format); - bool IDataObject.GetDataPresent(string format, bool autoConvert) => _winFormsDataObject.GetDataPresent(format, autoConvert); - bool IDataObject.GetDataPresent(string format) => _winFormsDataObject.GetDataPresent(format); - bool IDataObject.GetDataPresent(Type format) => _winFormsDataObject.GetDataPresent(format); - string[] IDataObject.GetFormats(bool autoConvert) => _winFormsDataObject.GetFormats(autoConvert); - string[] IDataObject.GetFormats() => _winFormsDataObject.GetFormats(); - void IDataObject.SetData(string format, bool autoConvert, object? data) => _winFormsDataObject.SetData(format, autoConvert, data); - void IDataObject.SetData(string format, object? data) => _winFormsDataObject.SetData(format, data); - void IDataObject.SetData(Type format, object? data) => _winFormsDataObject.SetData(format, data); - void IDataObject.SetData(object? data) => _winFormsDataObject.SetData(data); + public object? GetData(string format, bool autoConvert) => _winFormsDataObject.GetData(format, autoConvert); + public object? GetData(string format) => _winFormsDataObject.GetData(format); + public object? GetData(Type format) => _winFormsDataObject.GetData(format); + public bool GetDataPresent(string format, bool autoConvert) => _winFormsDataObject.GetDataPresent(format, autoConvert); + public bool GetDataPresent(string format) => _winFormsDataObject.GetDataPresent(format); + public bool GetDataPresent(Type format) => _winFormsDataObject.GetDataPresent(format); + public string[] GetFormats(bool autoConvert) => _winFormsDataObject.GetFormats(autoConvert); + public string[] GetFormats() => _winFormsDataObject.GetFormats(); + public void SetData(string format, bool autoConvert, object? data) => _winFormsDataObject.SetData(format, autoConvert, data); + public void SetData(string format, object? data) => _winFormsDataObject.SetData(format, data); + public void SetData(Type format, object? data) => _winFormsDataObject.SetData(format, data); + public void SetData(object? data) => _winFormsDataObject.SetData(data); #endregion #region Com.IDataObject.Interface diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.DataStore.DataStoreEntry.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.DataStore.DataStoreEntry.cs new file mode 100644 index 00000000000..c845146a15c --- /dev/null +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.DataStore.DataStoreEntry.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Windows.Forms; + +public partial class DataObject +{ + private sealed partial class DataStore + { + private class DataStoreEntry + { + public object? Data { get; } + public bool AutoConvert { get; } + + public DataStoreEntry(object? data, bool autoConvert) + { + Data = data; + AutoConvert = autoConvert; + } + } + } +} diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.DataStore.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.DataStore.cs index d957d245b78..67858579e99 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.DataStore.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.DataStore.cs @@ -9,27 +9,11 @@ namespace System.Windows.Forms; public partial class DataObject { - private class DataStore : IDataObject + private sealed partial class DataStore : IDataObject { - private class DataStoreEntry - { - public object? Data { get; } - public bool AutoConvert { get; } - - public DataStoreEntry(object? data, bool autoConvert) - { - Data = data; - AutoConvert = autoConvert; - } - } - - private readonly Dictionary _data = new(BackCompatibleStringComparer.Default); + private readonly Dictionary _mappedData = new(BackCompatibleStringComparer.Default); - public DataStore() - { - } - - public virtual object? GetData(string format, bool autoConvert) + public object? GetData(string format, bool autoConvert) { if (string.IsNullOrWhiteSpace(format)) { @@ -37,7 +21,7 @@ public DataStore() } object? baseVar = null; - if (_data.TryGetValue(format, out DataStoreEntry? dse)) + if (_mappedData.TryGetValue(format, out DataStoreEntry? dse)) { baseVar = dse.Data; } @@ -55,7 +39,7 @@ public DataStore() { if (!format.Equals(mappedFormats[i])) { - if (_data.TryGetValue(mappedFormats[i], out DataStoreEntry? found)) + if (_mappedData.TryGetValue(mappedFormats[i], out DataStoreEntry? found)) { baseVar = found.Data; } @@ -73,11 +57,11 @@ public DataStore() return original ?? baseVar; } - public virtual object? GetData(string format) => GetData(format, autoConvert: true); + public object? GetData(string format) => GetData(format, autoConvert: true); - public virtual object? GetData(Type format) => GetData(format.FullName!); + public object? GetData(Type format) => GetData(format.FullName!); - public virtual void SetData(string format, bool autoConvert, object? data) + public void SetData(string format, bool autoConvert, object? data) { if (string.IsNullOrWhiteSpace(format)) { @@ -100,23 +84,23 @@ public virtual void SetData(string format, bool autoConvert, object? data) } } - _data[format] = new DataStoreEntry(data, autoConvert); + _mappedData[format] = new DataStoreEntry(data, autoConvert); } - public virtual void SetData(string format, object? data) => SetData(format, autoConvert: true, data); + public void SetData(string format, object? data) => SetData(format, autoConvert: true, data); - public virtual void SetData(Type format, object? data) + public void SetData(Type format, object? data) { ArgumentNullException.ThrowIfNull(format); SetData(format.FullName!, data); } - public virtual void SetData(object? data) + public void SetData(object? data) { ArgumentNullException.ThrowIfNull(data); if (data is ISerializable - && !_data.ContainsKey(DataFormats.Serializable)) + && !_mappedData.ContainsKey(DataFormats.Serializable)) { SetData(DataFormats.Serializable, data); } @@ -124,12 +108,9 @@ public virtual void SetData(object? data) SetData(data.GetType(), data); } - public virtual bool GetDataPresent(Type format) - { - return GetDataPresent(format.FullName!); - } + public bool GetDataPresent(Type format) => GetDataPresent(format.FullName!); - public virtual bool GetDataPresent(string format, bool autoConvert) + public bool GetDataPresent(string format, bool autoConvert) { if (string.IsNullOrWhiteSpace(format)) { @@ -138,8 +119,8 @@ public virtual bool GetDataPresent(string format, bool autoConvert) if (!autoConvert) { - Debug.Assert(_data is not null, "data must be non-null"); - return _data.ContainsKey(format); + Debug.Assert(_mappedData is not null, "data must be non-null"); + return _mappedData.ContainsKey(format); } else { @@ -159,15 +140,15 @@ public virtual bool GetDataPresent(string format, bool autoConvert) } } - public virtual bool GetDataPresent(string format) => GetDataPresent(format, autoConvert: true); + public bool GetDataPresent(string format) => GetDataPresent(format, autoConvert: true); - public virtual string[] GetFormats(bool autoConvert) + public string[] GetFormats(bool autoConvert) { - Debug.Assert(_data is not null, "data collection can't be null"); - Debug.Assert(_data.Keys is not null, "data Keys collection can't be null"); + Debug.Assert(_mappedData is not null, "data collection can't be null"); + Debug.Assert(_mappedData.Keys is not null, "data Keys collection can't be null"); - string[] baseVar = new string[_data.Keys.Count]; - _data.Keys.CopyTo(baseVar, 0); + string[] baseVar = new string[_mappedData.Keys.Count]; + _mappedData.Keys.CopyTo(baseVar, 0); Debug.Assert(baseVar is not null, "Collections should never return NULL arrays!!!"); if (autoConvert) @@ -177,8 +158,8 @@ public virtual string[] GetFormats(bool autoConvert) HashSet distinctFormats = new(baseVarLength); for (int i = 0; i < baseVarLength; i++) { - Debug.Assert(_data[baseVar[i]] is not null, $"Null item in data collection with key '{baseVar[i]}'"); - if (_data[baseVar[i]]!.AutoConvert) + Debug.Assert(_mappedData[baseVar[i]] is not null, $"Null item in data collection with key '{baseVar[i]}'"); + if (_mappedData[baseVar[i]]!.AutoConvert) { string[] cur = GetMappedFormats(baseVar[i])!; Debug.Assert(cur is not null, $"GetMappedFormats returned null for '{baseVar[i]}'"); @@ -199,6 +180,6 @@ public virtual string[] GetFormats(bool autoConvert) return baseVar; } - public virtual string[] GetFormats() => GetFormats(autoConvert: true); + public string[] GetFormats() => GetFormats(autoConvert: true); } } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DragDropFormat.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DragDropFormat.cs index e6818b7df16..13c3ae10d2d 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DragDropFormat.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DragDropFormat.cs @@ -29,7 +29,7 @@ public DragDropFormat(ushort format, STGMEDIUM medium, bool copyData) } /// - /// Returns a copy of the storage mediumn in this instance. + /// Returns a copy of the storage medium in this instance. /// public STGMEDIUM GetData() => CopyData(_format, _medium); diff --git a/src/System.Windows.Forms/tests/ComDisabledTests/ClipboardComTests.cs b/src/System.Windows.Forms/tests/ComDisabledTests/ClipboardComTests.cs index 55649a8b8eb..10de5202c2a 100644 --- a/src/System.Windows.Forms/tests/ComDisabledTests/ClipboardComTests.cs +++ b/src/System.Windows.Forms/tests/ComDisabledTests/ClipboardComTests.cs @@ -5,8 +5,9 @@ namespace System.Windows.Forms.Tests; -[Collection("Sequential")] // Each registered Clipboard format is an OS singleton, - // and we should not run this test at the same time as other tests using the same format. +// Each registered Clipboard format is an OS singleton, +// and we should not run this test at the same time as other tests using the same format. +[Collection("Sequential")] [UISettings(MaxAttempts = 3)] // Try up to 3 times before failing. public class ClipboardComTests { diff --git a/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/DragDropTests.cs b/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/DragDropTests.cs index b2c96314870..bfd30f7eadf 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/DragDropTests.cs +++ b/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/DragDropTests.cs @@ -60,7 +60,7 @@ public async Task DragDrop_NonSerializedObject_ReturnsExpected_Async() // non-serialized object. Button? button = null; - object? data = null; + Button? data = null; await RunFormWithoutControlAsync(() => new Form(), async (form) => { form.AllowDrop = true; @@ -77,7 +77,7 @@ public async Task DragDrop_NonSerializedObject_ReturnsExpected_Async() if (e.Data?.GetDataPresent(typeof(Button)) ?? false) { // Get the non-serialized Button. - data = e.Data?.GetData(typeof(Button)); + data = (Button?)e.Data?.GetData(typeof(Button)); e.Effect = DragDropEffects.Copy; } }; @@ -116,9 +116,8 @@ await InputSimulator.SendAsync( }); Assert.NotNull(data); - Assert.True(data is Button); - Assert.Equal(button?.Name, ((Button)data).Name); - Assert.Equal(button?.Text, ((Button)data).Text); + Assert.Equal(button?.Name, data.Name); + Assert.Equal(button?.Text, data.Text); } [WinFormsFact(Skip = "Crashes dotnet.exe, see: https://github.com/dotnet/winforms/issues/8598")] @@ -275,7 +274,7 @@ public async Task DragDrop_SerializedObject_ReturnsExpected_Async() // Verifies that we can successfully drag and drop a serialized object. ListViewItem? listViewItem = null; - object? data = null; + ListViewItem? data = null; await RunFormWithoutControlAsync(() => new Form(), async (form) => { form.AllowDrop = true; @@ -292,7 +291,7 @@ public async Task DragDrop_SerializedObject_ReturnsExpected_Async() if (e.Data?.GetDataPresent(DataFormats.Serializable) ?? false) { // Get the serialized ListViewItem. - data = e.Data?.GetData(DataFormats.Serializable); + data = (ListViewItem?)e.Data?.GetData(DataFormats.Serializable); e.Effect = DragDropEffects.Copy; } }; @@ -330,9 +329,8 @@ await InputSimulator.SendAsync( }); Assert.NotNull(data); - Assert.True(data is ListViewItem); - Assert.Equal(listViewItem?.Name, ((ListViewItem)data).Name); - Assert.Equal(listViewItem?.Text, ((ListViewItem)data).Text); + Assert.Equal(listViewItem?.Name, data.Name); + Assert.Equal(listViewItem?.Text, data.Text); } [WinFormsFact] @@ -861,7 +859,7 @@ private void ListDragSource_QueryContinueDrag(object? sender, QueryContinueDragE ((MousePosition.Y - _screenOffset.Y) < form.DesktopBounds.Top) || ((MousePosition.Y - _screenOffset.Y) > form.DesktopBounds.Bottom)) { - _testOutputHelper.WriteLine($"Cancelling drag."); + _testOutputHelper.WriteLine($"Canceling drag."); e.Action = DragAction.Cancel; } } diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.cs index 3459743c23b..aa2ad96651c 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.cs @@ -173,34 +173,34 @@ private void WriteObjectToStream(object value, bool restrictSerialization = fals [Theory] [MemberData(nameof(PrimitiveObjects_TheoryData))] [MemberData(nameof(KnownObjects_TheoryData))] - public void BinaryFormatUtilities_RoundTrip_Simple(object value) => + public void RoundTrip_Simple(object value) => RoundTripObject(value).Should().Be(value); [Theory] [MemberData(nameof(PrimitiveObjects_TheoryData))] [MemberData(nameof(KnownObjects_TheoryData))] - public void BinaryFormatUtilities_RoundTripRestrictedFormat_Simple(object value) => + public void RoundTrip_RestrictedFormat_Simple(object value) => RoundTripObject_RestrictedFormat(value).Should().Be(value); [Theory] [MemberData(nameof(NotSupportedException_TestData))] - public void BinaryFormatUtilities_RoundTrip_NotSupportedException(NotSupportedException value) => + public void RoundTrip_NotSupportedException(NotSupportedException value) => RoundTripObject(value).Should().BeEquivalentTo(value); [Theory] [MemberData(nameof(NotSupportedException_TestData))] - public void BinaryFormatUtilities_RoundTripRestrictedFormat_NotSupportedException(NotSupportedException value) => + public void RoundTrip_RestrictedFormat_NotSupportedException(NotSupportedException value) => RoundTripObject_RestrictedFormat(value).Should().BeEquivalentTo(value); [Fact] - public void BinaryFormatUtilities_RoundTrip_NotSupportedException_DataLoss() + public void RoundTrip_NotSupportedException_DataLoss() { NotSupportedException value = new("Error message", new ArgumentException()); RoundTripObject(value).Should().BeEquivalentTo(new NotSupportedException("Error message", innerException: null)); } [Fact] - public void BinaryFormatUtilities_RoundTripRestrictedFormat_NotSupportedException_DataLoss() + public void RoundTrip_RestrictedFormat_NotSupportedException_DataLoss() { NotSupportedException value = new("Error message", new ArgumentException()); RoundTripObject_RestrictedFormat(value).Should().BeEquivalentTo(new NotSupportedException("Error message", innerException: null)); @@ -208,41 +208,41 @@ public void BinaryFormatUtilities_RoundTripRestrictedFormat_NotSupportedExceptio [Theory] [MemberData(nameof(PrimitiveListObjects_TheoryData))] - public void BinaryFormatUtilities_RoundTrip_PrimitiveList(IList value) => + public void RoundTrip_PrimitiveList(IList value) => RoundTripObject(value).Should().BeEquivalentTo(value); [Theory] [MemberData(nameof(PrimitiveListObjects_TheoryData))] - public void BinaryFormatUtilities_RoundTripRestrictedFormat_PrimitiveList(IList value) => + public void RoundTrip_RestrictedFormat_PrimitiveList(IList value) => RoundTripObject_RestrictedFormat(value).Should().BeEquivalentTo(value); [Theory] [MemberData(nameof(PrimitiveArrayObjects_TheoryData))] - public void BinaryFormatUtilities_RoundTrip_PrimitiveArray(Array value) => + public void RoundTrip_PrimitiveArray(Array value) => RoundTripObject(value).Should().BeEquivalentTo(value); [Theory] [MemberData(nameof(PrimitiveArrayListObjects_TheoryData))] - public void BinaryFormatUtilities_RoundTrip_PrimitiveArrayList(ArrayList value) => + public void RoundTrip_PrimitiveArrayList(ArrayList value) => RoundTripObject(value).Should().BeEquivalentTo(value); [Theory] [MemberData(nameof(PrimitiveArrayListObjects_TheoryData))] - public void BinaryFormatUtilities_RoundTripRestrictedFormat_PrimitiveArrayList(ArrayList value) => + public void RoundTrip_RestrictedFormat_PrimitiveArrayList(ArrayList value) => RoundTripObject_RestrictedFormat(value).Should().BeEquivalentTo(value); [Theory] [MemberData(nameof(PrimitiveTypeHashtables_TheoryData))] - public void BinaryFormatUtilities_RoundTrip_PrimitiveHashtable(Hashtable value) => + public void RoundTrip_PrimitiveHashtable(Hashtable value) => RoundTripObject(value).Should().BeEquivalentTo(value); [Theory] [MemberData(nameof(PrimitiveTypeHashtables_TheoryData))] - public void BinaryFormatUtilities_RoundTripRestrictedFormat_PrimitiveHashtable(Hashtable value) => + public void RoundTrip_RestrictedFormat_PrimitiveHashtable(Hashtable value) => RoundTripObject_RestrictedFormat(value).Should().BeEquivalentTo(value); [Fact] - public void BinaryFormatUtilities_RoundTrip_ImageList() + public void RoundTrip_ImageList() { using ImageList sourceList = new(); using Bitmap image = new(10, 10); @@ -257,7 +257,7 @@ public void BinaryFormatUtilities_RoundTrip_ImageList() } [Fact] - public void BinaryFormatUtilities_RoundTripRestrictedFormat_ImageList() + public void RoundTrip_RestrictedFormat_ImageList() { using ImageList sourceList = new(); using Bitmap image = new(10, 10); @@ -272,14 +272,14 @@ public void BinaryFormatUtilities_RoundTripRestrictedFormat_ImageList() } [Fact] - public void BinaryFormatUtilities_RoundTrip_Bitmap() + public void RoundTrip_Bitmap() { using Bitmap value = new(10, 10); RoundTripObject(value).Should().BeOfType().Subject.Size.Should().Be(value.Size); } [Fact] - public void BinaryFormatUtilities_RoundTripRestrictedFormat_Bitmap() + public void RoundTrip_RestrictedFormat_Bitmap() { using Bitmap value = new(10, 10); RoundTripObject_RestrictedFormat(value).Should().BeOfType().Subject.Size.Should().Be(value.Size); @@ -287,7 +287,7 @@ public void BinaryFormatUtilities_RoundTripRestrictedFormat_Bitmap() [Theory] [MemberData(nameof(Lists_UnsupportedTestData))] - public void BinaryFormatUtilities_RoundTrip_Unsupported(IList value) + public void RoundTrip_Unsupported(IList value) { ((Action)(() => WriteObjectToStream(value))).Should().Throw(); @@ -302,7 +302,7 @@ public void BinaryFormatUtilities_RoundTrip_Unsupported(IList value) [Theory] [MemberData(nameof(Lists_UnsupportedTestData))] - public void BinaryFormatUtilities_RoundTripRestrictedFormat_Unsupported(IList value) + public void RoundTrip_RestrictedFormat_Unsupported(IList value) { ((Action)(() => WriteObjectToStream(value, restrictSerialization: true))).Should().Throw(); diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ClipboardTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ClipboardTests.cs index 3dc59552ed1..dd4bb46b2e7 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ClipboardTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ClipboardTests.cs @@ -433,19 +433,35 @@ public void Clipboard_SetImage_InvokeBitmap_GetReturnsExpected() [WinFormsFact] public void Clipboard_SetImage_InvokeMetafile_GetReturnsExpected() { - using Metafile metafile = new("bitmaps/telescope_01.wmf"); - Clipboard.SetImage(metafile); - Clipboard.GetImage().Should().BeNull(); - Clipboard.ContainsImage().Should().BeTrue(); + try + { + using Metafile metafile = new("bitmaps/telescope_01.wmf"); + Clipboard.SetImage(metafile); + + Clipboard.GetImage().Should().BeNull(); + Clipboard.ContainsImage().Should().BeTrue(); + } + finally + { + Clipboard.Clear(); + } } [WinFormsFact] public void Clipboard_SetImage_InvokeEnhancedMetafile_GetReturnsExpected() { - using Metafile metafile = new("bitmaps/milkmateya01.emf"); - Clipboard.SetImage(metafile); - Clipboard.GetImage().Should().BeNull(); - Clipboard.ContainsImage().Should().BeTrue(); + try + { + using Metafile metafile = new("bitmaps/milkmateya01.emf"); + Clipboard.SetImage(metafile); + + Clipboard.GetImage().Should().BeNull(); + Clipboard.ContainsImage().Should().BeTrue(); + } + finally + { + Clipboard.Clear(); + } } [WinFormsFact] diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.ClipboardTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.ClipboardTests.cs index 3cbb053e55a..a0a83e48aa5 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.ClipboardTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.ClipboardTests.cs @@ -9,8 +9,9 @@ namespace System.Windows.Forms.Tests; public partial class DataObjectTests { - [Collection("Sequential")] // Each registered Clipboard format is an OS singleton, - // and we should not run this test at the same time as other tests using the same format. + // Each registered Clipboard format is an OS singleton, + // we should not run this test at the same time as other tests using the same format. + [Collection("Sequential")] [UISettings(MaxAttempts = 3)] // Try up to 3 times before failing. public class ClipboardTests { diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DragDropHelperTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DragDropHelperTests.cs index 4d7752ca9f0..d7bca506f90 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DragDropHelperTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DragDropHelperTests.cs @@ -115,9 +115,9 @@ public unsafe void SetDragImage_DataObject_Bitmap_Point_bool_ReturnsExpected(Dat Size dragImageSize = pDragImage->sizeDragImage; Point offset = pDragImage->ptOffset; PInvokeCore.GlobalUnlock(dragDropFormat.Medium.hGlobal); - Assert.Equal(dragImage is null, isDragImageNull); - Assert.Equal(dragImage is null ? new Size(0, 0) : dragImage.Size, dragImageSize); - Assert.Equal(cursorOffset, offset); + (dragImage is null).Should().Be(isDragImageNull); + (dragImage is null ? new Size(0, 0) : dragImage.Size).Should().Be(dragImageSize); + cursorOffset.Should().Be(offset); } finally { @@ -139,9 +139,9 @@ public unsafe void SetDragImage_DataObject_GiveFeedbackEventArgs_ReturnsExpected Size dragImageSize = pDragImage->sizeDragImage; Point offset = pDragImage->ptOffset; PInvokeCore.GlobalUnlock(dragDropFormat.Medium.hGlobal); - Assert.Equal(e.DragImage is null, isDragImageNull); - Assert.Equal(e.DragImage is null ? new Size(0, 0) : e.DragImage.Size, dragImageSize); - Assert.Equal(e.CursorOffset, offset); + (e.DragImage is null).Should().Be(isDragImageNull); + (e.DragImage is null ? new Size(0, 0) : e.DragImage.Size).Should().Be(dragImageSize); + e.CursorOffset.Should().Be(offset); } finally { @@ -153,15 +153,17 @@ public unsafe void SetDragImage_DataObject_GiveFeedbackEventArgs_ReturnsExpected public void SetDragImage_NonSTAThread_ThrowsInvalidOperationException() { Control.CheckForIllegalCrossThreadCalls = true; - Assert.Throws(() => DragDropHelper.SetDragImage(new DataObject(), new Bitmap(1, 1), new Point(0, 0), false)); + using Bitmap bitmap = new(1, 1); + Assert.Throws(() => DragDropHelper.SetDragImage(new DataObject(), bitmap, new Point(0, 0), false)); } [Fact] public void SetDragImage_NullDataObject_ThrowsArgumentNullException() { DataObject dataObject = null; + using Bitmap bitmap = new(1, 1); Assert.Throws(nameof(dataObject), - () => DragDropHelper.SetDragImage(dataObject, new Bitmap(1, 1), new Point(0, 0), false)); + () => DragDropHelper.SetDragImage(dataObject, bitmap, new Point(0, 0), false)); } [Fact] @@ -186,9 +188,9 @@ public unsafe void SetDropDescription_ClearDropDescription_ReturnsExpected(DataO string szMessage = pDropDescription->szMessage.ToString(); string szInsert = pDropDescription->szInsert.ToString(); PInvokeCore.GlobalUnlock(dragDropFormat.Medium.hGlobal); - Assert.Equal(DROPIMAGETYPE.DROPIMAGE_INVALID, type); - Assert.Equal(string.Empty, szMessage); - Assert.Equal(string.Empty, szInsert); + type.Should().Be(DROPIMAGETYPE.DROPIMAGE_INVALID); + szMessage.Should().Be(string.Empty); + szInsert.Should().Be(string.Empty); } finally { @@ -247,7 +249,6 @@ public unsafe void SetDropDescription_ReleaseDragDropFormats_ReturnsExpected(Dat { if (dataObject.GetData(format) is DragDropFormat dragDropFormat) { - Assert.Equal(0, (int)PInvokeCore.GlobalSize(dragDropFormat.Medium.hGlobal)); Assert.Equal(nint.Zero, (nint)dragDropFormat.Medium.pUnkForRelease); Assert.Equal(Com.TYMED.TYMED_NULL, dragDropFormat.Medium.tymed); Assert.Equal(nint.Zero, (nint)dragDropFormat.Medium.hGlobal); diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DragEventArgsTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DragEventArgsTests.cs index a7ad2ba6475..3962bf508e3 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DragEventArgsTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DragEventArgsTests.cs @@ -99,27 +99,16 @@ public void MessageReplacementToken_Set_GetReturnsExpected(string value) private class CustomDataObject : IDataObject { public object GetData(string format, bool autoConvert) => throw new NotImplementedException(); - public object GetData(string format) => throw new NotImplementedException(); - public object GetData(Type format) => throw new NotImplementedException(); - public void SetData(string format, bool autoConvert, object data) => throw new NotImplementedException(); - public void SetData(string format, object data) => throw new NotImplementedException(); - public void SetData(Type format, object data) => throw new NotImplementedException(); - public void SetData(object data) => throw new NotImplementedException(); - public bool GetDataPresent(string format, bool autoConvert) => throw new NotImplementedException(); - public bool GetDataPresent(string format) => throw new NotImplementedException(); - public bool GetDataPresent(Type format) => throw new NotImplementedException(); - public string[] GetFormats(bool autoConvert) => throw new NotImplementedException(); - public string[] GetFormats() => throw new NotImplementedException(); } } diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ToolStripItemTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ToolStripItemTests.cs index 8d9fd409138..c7be29dee26 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ToolStripItemTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ToolStripItemTests.cs @@ -10238,48 +10238,29 @@ public void ToolStripItem_DoDragDrop_NullData_ThrowsArgumentNullException() private class CustomDataObject : IDataObject { public object GetData(string format, bool autoConvert) => throw new NotImplementedException(); - public object GetData(string format) => throw new NotImplementedException(); - public object GetData(Type format) => throw new NotImplementedException(); - public bool GetDataPresent(string format, bool autoConvert) => throw new NotImplementedException(); - public bool GetDataPresent(string format) => throw new NotImplementedException(); - public bool GetDataPresent(Type format) => throw new NotImplementedException(); - public string[] GetFormats(bool autoConvert) => throw new NotImplementedException(); - public string[] GetFormats() => throw new NotImplementedException(); - public void SetData(string format, bool autoConvert, object data) => throw new NotImplementedException(); - public void SetData(string format, object data) => throw new NotImplementedException(); - public void SetData(Type format, object data) => throw new NotImplementedException(); - public void SetData(object data) => throw new NotImplementedException(); } private class CustomComDataObject : IComDataObject { public void GetData(ref FORMATETC format, out STGMEDIUM medium) => throw new NotImplementedException(); - public void GetDataHere(ref FORMATETC format, ref STGMEDIUM medium) => throw new NotImplementedException(); - public int QueryGetData(ref FORMATETC format) => throw new NotImplementedException(); - public int GetCanonicalFormatEtc(ref FORMATETC formatIn, out FORMATETC formatOut) => throw new NotImplementedException(); - public void SetData(ref FORMATETC formatIn, ref STGMEDIUM medium, bool release) => throw new NotImplementedException(); - public IEnumFORMATETC EnumFormatEtc(DATADIR direction) => throw new NotImplementedException(); - public int DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection) => throw new NotImplementedException(); - public void DUnadvise(int connection) => throw new NotImplementedException(); - public int EnumDAdvise(out IEnumSTATDATA enumAdvise) => throw new NotImplementedException(); } From 7896a6e7b4d3627c76bd3168d0042f72574d9b14 Mon Sep 17 00:00:00 2001 From: Jeremy Kuhne Date: Mon, 18 Nov 2024 17:13:05 -0800 Subject: [PATCH 030/106] Move common code to assemblies (#12506) Most of what was in the Common folder was only used in one place or could live in a shared assembly. Moved what I easily could. --- Directory.Build.targets | 12 -------- src/Common/src/HandleRefMarshaller.cs | 24 --------------- .../src/DisableRuntimeMarshalling.cs | 0 .../src/Special}/NullableAttributes.cs | 0 .../src/Special}/ObsoleteAttribute.cs | 0 .../RequiresUnreferencedCodeAttribute.cs | 0 .../src/Special}/SR.cs | 0 .../UnconditionalSuppressMessageAttribute.cs | 0 .../src/System.Drawing.Common.csproj | 26 +++++++---------- .../System}/LocalAppContextSwitches.Common.cs | 0 .../src/resources.targets | 4 +-- .../src/System/Text}/ValueStringBuilder.cs | 29 ++++++++++++------- .../System.Windows.Forms.Primitives.csproj | 1 - .../Collections/Generic}/WeakRefCollection.cs | 0 .../src/System.Windows.Forms.csproj | 1 - .../src/System}/IComparerHelpers.cs | 0 16 files changed, 30 insertions(+), 67 deletions(-) delete mode 100644 src/Common/src/HandleRefMarshaller.cs rename src/{Common => System.Drawing.Common}/src/DisableRuntimeMarshalling.cs (100%) rename src/{Common/src => System.Drawing.Common/src/Special}/NullableAttributes.cs (100%) rename src/{Common/src => System.Drawing.Common/src/Special}/ObsoleteAttribute.cs (100%) rename src/{Common/src => System.Drawing.Common/src/Special}/RequiresUnreferencedCodeAttribute.cs (100%) rename src/{Common/src => System.Drawing.Common/src/Special}/SR.cs (100%) rename src/{Common/src => System.Drawing.Common/src/Special}/UnconditionalSuppressMessageAttribute.cs (100%) rename src/{Common/src => System.Drawing.Common/src/System}/LocalAppContextSwitches.Common.cs (100%) rename src/{Common/src => System.Private.Windows.Core/src/System/Text}/ValueStringBuilder.cs (89%) rename src/{Common/src => System.Windows.Forms.Primitives/src/System/Collections/Generic}/WeakRefCollection.cs (100%) rename src/{Common/src => System.Windows.Forms/src/System}/IComparerHelpers.cs (100%) diff --git a/Directory.Build.targets b/Directory.Build.targets index dc33b70b526..a72569f7af7 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -87,18 +87,6 @@ - - - - - - - - $(NoWarn);CS0436 - - - - - - true - - - - @@ -70,30 +63,31 @@ - - - - + + + + $(NoWarn);CS0436 + + - + + - - + + - - diff --git a/src/Common/src/LocalAppContextSwitches.Common.cs b/src/System.Drawing.Common/src/System/LocalAppContextSwitches.Common.cs similarity index 100% rename from src/Common/src/LocalAppContextSwitches.Common.cs rename to src/System.Drawing.Common/src/System/LocalAppContextSwitches.Common.cs diff --git a/src/System.Drawing.Common/src/resources.targets b/src/System.Drawing.Common/src/resources.targets index e37e9715255..91f049a7855 100644 --- a/src/System.Drawing.Common/src/resources.targets +++ b/src/System.Drawing.Common/src/resources.targets @@ -22,8 +22,6 @@ GenerateSource="true" ClassName="$(StringResourcesNamespace).$(StringResourcesClassName)" /> - + diff --git a/src/Common/src/ValueStringBuilder.cs b/src/System.Private.Windows.Core/src/System/Text/ValueStringBuilder.cs similarity index 89% rename from src/Common/src/ValueStringBuilder.cs rename to src/System.Private.Windows.Core/src/System/Text/ValueStringBuilder.cs index 4f53aaeb767..aa885b9592a 100644 --- a/src/Common/src/ValueStringBuilder.cs +++ b/src/System.Private.Windows.Core/src/System/Text/ValueStringBuilder.cs @@ -9,6 +9,9 @@ namespace System.Text; +/// +/// String builder struct that allows using stack space for small strings. +/// internal ref partial struct ValueStringBuilder { private char[]? _arrayToReturnToPool; @@ -53,11 +56,14 @@ public void EnsureCapacity(int capacity) } /// - /// Get a pinnable reference to the builder. - /// Does not ensure there is a null char after - /// This overload is pattern matched in the C# 7.3+ compiler so you can omit - /// the explicit method call, and write eg "fixed (char* c = builder)" + /// Get a pinnable reference to the builder. Does not ensure there is a null char after /// + /// + /// + /// This overload is pattern matched in the C# 7.3+ compiler so you can omit + /// the explicit method call, and write eg "fixed (char* c = builder)" + /// + /// public readonly ref char GetPinnableReference() => ref MemoryMarshal.GetReference(_chars); /// @@ -91,11 +97,13 @@ public override string ToString() return s; } - /// Returns the underlying storage of the builder. + /// + /// Returns the underlying storage of the builder. + /// public readonly Span RawChars => _chars; /// - /// Returns a span around the contents of the builder. + /// Returns a span around the contents of the builder. /// /// Ensures that the builder has a null char after public ReadOnlySpan AsSpan(bool terminate) @@ -186,8 +194,9 @@ public void Append(string? s) } int pos = _pos; - if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. + if (s.Length == 1 && (uint)pos < (uint)_chars.Length) { + // Very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. _chars[pos] = s[0]; _pos = pos + 1; } @@ -275,12 +284,12 @@ private void GrowAndAppend(char c) } /// - /// Resize the internal buffer either by doubling current buffer size or - /// by adding to + /// Resize the internal buffer either by doubling current buffer size or + /// by adding to /// whichever is greater. /// /// - /// Number of chars requested beyond current position. + /// Number of chars requested beyond current position. /// [MethodImpl(MethodImplOptions.NoInlining)] private void Grow(int additionalCapacityBeyondPos) diff --git a/src/System.Windows.Forms.Primitives/src/System.Windows.Forms.Primitives.csproj b/src/System.Windows.Forms.Primitives/src/System.Windows.Forms.Primitives.csproj index c05a1eb50a1..456903a6e82 100644 --- a/src/System.Windows.Forms.Primitives/src/System.Windows.Forms.Primitives.csproj +++ b/src/System.Windows.Forms.Primitives/src/System.Windows.Forms.Primitives.csproj @@ -55,7 +55,6 @@ - diff --git a/src/Common/src/WeakRefCollection.cs b/src/System.Windows.Forms.Primitives/src/System/Collections/Generic/WeakRefCollection.cs similarity index 100% rename from src/Common/src/WeakRefCollection.cs rename to src/System.Windows.Forms.Primitives/src/System/Collections/Generic/WeakRefCollection.cs diff --git a/src/System.Windows.Forms/src/System.Windows.Forms.csproj b/src/System.Windows.Forms/src/System.Windows.Forms.csproj index 31080b159f0..610aa60fc51 100644 --- a/src/System.Windows.Forms/src/System.Windows.Forms.csproj +++ b/src/System.Windows.Forms/src/System.Windows.Forms.csproj @@ -43,7 +43,6 @@ - diff --git a/src/Common/src/IComparerHelpers.cs b/src/System.Windows.Forms/src/System/IComparerHelpers.cs similarity index 100% rename from src/Common/src/IComparerHelpers.cs rename to src/System.Windows.Forms/src/System/IComparerHelpers.cs From dc4314ea49b7cbecd2024e7944d6cf98e01c52fc Mon Sep 17 00:00:00 2001 From: Leaf Shi <132890443+LeafShi1@users.noreply.github.com> Date: Wed, 20 Nov 2024 09:44:15 +0800 Subject: [PATCH 031/106] =?UTF-8?q?Fixed=20the=20issue=20where=20edit=20te?= =?UTF-8?q?xtBox=20loses=20focus=20when=20using=20up/down=20to=20switch=20?= =?UTF-8?q?property=20values=20=E2=80=8B=E2=80=8Bon=20edit=20textBox=20(#1?= =?UTF-8?q?2431)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix editor text box focus issue when switching value property grid view * Override function SelectInternal in file PropertyGridView.GridViewTextBox.cs * Removing fullRefresh condition from function Refresh --- .../PropertyGrid/PropertyGridInternal/PropertyGridView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs index cfda296fd0a..b4344099023 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs @@ -3992,7 +3992,7 @@ private void Refresh(bool fullRefresh, int startRow, int endRow) startRow = 0; } - if (fullRefresh || OwnerGrid.HavePropertyEntriesChanged()) + if (OwnerGrid.HavePropertyEntriesChanged()) { if (HasEntries && !InPropertySet && !CommitEditTextBox()) { From 215573cd23c953f34074d32907380c647d30ac61 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2024 13:37:01 +0000 Subject: [PATCH 032/106] [main] Update dependencies from dotnet/arcade (#12517) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 24 +++++++++++------------ eng/Versions.props | 6 +++--- eng/common/native/install-dependencies.sh | 4 ++++ global.json | 6 +++--- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f3d96d24a13..1dc80d37089 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -191,29 +191,29 @@ Note: if the Uri is a new place, you will need to add a subscription from that p - + https://github.com/dotnet/arcade - c1852b9ac37df9a86630c2f078dbee43f7b186e7 + efdc52bb77eeadae5420eb48e66722c4fdcaa3be - + https://github.com/dotnet/arcade - c1852b9ac37df9a86630c2f078dbee43f7b186e7 + efdc52bb77eeadae5420eb48e66722c4fdcaa3be - + https://github.com/dotnet/arcade - c1852b9ac37df9a86630c2f078dbee43f7b186e7 + efdc52bb77eeadae5420eb48e66722c4fdcaa3be - + https://github.com/dotnet/arcade - c1852b9ac37df9a86630c2f078dbee43f7b186e7 + efdc52bb77eeadae5420eb48e66722c4fdcaa3be - + https://github.com/dotnet/arcade - c1852b9ac37df9a86630c2f078dbee43f7b186e7 + efdc52bb77eeadae5420eb48e66722c4fdcaa3be - + https://github.com/dotnet/arcade - c1852b9ac37df9a86630c2f078dbee43f7b186e7 + efdc52bb77eeadae5420eb48e66722c4fdcaa3be diff --git a/eng/Versions.props b/eng/Versions.props index 209c08066b5..415df9d289d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -56,9 +56,9 @@ - 10.0.0-beta.24564.1 - 10.0.0-beta.24564.1 - 10.0.0-beta.24564.1 + 10.0.0-beta.24570.1 + 10.0.0-beta.24570.1 + 10.0.0-beta.24570.1 17.4.0-preview-20220707-01 diff --git a/eng/common/native/install-dependencies.sh b/eng/common/native/install-dependencies.sh index 6d1f8a94a68..dc396a95560 100644 --- a/eng/common/native/install-dependencies.sh +++ b/eng/common/native/install-dependencies.sh @@ -44,6 +44,10 @@ case "$os" in export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 # Skip brew update for now, see https://github.com/actions/setup-python/issues/577 # brew update --preinstall + + # Temporarily uninstall pkg-config@0.29.2 to work around https://github.com/actions/runner-images/issues/10984 + brew uninstall --ignore-dependencies --force pkg-config@0.29.2 + brew bundle --no-upgrade --no-lock --file=- < Date: Wed, 20 Nov 2024 13:37:30 +0000 Subject: [PATCH 033/106] [main] Update dependencies from dotnet/runtime (#12518) [main] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 58 ++++++------- global.json | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1dc80d37089..e296eb434ab 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 - + https://github.com/dotnet/runtime - 55eee324653e01cf28809d02b25a5b0894b58d22 + d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 diff --git a/eng/Versions.props b/eng/Versions.props index 415df9d289d..7c74898adf5 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 - 10.0.0-alpha.1.24565.3 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24569.15 diff --git a/global.json b/global.json index 367657337c8..29fb5100b75 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24570.1", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24570.1", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24565.3" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24569.15" }, "native-tools": { "cmake": "latest" From 0fb2ac7908912195f012256985daa23bfc55d1e9 Mon Sep 17 00:00:00 2001 From: Loni Tra Date: Wed, 20 Nov 2024 13:14:57 -0800 Subject: [PATCH 034/106] Call Correct HtmlHelp Overload (#12511) Call correct HtmlHelp overload --- .../src/NativeMethods.txt | 1 + .../src/Windows/Win32/PInvoke.HtmlHelp.cs | 18 ++++++------------ .../src/System/Windows/Forms/Help/Help.cs | 2 +- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/System.Windows.Forms.Primitives/src/NativeMethods.txt b/src/System.Windows.Forms.Primitives/src/NativeMethods.txt index 3947d715d06..5df70140251 100644 --- a/src/System.Windows.Forms.Primitives/src/NativeMethods.txt +++ b/src/System.Windows.Forms.Primitives/src/NativeMethods.txt @@ -259,6 +259,7 @@ HideCaret HitTestThemeBackground HT* HTML_HELP_COMMAND +HtmlHelp HTREEITEM IAccessible IAccessibleEx diff --git a/src/System.Windows.Forms.Primitives/src/Windows/Win32/PInvoke.HtmlHelp.cs b/src/System.Windows.Forms.Primitives/src/Windows/Win32/PInvoke.HtmlHelp.cs index 9d8002e41e8..46415728261 100644 --- a/src/System.Windows.Forms.Primitives/src/Windows/Win32/PInvoke.HtmlHelp.cs +++ b/src/System.Windows.Forms.Primitives/src/Windows/Win32/PInvoke.HtmlHelp.cs @@ -1,25 +1,19 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Runtime.InteropServices; using Windows.Win32.Data.HtmlHelp; namespace Windows.Win32; internal static partial class PInvoke { - internal static unsafe HWND HtmlHelp(HWND hwndCaller, string? pszFile, HTML_HELP_COMMAND uCommand, nuint dwData) + /// + internal static unsafe HWND HtmlHelp(T hwndCaller, string? pszFile, HTML_HELP_COMMAND uCommand, nuint dwData) + where T : IHandle { - // Copied from generated code pending resolution of https://github.com/microsoft/win32metadata/issues/1749 - - fixed (char* p = pszFile) - { - HWND __retVal = LocalExternFunction(hwndCaller, p, (uint)uCommand, dwData); - return __retVal; - } - - [DllImport(Libraries.Hhctrl, ExactSpelling = true, EntryPoint = "HtmlHelpW")] - static extern HWND LocalExternFunction(HWND hwndCaller, PCWSTR pszFile, uint uCommand, nuint dwData); + HWND result = HtmlHelp(hwndCaller.Handle, pszFile, uCommand, dwData); + GC.KeepAlive(hwndCaller.Wrapper); + return result; } /// diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Help/Help.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Help/Help.cs index 3cd518d89d8..445bf395138 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Help/Help.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Help/Help.cs @@ -146,7 +146,7 @@ private static unsafe void ShowHTML10Help(Control? parent, string? url, HelpNavi } else if (htmlParam is int intParam) { - PInvoke.HtmlHelp(handle, pathAndFileName, htmlCommand, in intParam); + PInvoke.HtmlHelp(handle, pathAndFileName, htmlCommand, (nuint)intParam); } else if (htmlParam is HH_FTS_QUERY query) { From 711dd3775282181a336ff5b9d01e16c05ac161da Mon Sep 17 00:00:00 2001 From: Jeremy Kuhne Date: Wed, 20 Nov 2024 16:10:32 -0800 Subject: [PATCH 035/106] Mark System.Private.Windows.Core as WPF as well (#12521) WPF now depends on it as well, need to mark it so it is included in WPF references. --- .../System.Windows.Forms.FileClassification.props | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/Microsoft.Private.Winforms/sdk/dotnet-windowsdesktop/System.Windows.Forms.FileClassification.props b/pkg/Microsoft.Private.Winforms/sdk/dotnet-windowsdesktop/System.Windows.Forms.FileClassification.props index 4bca48e101e..68e0713ce68 100644 --- a/pkg/Microsoft.Private.Winforms/sdk/dotnet-windowsdesktop/System.Windows.Forms.FileClassification.props +++ b/pkg/Microsoft.Private.Winforms/sdk/dotnet-windowsdesktop/System.Windows.Forms.FileClassification.props @@ -10,7 +10,8 @@ - + + From dd5f8e7093051e80887184889c63e0da2203bd6d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 21 Nov 2024 13:36:36 +0000 Subject: [PATCH 036/106] [main] Update dependencies from dotnet/arcade (#12526) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 24 ++++++++++++------------ eng/Versions.props | 6 +++--- global.json | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e296eb434ab..8fedf49b3f7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -191,29 +191,29 @@ Note: if the Uri is a new place, you will need to add a subscription from that p - + https://github.com/dotnet/arcade - efdc52bb77eeadae5420eb48e66722c4fdcaa3be + 0c8f4989db0251f49a4f37d1b35bf4da1e9d6415 - + https://github.com/dotnet/arcade - efdc52bb77eeadae5420eb48e66722c4fdcaa3be + 0c8f4989db0251f49a4f37d1b35bf4da1e9d6415 - + https://github.com/dotnet/arcade - efdc52bb77eeadae5420eb48e66722c4fdcaa3be + 0c8f4989db0251f49a4f37d1b35bf4da1e9d6415 - + https://github.com/dotnet/arcade - efdc52bb77eeadae5420eb48e66722c4fdcaa3be + 0c8f4989db0251f49a4f37d1b35bf4da1e9d6415 - + https://github.com/dotnet/arcade - efdc52bb77eeadae5420eb48e66722c4fdcaa3be + 0c8f4989db0251f49a4f37d1b35bf4da1e9d6415 - + https://github.com/dotnet/arcade - efdc52bb77eeadae5420eb48e66722c4fdcaa3be + 0c8f4989db0251f49a4f37d1b35bf4da1e9d6415 diff --git a/eng/Versions.props b/eng/Versions.props index 7c74898adf5..cbef988481b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -56,9 +56,9 @@ - 10.0.0-beta.24570.1 - 10.0.0-beta.24570.1 - 10.0.0-beta.24570.1 + 10.0.0-beta.24570.4 + 10.0.0-beta.24570.4 + 10.0.0-beta.24570.4 17.4.0-preview-20220707-01 diff --git a/global.json b/global.json index 29fb5100b75..4c60ef67c1d 100644 --- a/global.json +++ b/global.json @@ -14,9 +14,9 @@ "version": "9.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24570.1", - "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24570.1", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24570.1", + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24570.4", + "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24570.4", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24570.4", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24569.15" }, From ea6d0bb46f6171a266ec26ef9f92a09cc9ee6115 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 21 Nov 2024 17:35:15 +0000 Subject: [PATCH 037/106] [main] Update dependencies from dotnet/runtime (#12527) [main] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 58 ++++++------- global.json | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8fedf49b3f7..ef2ed3fcf0f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b - + https://github.com/dotnet/runtime - d0b4ca6ee4b6f6c99e7aed2fe0e042e5e4974ad9 + b66200e5448be50673b0387ca4632d3bfa25887b diff --git a/eng/Versions.props b/eng/Versions.props index cbef988481b..ee6e7dc5bb2 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 - 10.0.0-alpha.1.24569.15 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24570.9 diff --git a/global.json b/global.json index 4c60ef67c1d..39dfbc25ff0 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24570.4", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24570.4", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24569.15" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24570.9" }, "native-tools": { "cmake": "latest" From 200451f108d508f127000f2247f7f0cb63e76893 Mon Sep 17 00:00:00 2001 From: Tanya Solyanik Date: Thu, 21 Nov 2024 11:07:47 -0800 Subject: [PATCH 038/106] fixed a couple of typos (#12520) fixed a couple of typos --- .../Forms/Accessibility/AccessibleObjectExtensions.cs | 6 +++--- .../src/System/Windows/Forms/Internal/AssemblyAttributes.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Accessibility/AccessibleObjectExtensions.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Accessibility/AccessibleObjectExtensions.cs index efbd536b6bf..038448fb648 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Accessibility/AccessibleObjectExtensions.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Accessibility/AccessibleObjectExtensions.cs @@ -299,7 +299,7 @@ public static int TryGetChildCount(this AgileComPointer? agile) } /// - /// Gets the accessible object's owner control's accesssible role. + /// Gets the accessible object's owner control's accessible role. /// public static AccessibleRole GetOwnerAccessibleRole( this TAccessible accessibleObject, @@ -311,7 +311,7 @@ public static AccessibleRole GetOwnerAccessibleRole( } /// - /// Gets the accessible object's owner control's accesssible name. + /// Gets the accessible object's owner control's accessible name. /// [return: NotNullIfNotNull(nameof(defaultName))] public static string? GetOwnerAccessibleName( @@ -320,7 +320,7 @@ public static AccessibleRole GetOwnerAccessibleRole( => accessibleObject.Owner?.AccessibleName ?? defaultName; /// - /// Gets the accessible object's owner control's accesssible text. + /// Gets the accessible object's owner control's accessible text. /// public static string GetOwnerText(this TAccessible accessibleObject, string defaultText = "") where TAccessible : AccessibleObject, IOwnedObject diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Internal/AssemblyAttributes.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Internal/AssemblyAttributes.cs index 5dd6106ce0e..4be53e98190 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Internal/AssemblyAttributes.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Internal/AssemblyAttributes.cs @@ -8,7 +8,7 @@ [assembly: Dependency("System,", LoadHint.Always)] [assembly: Dependency("System.Drawing,", LoadHint.Always)] [assembly: Dependency("System.Core", LoadHint.Sometimes)] -// This is now trun on by default, use source file NO_RUNTIMECOMPATIBILITY_ATTRIBUTE flag to control this +// This is now on by default, use source file NO_RUNTIMECOMPATIBILITY_ATTRIBUTE flag to control this // [assembly:RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: StringFreezing] [assembly: System.Runtime.InteropServices.TypeLibVersion(2, 4)] From 441fb2a0cace54d5d9d5c9ac397d6b212a457181 Mon Sep 17 00:00:00 2001 From: Tanya Solyanik Date: Thu, 21 Nov 2024 16:19:10 -0800 Subject: [PATCH 039/106] =?UTF-8?q?Replaced=20a=20NullReferedeException=20?= =?UTF-8?q?that=20was=20lost=20in=20the=20interop=20layer=20w=E2=80=A6=20(?= =?UTF-8?q?#12528)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaced a NullReferenceException that was lost in the interop layer with an HRESULT error code recommended in the docs - https://learn.microsoft.com/en-us/windows/win32/api/objidl/nf-objidl-idataobject-getdatahere#return-value. The HRESULT is not bubbled up through OleFlushClipboard either, this API returns S_OK even when the data wasn't set. In this case we end up with format being set successfully, but data is actually missing. --- .../Forms/Design/ButtonBaseDesigner.cs | 3 --- ...ect.Composition.WinFormsToNativeAdapter.cs | 9 ++++--- .../System/Windows/Forms/ClipboardTests.cs | 25 +++++++++++++------ 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ButtonBaseDesigner.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ButtonBaseDesigner.cs index 01b4856ef42..a92ff3e236e 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ButtonBaseDesigner.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ButtonBaseDesigner.cs @@ -15,8 +15,6 @@ namespace System.Windows.Forms.Design; /// internal class ButtonBaseDesigner : ControlDesigner { - // private DesignerActionListCollection _actionlists; - public ButtonBaseDesigner() { AutoResizeHandles = true; @@ -31,7 +29,6 @@ public override void InitializeNewComponent(IDictionary? defaultValues) { // Dev10 Bug 685319: We should set the UseVisualStyleBackColor to trun only // when this property has not been set/changed by user - // if (!prop.ShouldSerializeValue(Component)) { prop.SetValue(Component, true); diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.WinFormsToNativeAdapter.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.WinFormsToNativeAdapter.cs index 2f5511e7074..ccaf607431b 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.WinFormsToNativeAdapter.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.WinFormsToNativeAdapter.cs @@ -116,13 +116,16 @@ HRESULT Com.IDataObject.Interface.GetDataHere(FORMATETC* pformatetc, STGMEDIUM* return HRESULT.DV_E_FORMATETC; } - object? data = _dataObject.GetData(format); + if (_dataObject.GetData(format) is not object data) + { + return HRESULT.E_UNEXPECTED; + } if (((TYMED)pformatetc->tymed).HasFlag(TYMED.TYMED_HGLOBAL)) { try { - return SaveDataToHGLOBAL(data!, format, ref *pmedium); + return SaveDataToHGLOBAL(data, format, ref *pmedium); } catch (NotSupportedException ex) { @@ -314,7 +317,7 @@ DataFormats.DibConstant when data is Image _ when format == DataFormats.SerializableConstant || data is ISerializable || data.GetType().IsSerializable #pragma warning restore => SaveObjectToHGLOBAL(ref medium.hGlobal, data, RestrictDeserializationToSafeTypes(format)), - _ => HRESULT.E_FAIL + _ => HRESULT.E_UNEXPECTED }; private static HRESULT SaveObjectToHGLOBAL(ref HGLOBAL hglobal, object data, bool restrictSerialization) diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ClipboardTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ClipboardTests.cs index dd4bb46b2e7..8816a9d3435 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ClipboardTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ClipboardTests.cs @@ -232,15 +232,26 @@ public void Clipboard_SetData_Invoke_GetReturnsExpected(string format, object? d [InlineData(null)] public void Clipboard_SetData_EmptyOrWhitespaceFormat_ThrowsArgumentException(string? format) { - Action action = () => Clipboard.SetData(format!, data: null!); + Action action = () => Clipboard.SetData(format!, "data"); action.Should().Throw().WithParameterName("format"); } [WinFormsFact] - public void Clipboard_SetData_null_Success() + public void Clipboard_SetData_null_NotThrow() { - Action action = () => Clipboard.SetData("MyData", data: null!); - action.Should().NotThrow(); + try + { + Action action = () => Clipboard.SetData("MyData", data: null!); + action.Should().NotThrow(); + // Clipboard flushes format only, content is not stored. + // GetData will hit "Data on clipboard is invalid (0x800401D3 (CLIPBRD_E_BAD_DATA))" + Clipboard.ContainsData("MyData").Should().BeTrue(); + Clipboard.GetData("MyData").Should().BeNull(); + } + finally + { + Clipboard.Clear(); + } } [WinFormsTheory] @@ -264,8 +275,7 @@ public void Clipboard_SetDataObject_InvokeObjectIComDataObject_GetReturnsExpecte DataObject dataObject = new(data); Clipboard.SetDataObject(dataObject); - var actual = Clipboard.GetDataObject(); - Assert.NotNull(actual); + DataObject actual = Clipboard.GetDataObject().Should().BeOfType().Subject; actual.GetData(data.GetType()).Should().Be(data); Clipboard.ContainsData(data.GetType().FullName).Should().BeTrue(); } @@ -279,8 +289,7 @@ public void Clipboard_SetDataObject_InvokeObjectBoolNotIComDataObject_GetReturns { Clipboard.SetDataObject(data, copy); - var dataObject = Clipboard.GetDataObject(); - Assert.NotNull(dataObject); + DataObject dataObject = Clipboard.GetDataObject().Should().BeOfType().Subject; dataObject.GetData(data.GetType()).Should().Be(data); Clipboard.ContainsData(data.GetType().FullName).Should().BeTrue(); } From 306ec6760763ecb424a21a21f315bc098bb6c1ba Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 22 Nov 2024 13:36:12 +0000 Subject: [PATCH 040/106] [main] Update dependencies from dotnet/runtime (#12531) [main] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 58 ++++++------- global.json | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ef2ed3fcf0f..74d5b62b7d4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f - + https://github.com/dotnet/runtime - b66200e5448be50673b0387ca4632d3bfa25887b + 4389f9c54d070ca5e0cf7c4931aff56fe36d667f diff --git a/eng/Versions.props b/eng/Versions.props index ee6e7dc5bb2..4c4a3955ebe 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 - 10.0.0-alpha.1.24570.9 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.1 diff --git a/global.json b/global.json index 39dfbc25ff0..cb4aca86e5c 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24570.4", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24570.4", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24570.9" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24572.1" }, "native-tools": { "cmake": "latest" From 012515b09cbc4e45972db5808446047503b8f29a Mon Sep 17 00:00:00 2001 From: Jeremy Kuhne Date: Fri, 22 Nov 2024 10:28:35 -0800 Subject: [PATCH 041/106] Re-enable some analyzers (#12529) There were a few marked as TODO. This makes them back into warnings with the exception of IDE0059 which is "Unnecessary assignment of a value". That is now a suggestion. Some of the fixes for IDE0059 are in this commit, others will follow as there are a lot of failures on that one. Also remove test global suppression files --- .editorconfig | 11 +- .../XUnit/InvalidEnumDataAttribute.cs | 2 +- .../src/System/Drawing/Icon.cs | 14 +-- .../src/System/Drawing/ImageConverter.cs | 4 +- .../src/System/Value.PackedDateTimeOffset.cs | 4 +- .../Win32/System/Com/SafeArrayScope.cs | 3 +- .../src/GlobalSuppressions.cs | 1 + .../src/System/Drawing/Design/ToolboxItem.cs | 5 + .../Design/ContextMenuStripActionList.cs | 20 +++- .../Forms/Design/DataGridViewDesigner.cs | 45 ++------ .../Forms/Design/DesignBindingPicker.cs | 5 +- .../Forms/Design/ListViewActionList.cs | 106 +++++++----------- .../Forms/Design/PictureBoxActionList.cs | 39 +++---- .../Windows/Forms/Design/TextBoxActionList.cs | 24 ++-- .../Forms/Design/ToolStripActionList.cs | 34 +++++- .../Forms/Design/TreeViewActionList.cs | 39 +++---- .../tests/UnitTests/GlobalSuppressions.cs | 7 -- .../src/GlobalSuppressions.cs | 24 ++++ .../Collections/Generic/WeakRefCollection.cs | 2 +- .../DesignerSerializationManagerHelper.cs | 1 - .../Windows/Forms/Automation/UiaTextRange.cs | 4 +- .../AssemblyNamesTypeResolutionService.cs | 6 +- .../src/System/Resources/ResXDataNode.cs | 2 +- .../System/Resources/ResxFileRef.Converter.cs | 2 +- .../Control.ControlAccessibleObject.cs | 2 +- .../Forms/ActiveX/AxHost.AxContainer.cs | 2 +- .../Windows/Forms/ActiveX/AxHost.State.cs | 5 +- .../System/Windows/Forms/ActiveX/AxHost.cs | 2 +- .../Forms/ActiveX/Control.ActiveXImpl.cs | 24 ++-- .../Control_ActiveXControlInterfaces.cs | 4 +- .../src/System/Windows/Forms/Application.cs | 5 + .../COM2Interop/COM2PropertyDescriptor.cs | 6 +- .../COM2Interop/COM2TypeInfoProcessor.cs | 12 +- .../Forms/Control.ControlVersionInfo.cs | 7 +- .../src/System/Windows/Forms/Control.Ime.cs | 2 +- .../src/System/Windows/Forms/Control.cs | 32 ++---- .../CheckBox.CheckBoxAccessibleObject.cs | 2 +- .../ComboBox/ComboBox.ACNativeWindow.cs | 4 +- .../Forms/Controls/ComboBox/ComboBox.cs | 3 +- .../DataGridView/DataGridView.Methods.cs | 9 +- .../Controls/DataGridView/DataGridViewBand.cs | 6 +- .../DataGridView/DataGridViewCellStyle.cs | 1 - .../DataGridView/DataGridViewCheckBoxCell.cs | 5 +- .../DataGridView/DataGridViewComboBoxCell.cs | 18 ++- .../Forms/Dialogs/ThreadExceptionDialog.cs | 10 +- .../UIIntegrationTests/GlobalSuppressions.cs | 4 - .../tests/UnitTests/GlobalSuppressions.cs | 8 -- 47 files changed, 282 insertions(+), 295 deletions(-) delete mode 100644 src/System.Windows.Forms.Design/tests/UnitTests/GlobalSuppressions.cs delete mode 100644 src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/GlobalSuppressions.cs delete mode 100644 src/System.Windows.Forms/tests/UnitTests/GlobalSuppressions.cs diff --git a/.editorconfig b/.editorconfig index b8121f437f3..251d904316c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -264,7 +264,7 @@ dotnet_diagnostic.IDE0057.severity = suggestion dotnet_diagnostic.IDE0058.severity = silent # IDE0059: Unnecessary assignment of a value -dotnet_diagnostic.IDE0059.severity = none # TODO: warning +dotnet_diagnostic.IDE0059.severity = suggestion # TODO: warning # IDE0060: Remove unused parameter dotnet_diagnostic.IDE0060.severity = silent @@ -1277,7 +1277,7 @@ dotnet_diagnostic.CA5405.severity = error dotnet_diagnostic.CS1573.severity = none # IL3000: Avoid using accessing Assembly file path when publishing as a single-file -dotnet_diagnostic.IL3000.severity = none # TODO: warning +dotnet_diagnostic.IL3000.severity = warning # IL3001: Avoid using accessing Assembly file path when publishing as a single-file dotnet_diagnostic.IL3001.severity = warning @@ -1563,7 +1563,7 @@ dotnet_diagnostic.SA1300.severity = none dotnet_diagnostic.SA1301.severity = none # SA1302: Interface names should begin with I -dotnet_diagnostic.SA1302.severity = none # TODO: warning +dotnet_diagnostic.SA1302.severity = warning # SA1303: Const field names should begin with upper-case letter dotnet_diagnostic.SA1303.severity = none @@ -1617,7 +1617,7 @@ dotnet_diagnostic.SA1402.severity = none dotnet_diagnostic.SA1403.severity = none # SA1404: Code analysis suppression should have justification -dotnet_diagnostic.SA1404.severity = none # TODO: warning +dotnet_diagnostic.SA1404.severity = warning # SA1405: Debug.Assert should provide message text dotnet_diagnostic.SA1405.severity = none @@ -2252,6 +2252,9 @@ dotnet_diagnostic.CA2302.severity = none # CA5394: Do not use insecure randomness dotnet_diagnostic.CA5394.severity = none +# IL3000: Avoid using accessing Assembly file path when publishing as a single-file +dotnet_diagnostic.IL3000.severity = none + # SA1115: Parameter should begin on the line after the previous parameter dotnet_diagnostic.SA1115.severity = none diff --git a/src/Common/tests/TestUtilities/XUnit/InvalidEnumDataAttribute.cs b/src/Common/tests/TestUtilities/XUnit/InvalidEnumDataAttribute.cs index 621415270ce..409b1bfd607 100644 --- a/src/Common/tests/TestUtilities/XUnit/InvalidEnumDataAttribute.cs +++ b/src/Common/tests/TestUtilities/XUnit/InvalidEnumDataAttribute.cs @@ -18,7 +18,7 @@ public InvalidEnumDataAttribute() : base(typeof(InvalidEnumDataAttribute) private static unsafe ReadOnlyTheoryData InitializeData() { ulong maxValue = ulong.MaxValue >>> ((sizeof(ulong) - sizeof(TEnum)) * 8); - TEnum currentValue = default; + TEnum currentValue; bool defined; List data = []; diff --git a/src/System.Drawing.Common/src/System/Drawing/Icon.cs b/src/System.Drawing.Common/src/System/Drawing/Icon.cs index 81e361a60e3..ceb620cc9dc 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Icon.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Icon.cs @@ -613,7 +613,11 @@ public Bitmap ToBitmap() // if (HasPngSignature() && !LocalAppContextSwitches.DontSupportPngFramesInIcons) { - return PngFrame(); + // Return the PNG frame. + Debug.Assert(_iconData is not null); + using MemoryStream stream = new(); + stream.Write(_iconData, (int)_bestImageOffset, (int)_bestBytesInRes); + return new Bitmap(stream); } return BmpFrame(); @@ -760,14 +764,6 @@ private Bitmap BmpFrame() return bitmap; } - private Bitmap PngFrame() - { - Debug.Assert(_iconData is not null); - using MemoryStream stream = new(); - stream.Write(_iconData, (int)_bestImageOffset, (int)_bestBytesInRes); - return new Bitmap(stream); - } - private bool HasPngSignature() { if (!_isBestImagePng.HasValue) diff --git a/src/System.Drawing.Common/src/System/Drawing/ImageConverter.cs b/src/System.Drawing.Common/src/System/Drawing/ImageConverter.cs index c96c3401f12..5268f6f5d70 100644 --- a/src/System.Drawing.Common/src/System/Drawing/ImageConverter.cs +++ b/src/System.Drawing.Common/src/System/Drawing/ImageConverter.cs @@ -115,8 +115,8 @@ public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContex // 2.2.5 EmbeddedObject // https://learn.microsoft.com/openspecs/windows_protocols/ms-oleds/3395d95d-97f0-49ff-b792-28d331f254f1 - // Read and validate the ObjectHeader - if (!reader.TryRead(out uint version) + // Read and validate the ObjectHeader (version is the first uint) + if (!reader.TryRead(out uint _) || !reader.TryRead(out FMTID format) || format != FMTID.FMTID_EMBED || !reader.TryRead(out int classLength) diff --git a/src/System.Private.Windows.Core/src/System/Value.PackedDateTimeOffset.cs b/src/System.Private.Windows.Core/src/System/Value.PackedDateTimeOffset.cs index 9324d80b6c4..df5b52ab0ba 100644 --- a/src/System.Private.Windows.Core/src/System/Value.PackedDateTimeOffset.cs +++ b/src/System.Private.Windows.Core/src/System/Value.PackedDateTimeOffset.cs @@ -46,11 +46,11 @@ public static bool TryCreate(DateTimeOffset dateTime, TimeSpan offset, out Packe ulong ticks = (ulong)dateTime.Ticks; if (ticks is > BaseTicks and < MaxTicks) { - ulong data = default; int minutes = offset.Minutes; + if (minutes % 15 == 0) { - data = (ulong)(minutes / 15) << MinuteShift; + ulong data = (ulong)(minutes / 15) << MinuteShift; int hours = offset.Hours + HourOffset; // Only valid offset hours are -14 to 14 diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/System/Com/SafeArrayScope.cs b/src/System.Private.Windows.Core/src/Windows/Win32/System/Com/SafeArrayScope.cs index 7fd4a05b239..ac5e5735413 100644 --- a/src/System.Private.Windows.Core/src/Windows/Win32/System/Com/SafeArrayScope.cs +++ b/src/System.Private.Windows.Core/src/Windows/Win32/System/Com/SafeArrayScope.cs @@ -88,7 +88,8 @@ public SafeArrayScope(SAFEARRAY* value) public SafeArrayScope(uint size) { - VARENUM vt = VARENUM.VT_EMPTY; + VARENUM vt; + if (typeof(T) == typeof(string)) { vt = VARENUM.VT_BSTR; diff --git a/src/System.Windows.Forms.Design/src/GlobalSuppressions.cs b/src/System.Windows.Forms.Design/src/GlobalSuppressions.cs index f2dc679ef10..1282108bdb2 100644 --- a/src/System.Windows.Forms.Design/src/GlobalSuppressions.cs +++ b/src/System.Windows.Forms.Design/src/GlobalSuppressions.cs @@ -167,3 +167,4 @@ [assembly: SuppressMessage("Design", "CA1051:Do not declare visible instance fields", Justification = "Public API", Scope = "member", Target = "~F:System.Windows.Forms.Design.ControlDesigner.accessibilityObj")] [assembly: SuppressMessage("Design", "CA1051:Do not declare visible instance fields", Justification = "Public API", Scope = "member", Target = "~F:System.Windows.Forms.Design.ThemedScrollbarWindow.Handle")] [assembly: SuppressMessage("Design", "CA1051:Do not declare visible instance fields", Justification = "Public API", Scope = "member", Target = "~F:System.Windows.Forms.Design.ThemedScrollbarWindow.Mode")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:System.Runtime.InteropServices.UCOMITypeLib")] diff --git a/src/System.Windows.Forms.Design/src/System/Drawing/Design/ToolboxItem.cs b/src/System.Windows.Forms.Design/src/System/Drawing/Design/ToolboxItem.cs index ba45f31fb7a..0d3788e4c84 100644 --- a/src/System.Windows.Forms.Design/src/System/Drawing/Design/ToolboxItem.cs +++ b/src/System.Windows.Forms.Design/src/System/Drawing/Design/ToolboxItem.cs @@ -505,6 +505,10 @@ private static bool AreAssemblyNamesEqual(AssemblyName? name1, AssemblyName? nam } #pragma warning disable SYSLIB0044 // Type or member is obsolete. Ref https://github.com/dotnet/winforms/issues/7308 +#pragma warning disable IL3000 // Avoid accessing Assembly file path when publishing as a single file + + // If we're single file, CodeBase will be empty, that is expected. We can't load from a path + // that doesn't exist, so falling through to the next case is the right thing to do. if (a is null && !string.IsNullOrEmpty(assemblyName.CodeBase)) { try @@ -521,6 +525,7 @@ private static bool AreAssemblyNamesEqual(AssemblyName? name1, AssemblyName? nam { } } +#pragma warning restore IL3000 #pragma warning restore SYSLIB0044 if (a is not null) diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ContextMenuStripActionList.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ContextMenuStripActionList.cs index 0e109980bb6..64dda8f4dad 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ContextMenuStripActionList.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ContextMenuStripActionList.cs @@ -96,12 +96,26 @@ public override DesignerActionItemCollection GetSortedActionItems() { DesignerActionItemCollection items = [ - new DesignerActionPropertyItem("RenderMode", SR.ToolStripActionList_RenderMode, SR.ToolStripActionList_Layout, SR.ToolStripActionList_RenderModeDesc) + new DesignerActionPropertyItem( + nameof(RenderMode), + SR.ToolStripActionList_RenderMode, + SR.ToolStripActionList_Layout, + SR.ToolStripActionList_RenderModeDesc) ]; + if (_toolStripDropDown is ToolStripDropDownMenu) { - items.Add(new DesignerActionPropertyItem("ShowImageMargin", SR.ContextMenuStripActionList_ShowImageMargin, SR.ToolStripActionList_Layout, SR.ContextMenuStripActionList_ShowImageMarginDesc)); - items.Add(new DesignerActionPropertyItem("ShowCheckMargin", SR.ContextMenuStripActionList_ShowCheckMargin, SR.ToolStripActionList_Layout, SR.ContextMenuStripActionList_ShowCheckMarginDesc)); + items.Add(new DesignerActionPropertyItem( + nameof(ShowImageMargin), + SR.ContextMenuStripActionList_ShowImageMargin, + SR.ToolStripActionList_Layout, + SR.ContextMenuStripActionList_ShowImageMarginDesc)); + + items.Add(new DesignerActionPropertyItem( + nameof(ShowCheckMargin), + SR.ContextMenuStripActionList_ShowCheckMargin, + SR.ToolStripActionList_Layout, + SR.ContextMenuStripActionList_ShowCheckMarginDesc)); } return items; diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DataGridViewDesigner.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DataGridViewDesigner.cs index f83d5c77afc..9a0b66131ac 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DataGridViewDesigner.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DataGridViewDesigner.cs @@ -818,11 +818,13 @@ public DataGridViewChooseDataSourceActionList(DataGridViewDesigner owner) : base public override DesignerActionItemCollection GetSortedActionItems() { DesignerActionItemCollection items = []; - DesignerActionPropertyItem chooseDataSource = new("DataSource", // property name - SR.DataGridViewChooseDataSource) + DesignerActionPropertyItem chooseDataSource = new( + nameof(DataSource), + SR.DataGridViewChooseDataSource) { RelatedComponent = _owner.Component - };// displayName + }; + items.Add(chooseDataSource); return items; } @@ -831,11 +833,8 @@ public override DesignerActionItemCollection GetSortedActionItems() [Editor($"System.Windows.Forms.Design.DataSourceListEditor, {AssemblyRef.SystemDesign}", typeof(UITypeEditor))] public object? DataSource { - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] // DAP calls this method thru Reflection. // Use the shadow property which is defined on the designer. get => _owner.DataSource; - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] // DAP calls this method thru Reflection. set { // left to do: transaction stuff @@ -900,28 +899,17 @@ public DataGridViewPropertiesActionList(DataGridViewDesigner owner) : base(owner _owner = owner; } - public override DesignerActionItemCollection GetSortedActionItems() - { - DesignerActionItemCollection items = - [ - new DesignerActionPropertyItem("AllowUserToAddRows", - SR.DataGridViewEnableAdding), - new DesignerActionPropertyItem("ReadOnly", - SR.DataGridViewEnableEditing), - new DesignerActionPropertyItem("AllowUserToDeleteRows", - SR.DataGridViewEnableDeleting), - new DesignerActionPropertyItem("AllowUserToOrderColumns", - SR.DataGridViewEnableColumnReordering), - ]; - return items; - } + public override DesignerActionItemCollection GetSortedActionItems() => + [ + new DesignerActionPropertyItem(nameof(AllowUserToAddRows), SR.DataGridViewEnableAdding), + new DesignerActionPropertyItem(nameof(ReadOnly), SR.DataGridViewEnableEditing), + new DesignerActionPropertyItem(nameof(AllowUserToDeleteRows), SR.DataGridViewEnableDeleting), + new DesignerActionPropertyItem(nameof(AllowUserToOrderColumns), SR.DataGridViewEnableColumnReordering) + ]; public bool AllowUserToAddRows { - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] // DAP calls this method thru Reflection. get => _owner.Control.AllowUserToAddRows; - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] // DAP calls this method thru Reflection. set { if (value == AllowUserToAddRows) @@ -964,10 +952,7 @@ public bool AllowUserToAddRows public bool AllowUserToDeleteRows { - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] // DAP calls this method thru Reflection. get => _owner.Control.AllowUserToDeleteRows; - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] // DAP calls this method thru Reflection. set { if (value == AllowUserToDeleteRows) @@ -1010,10 +995,7 @@ public bool AllowUserToDeleteRows public bool AllowUserToOrderColumns { - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] // DAP calls this method thru Reflection. get => _owner.Control.AllowUserToOrderColumns; - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] // DAP calls this method thru Reflection. set { if (value == AllowUserToOrderColumns) @@ -1056,10 +1038,7 @@ public bool AllowUserToOrderColumns public bool ReadOnly { - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] // DAP calls this method thru Reflection. get => !_owner.Control.ReadOnly; - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] // DAP calls this method thru Reflection. set { if (value == ReadOnly) diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DesignBindingPicker.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DesignBindingPicker.cs index dc9475176eb..fd7af6b19ee 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DesignBindingPicker.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DesignBindingPicker.cs @@ -1390,7 +1390,10 @@ private static string GetBindingSourceNamePrefix(object dataSource, string dataM /// use that in preference to using the Type class (since this service can more /// reliably instantiate project level types). /// - [SuppressMessage("Trimming", "IL2096:Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types.", Justification = "")] + [SuppressMessage( + "Trimming", + "IL2096:Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types.", + Justification = "No known workaround.")] private Type? GetType(string name, bool throwOnError, bool ignoreCase) { if (_typeResolutionService is not null) diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ListViewActionList.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ListViewActionList.cs index 1fc016eff93..b5e25b57827 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ListViewActionList.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ListViewActionList.cs @@ -18,86 +18,58 @@ public ListViewActionList(ComponentDesigner designer) _listView = (ListView)Component!; } - public void InvokeItemsDialog() - { - EditorServiceContext.EditValue(_designer, Component!, "Items"); - } + public void InvokeItemsDialog() => + EditorServiceContext.EditValue(_designer, Component!, nameof(ListView.Items)); - public void InvokeColumnsDialog() - { - EditorServiceContext.EditValue(_designer, Component!, "Columns"); - } + public void InvokeColumnsDialog() => + EditorServiceContext.EditValue(_designer, Component!, nameof(ListView.Columns)); - public void InvokeGroupsDialog() - { - EditorServiceContext.EditValue(_designer, Component!, "Groups"); - } + public void InvokeGroupsDialog() => + EditorServiceContext.EditValue(_designer, Component!, nameof(ListView.Groups)); public View View { - get - { - return _listView.View; - } - set - { - TypeDescriptor.GetProperties(_listView)["View"]!.SetValue(Component, value); - } + get => _listView.View; + set => TypeDescriptor.GetProperties(_listView)[nameof(View)]!.SetValue(Component, value); } public ImageList? LargeImageList { - get - { - return _listView.LargeImageList; - } - set - { - TypeDescriptor.GetProperties(_listView)["LargeImageList"]!.SetValue(Component, value); - } + get => _listView.LargeImageList; + set => TypeDescriptor.GetProperties(_listView)[nameof(LargeImageList)]!.SetValue(Component, value); } public ImageList? SmallImageList { - get - { - return _listView.SmallImageList; - } - set - { - TypeDescriptor.GetProperties(_listView)["SmallImageList"]!.SetValue(Component, value); - } + get => _listView.SmallImageList; + set => TypeDescriptor.GetProperties(_listView)[nameof(SmallImageList)]!.SetValue(Component, value); } - public override DesignerActionItemCollection GetSortedActionItems() - { - DesignerActionItemCollection items = - [ - new DesignerActionMethodItem(this, "InvokeItemsDialog", - SR.ListViewActionListEditItemsDisplayName, - SR.PropertiesCategoryName, - SR.ListViewActionListEditItemsDescription, true), - new DesignerActionMethodItem(this, "InvokeColumnsDialog", - SR.ListViewActionListEditColumnsDisplayName, - SR.PropertiesCategoryName, - SR.ListViewActionListEditColumnsDescription, true), - new DesignerActionMethodItem(this, "InvokeGroupsDialog", - SR.ListViewActionListEditGroupsDisplayName, - SR.PropertiesCategoryName, - SR.ListViewActionListEditGroupsDescription, true), - new DesignerActionPropertyItem("View", - SR.ListViewActionListViewDisplayName, - SR.PropertiesCategoryName, - SR.ListViewActionListViewDescription), - new DesignerActionPropertyItem("SmallImageList", - SR.ListViewActionListSmallImagesDisplayName, - SR.PropertiesCategoryName, - SR.ListViewActionListSmallImagesDescription), - new DesignerActionPropertyItem("LargeImageList", - SR.ListViewActionListLargeImagesDisplayName, - SR.PropertiesCategoryName, - SR.ListViewActionListLargeImagesDescription), - ]; - return items; - } + public override DesignerActionItemCollection GetSortedActionItems() => + [ + new DesignerActionMethodItem(this, nameof(InvokeItemsDialog), + SR.ListViewActionListEditItemsDisplayName, + SR.PropertiesCategoryName, + SR.ListViewActionListEditItemsDescription, true), + new DesignerActionMethodItem(this, nameof(InvokeColumnsDialog), + SR.ListViewActionListEditColumnsDisplayName, + SR.PropertiesCategoryName, + SR.ListViewActionListEditColumnsDescription, true), + new DesignerActionMethodItem(this, nameof(InvokeGroupsDialog), + SR.ListViewActionListEditGroupsDisplayName, + SR.PropertiesCategoryName, + SR.ListViewActionListEditGroupsDescription, true), + new DesignerActionPropertyItem(nameof(View), + SR.ListViewActionListViewDisplayName, + SR.PropertiesCategoryName, + SR.ListViewActionListViewDescription), + new DesignerActionPropertyItem(nameof(SmallImageList), + SR.ListViewActionListSmallImagesDisplayName, + SR.PropertiesCategoryName, + SR.ListViewActionListSmallImagesDescription), + new DesignerActionPropertyItem(nameof(LargeImageList), + SR.ListViewActionListLargeImagesDisplayName, + SR.PropertiesCategoryName, + SR.ListViewActionListLargeImagesDescription), + ]; } diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/PictureBoxActionList.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/PictureBoxActionList.cs index 32c5a3c19c8..1bfc4f95967 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/PictureBoxActionList.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/PictureBoxActionList.cs @@ -20,28 +20,25 @@ public PictureBoxActionList(PictureBoxDesigner designer) public PictureBoxSizeMode SizeMode { - get - { - return _pictureBox.SizeMode; - } - set - { - TypeDescriptor.GetProperties(_pictureBox)["SizeMode"]!.SetValue(Component, value); - } + get => _pictureBox.SizeMode; + set => TypeDescriptor.GetProperties(_pictureBox)[nameof(PictureBox.SizeMode)]!.SetValue(Component, value); } - public void ChooseImage() - { - EditorServiceContext.EditValue(_designer, Component!, "Image"); - } + public void ChooseImage() => EditorServiceContext.EditValue(_designer, Component!, nameof(PictureBox.Image)); - public override DesignerActionItemCollection GetSortedActionItems() - { - DesignerActionItemCollection items = - [ - new DesignerActionMethodItem(this, "ChooseImage", SR.ChooseImageDisplayName, SR.PropertiesCategoryName, SR.ChooseImageDescription, true), - new DesignerActionPropertyItem("SizeMode", SR.SizeModeDisplayName, SR.PropertiesCategoryName, SR.SizeModeDescription), - ]; - return items; - } + public override DesignerActionItemCollection GetSortedActionItems() => + [ + new DesignerActionMethodItem( + this, + nameof(ChooseImage), + SR.ChooseImageDisplayName, + SR.PropertiesCategoryName, + SR.ChooseImageDescription, + includeAsDesignerVerb: true), + new DesignerActionPropertyItem( + nameof(SizeMode), + SR.SizeModeDisplayName, + SR.PropertiesCategoryName, + SR.SizeModeDescription), + ]; } diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TextBoxActionList.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TextBoxActionList.cs index 8a1ffb50461..84376a99ff4 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TextBoxActionList.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TextBoxActionList.cs @@ -18,22 +18,14 @@ public TextBoxActionList(TextBoxDesigner designer) public bool Multiline { - get - { - return _textBox.Multiline; - } - set - { - TypeDescriptor.GetProperties(_textBox)["Multiline"]!.SetValue(Component, value); - } + get => _textBox.Multiline; + set => TypeDescriptor.GetProperties(_textBox)[nameof(Multiline)]!.SetValue(Component, value); } - public override DesignerActionItemCollection GetSortedActionItems() - { - DesignerActionItemCollection items = - [ - new DesignerActionPropertyItem("Multiline", string.Format(SR.MultiLineDisplayName, SR.PropertiesCategoryName, SR.MultiLineDescription)), - ]; - return items; - } + public override DesignerActionItemCollection GetSortedActionItems() => + [ + new DesignerActionPropertyItem( + nameof(Multiline), + string.Format(SR.MultiLineDisplayName, SR.PropertiesCategoryName, SR.MultiLineDescription)), + ]; } diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ToolStripActionList.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ToolStripActionList.cs index 6c97462b0ec..25e8377aa2a 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ToolStripActionList.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ToolStripActionList.cs @@ -136,27 +136,51 @@ public override DesignerActionItemCollection GetSortedActionItems() DesignerActionItemCollection items = []; if (!IsReadOnly) { - items.Add(new DesignerActionMethodItem(this, "InvokeEmbedVerb", SR.ToolStripDesignerEmbedVerb, "", SR.ToolStripDesignerEmbedVerbDesc, true)); + items.Add(new DesignerActionMethodItem( + this, + nameof(InvokeEmbedVerb), + SR.ToolStripDesignerEmbedVerb, + "", + SR.ToolStripDesignerEmbedVerbDesc, + includeAsDesignerVerb: true)); } if (CanAddItems) { if (_toolStrip is not StatusStrip) { - items.Add(new DesignerActionMethodItem(this, "InvokeInsertStandardItemsVerb", SR.ToolStripDesignerStandardItemsVerb, "", SR.ToolStripDesignerStandardItemsVerbDesc, true)); + items.Add(new DesignerActionMethodItem( + this, + nameof(InvokeInsertStandardItemsVerb), + SR.ToolStripDesignerStandardItemsVerb, + "", + SR.ToolStripDesignerStandardItemsVerbDesc, + true)); } - items.Add(new DesignerActionPropertyItem("RenderMode", SR.ToolStripActionList_RenderMode, SR.ToolStripActionList_Layout, SR.ToolStripActionList_RenderModeDesc)); + items.Add(new DesignerActionPropertyItem( + nameof(RenderMode), + SR.ToolStripActionList_RenderMode, + SR.ToolStripActionList_Layout, + SR.ToolStripActionList_RenderModeDesc)); } if (_toolStrip.Parent is not ToolStripPanel) { - items.Add(new DesignerActionPropertyItem("Dock", SR.ToolStripActionList_Dock, SR.ToolStripActionList_Layout, SR.ToolStripActionList_DockDesc)); + items.Add(new DesignerActionPropertyItem( + nameof(Dock), + SR.ToolStripActionList_Dock, + SR.ToolStripActionList_Layout, + SR.ToolStripActionList_DockDesc)); } if (_toolStrip is not StatusStrip) { - items.Add(new DesignerActionPropertyItem("GripStyle", SR.ToolStripActionList_GripStyle, SR.ToolStripActionList_Layout, SR.ToolStripActionList_GripStyleDesc)); + items.Add(new DesignerActionPropertyItem( + nameof(GripStyle), + SR.ToolStripActionList_GripStyle, + SR.ToolStripActionList_Layout, + SR.ToolStripActionList_GripStyleDesc)); } return items; diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TreeViewActionList.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TreeViewActionList.cs index e5b6092536c..c9ddac167fb 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TreeViewActionList.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TreeViewActionList.cs @@ -18,30 +18,27 @@ public TreeViewActionList(TreeViewDesigner designer) _treeView = (TreeView)designer.Component; } - public void InvokeNodesDialog() - { - EditorServiceContext.EditValue(_designer, Component!, "Nodes"); - } + public void InvokeNodesDialog() => EditorServiceContext.EditValue(_designer, Component!, nameof(TreeView.Nodes)); public ImageList? ImageList { - get - { - return _treeView.ImageList; - } - set - { - TypeDescriptor.GetProperties(_treeView)["ImageList"]!.SetValue(Component, value); - } + get => _treeView.ImageList; + set => TypeDescriptor.GetProperties(_treeView)[nameof(TreeView.ImageList)]!.SetValue(Component, value); } - public override DesignerActionItemCollection GetSortedActionItems() - { - DesignerActionItemCollection items = - [ - new DesignerActionMethodItem(this, "InvokeNodesDialog", SR.InvokeNodesDialogDisplayName, SR.PropertiesCategoryName, SR.InvokeNodesDialogDescription, true), - new DesignerActionPropertyItem("ImageList", SR.ImageListDisplayName, SR.PropertiesCategoryName, SR.ImageListDescription), - ]; - return items; - } + public override DesignerActionItemCollection GetSortedActionItems() => + [ + new DesignerActionMethodItem( + this, + nameof(InvokeNodesDialog), + SR.InvokeNodesDialogDisplayName, + SR.PropertiesCategoryName, + SR.InvokeNodesDialogDescription, + includeAsDesignerVerb: true), + new DesignerActionPropertyItem( + nameof(ImageList), + SR.ImageListDisplayName, + SR.PropertiesCategoryName, + SR.ImageListDescription), + ]; } diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/GlobalSuppressions.cs b/src/System.Windows.Forms.Design/tests/UnitTests/GlobalSuppressions.cs deleted file mode 100644 index 4df68b277ea..00000000000 --- a/src/System.Windows.Forms.Design/tests/UnitTests/GlobalSuppressions.cs +++ /dev/null @@ -1,7 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Diagnostics.CodeAnalysis; - -[assembly: SuppressMessage("Style", "IDE0300:Simplify collection initialization", Justification = "", Scope = "member", Target = "~M:System.ComponentModel.Design.Tests.DesignerVerbCollectionTests.DesignerVerbCollection_CopyTo_Invoke_Success")] -[assembly: SuppressMessage("Style", "IDE0300:Simplify collection initialization", Justification = "", Scope = "member", Target = "~M:System.ComponentModel.Design.Tests.DesignerActionListCollectionTests.DesignerActionListCollection_CopyTo_Invoke_Success")] diff --git a/src/System.Windows.Forms.Primitives/src/GlobalSuppressions.cs b/src/System.Windows.Forms.Primitives/src/GlobalSuppressions.cs index e9244d5b962..9060e8a836d 100644 --- a/src/System.Windows.Forms.Primitives/src/GlobalSuppressions.cs +++ b/src/System.Windows.Forms.Primitives/src/GlobalSuppressions.cs @@ -5,3 +5,27 @@ [assembly: SuppressMessage("Performance", "CA1815:Override equals and operator equals on value types", Justification = "Public API", Scope = "type", Target = "~T:System.Windows.Forms.VisualStyles.TextMetrics")] [assembly: SuppressMessage("Naming", "CA1725:Parameter names should match base declaration", Justification = "Public API", Scope = "member", Target = "~M:System.Windows.Forms.Message.Equals(System.Object)~System.Boolean")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.Mshtml.DHTMLButtonElementEvents2")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.Mshtml.DHTMLAnchorEvents2")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.Mshtml.DHTMLAreaEvents2")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.Mshtml.DHTMLControlElementEvents2")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.Mshtml.DHTMLDocumentEvents2")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.Mshtml.DHTMLElementEvents2")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.Mshtml.DHTMLFormElementEvents2")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.Mshtml.DHTMLFrameSiteEvents2")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.Mshtml.DHTMLImgEvents2")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.Mshtml.DHTMLInputFileElementEvents2")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.Mshtml.DHTMLInputImageEvents2")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.Mshtml.DHTMLInputTextElementEvents2")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.Mshtml.DHTMLLabelEvents2")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.Mshtml.DHTMLLinkElementEvents2")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.Mshtml.DHTMLMapEvents2")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.Mshtml.DHTMLMarqueeElementEvents2")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.Mshtml.DHTMLOptionButtonElementEvents2")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.Mshtml.DHTMLScriptEvents2")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.Mshtml.DHTMLSelectElementEvents2")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.Mshtml.DHTMLStyleElementEvents2")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.Mshtml.DHTMLTableEvents2")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.Mshtml.DHTMLTextContainerEvents2")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.Mshtml.DHTMLWindowEvents2")] +[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "External name", Scope = "type", Target = "~T:Interop.SHDocVw.DWebBrowserEvents2")] diff --git a/src/System.Windows.Forms.Primitives/src/System/Collections/Generic/WeakRefCollection.cs b/src/System.Windows.Forms.Primitives/src/System/Collections/Generic/WeakRefCollection.cs index aeba5245284..83085287858 100644 --- a/src/System.Windows.Forms.Primitives/src/System/Collections/Generic/WeakRefCollection.cs +++ b/src/System.Windows.Forms.Primitives/src/System/Collections/Generic/WeakRefCollection.cs @@ -37,7 +37,7 @@ public void ScavengeReferences() { for (int i = Count - 1; i >= 0; i--) { - if (!_list[i].TryGetTarget(out T? target)) + if (!_list[i].TryGetTarget(out T? _)) { _list.RemoveAt(i); } diff --git a/src/System.Windows.Forms.Primitives/src/System/ComponentModel/Design/Serialization/DesignerSerializationManagerHelper.cs b/src/System.Windows.Forms.Primitives/src/System/ComponentModel/Design/Serialization/DesignerSerializationManagerHelper.cs index 325d7448299..8900b1011f6 100644 --- a/src/System.Windows.Forms.Primitives/src/System/ComponentModel/Design/Serialization/DesignerSerializationManagerHelper.cs +++ b/src/System.Windows.Forms.Primitives/src/System/ComponentModel/Design/Serialization/DesignerSerializationManagerHelper.cs @@ -9,7 +9,6 @@ public static bool TryGetContext( this IDesignerSerializationManager manager, [NotNullWhen(true)] out T? context) { - object? contextObject = manager.Context[typeof(T)]; if (manager.Context[typeof(T)] is T contextTemp) { context = contextTemp; diff --git a/src/System.Windows.Forms.Primitives/src/System/Windows/Forms/Automation/UiaTextRange.cs b/src/System.Windows.Forms.Primitives/src/System/Windows/Forms/Automation/UiaTextRange.cs index b615f7c5f07..5cbfb0330dd 100644 --- a/src/System.Windows.Forms.Primitives/src/System/Windows/Forms/Automation/UiaTextRange.cs +++ b/src/System.Windows.Forms.Primitives/src/System/Windows/Forms/Automation/UiaTextRange.cs @@ -609,7 +609,7 @@ HRESULT ITextRangeProvider.Interface.ScrollIntoView(BOOL alignToTop) if (Start > visibleStart || Start < visibleEnd) { UiaTextProvider.SendKeyboardInputVK(key, true); - _provider.GetVisibleRangePoints(out visibleStart, out visibleEnd); + _provider.GetVisibleRangePoints(out _, out _); } return HRESULT.S_OK; @@ -618,7 +618,7 @@ HRESULT ITextRangeProvider.Interface.ScrollIntoView(BOOL alignToTop) if (Start < visibleStart || Start > visibleEnd) { UiaTextProvider.SendKeyboardInputVK(key, true); - _provider.GetVisibleRangePoints(out visibleStart, out visibleEnd); + _provider.GetVisibleRangePoints(out _, out _); } } diff --git a/src/System.Windows.Forms/src/System/Resources/AssemblyNamesTypeResolutionService.cs b/src/System.Windows.Forms/src/System/Resources/AssemblyNamesTypeResolutionService.cs index df414549113..044a348151d 100644 --- a/src/System.Windows.Forms/src/System/Resources/AssemblyNamesTypeResolutionService.cs +++ b/src/System.Windows.Forms/src/System/Resources/AssemblyNamesTypeResolutionService.cs @@ -63,7 +63,9 @@ internal class AssemblyNamesTypeResolutionService : ITypeResolutionService public string GetPathOfAssembly(AssemblyName name) { #pragma warning disable SYSLIB0044 // Type or member is obsolete. Ref https://github.com/dotnet/winforms/issues/7308 +#pragma warning disable IL3000 // Avoid accessing Assembly file path when publishing as a single file return name.CodeBase ?? string.Empty; +#pragma warning restore IL3000 #pragma warning restore SYSLIB0044 } @@ -155,12 +157,14 @@ public string GetPathOfAssembly(AssemblyName name) if (result is not null) { - // Only cache types from the shared framework because they don't need to update. + // Only cache types from the shared framework because they don't need to update. // For simplicity, don't cache custom types +#pragma warning disable IL3000 // Avoid accessing Assembly file path when publishing as a single file if (IsDotNetAssembly(result.Assembly.Location)) { _cachedTypes[name] = result; } +#pragma warning restore IL3000 } return result; diff --git a/src/System.Windows.Forms/src/System/Resources/ResXDataNode.cs b/src/System.Windows.Forms/src/System/Resources/ResXDataNode.cs index c52897a0d83..4559b2790ae 100644 --- a/src/System.Windows.Forms/src/System/Resources/ResXDataNode.cs +++ b/src/System.Windows.Forms/src/System/Resources/ResXDataNode.cs @@ -684,7 +684,7 @@ private static byte[] FromBase64WrappedString(string text) } } - return resolvedType ??= Type.GetType(typeName, throwOnError: false); + return resolvedType ?? Type.GetType(typeName, throwOnError: false); } void ISerializable.GetObjectData(SerializationInfo si, StreamingContext context) diff --git a/src/System.Windows.Forms/src/System/Resources/ResxFileRef.Converter.cs b/src/System.Windows.Forms/src/System/Resources/ResxFileRef.Converter.cs index 1b0fbec3046..55157c38f07 100644 --- a/src/System.Windows.Forms/src/System/Resources/ResxFileRef.Converter.cs +++ b/src/System.Windows.Forms/src/System/Resources/ResxFileRef.Converter.cs @@ -43,7 +43,7 @@ public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destina return null; } - string[]? result = null; + string[]? result; stringValue = stringValue.Trim(); string fileName; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Accessibility/Control.ControlAccessibleObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Accessibility/Control.ControlAccessibleObject.cs index 052af1680fb..9d447f6a375 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Accessibility/Control.ControlAccessibleObject.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Accessibility/Control.ControlAccessibleObject.cs @@ -453,7 +453,7 @@ public override int GetHelpTopic(out string? fileName) internal override bool CanGetHelpTopicInternal => IsInternal && (!this.TryGetOwnerAs(out Control? owner) - || owner.Events[s_queryAccessibilityHelpEvent] is not QueryAccessibilityHelpEventHandler handler); + || owner.Events[s_queryAccessibilityHelpEvent] is not QueryAccessibilityHelpEventHandler); public void NotifyClients(AccessibleEvents accEvent) => NotifyClients(accEvent, (int)OBJECT_IDENTIFIER.OBJID_CLIENT, 0); diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.AxContainer.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.AxContainer.cs index a03d0ca8c29..e6df3c10b36 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.AxContainer.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.AxContainer.cs @@ -160,7 +160,7 @@ internal IEnumUnknown.Interface EnumControls(Control control, uint dwOleContF, E GetComponents(); _lockCount++; - Control? additionalControl = control; + Control? additionalControl; try { diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.State.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.State.cs index 74d75638e5d..cf07028b8e0 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.State.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.State.cs @@ -227,7 +227,10 @@ private void InitializeFromStream(Stream dataStream, bool initializeBufferOnly = // For compatibility, always translate by adding 1 to match our new internal // storage values (unknown = 0, stream = 1, etc.). Type = (StorageType)(binaryReader.ReadInt32() + 1); - int version = binaryReader.ReadInt32(); + + // Version + _ = binaryReader.ReadInt32(); + ManualUpdate = binaryReader.ReadBoolean(); int cc = binaryReader.ReadInt32(); if (cc != 0) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.cs index 3abe0e09c49..2450217f899 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.cs @@ -2597,7 +2597,6 @@ private PropertyDescriptorCollection FillProperties(Attribute[]? attributes) } string propName = baseProps[i].Name; - PropertyDescriptor? prop = null; _propertyInfos.TryGetValue(propName, out PropertyInfo? propInfo); @@ -2609,6 +2608,7 @@ private PropertyDescriptorCollection FillProperties(Attribute[]? attributes) if (!_properties.TryGetValue(propName, out PropertyDescriptor? propDesc)) { + PropertyDescriptor? prop; if (propInfo is not null) { prop = new AxPropertyDescriptor(baseProps[i], this); diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/Control.ActiveXImpl.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/Control.ActiveXImpl.cs index 002cbbd78b8..8e12b6debe8 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/Control.ActiveXImpl.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/Control.ActiveXImpl.cs @@ -499,22 +499,14 @@ internal HRESULT Draw( /// internal static IEnumOLEVERB* EnumVerbs() { - if (s_axVerbs is null) - { - OLEVERB verbShow = new() - { - lVerb = OLEIVERB.OLEIVERB_SHOW - }; - - s_axVerbs = - [ - new() { lVerb = OLEIVERB.OLEIVERB_SHOW }, - new() { lVerb = OLEIVERB.OLEIVERB_INPLACEACTIVATE }, - new() { lVerb = OLEIVERB.OLEIVERB_UIACTIVATE }, - new() { lVerb = OLEIVERB.OLEIVERB_HIDE }, - new() { lVerb = OLEIVERB.OLEIVERB_PRIMARY }, - ]; - } + s_axVerbs ??= + [ + new() { lVerb = OLEIVERB.OLEIVERB_SHOW }, + new() { lVerb = OLEIVERB.OLEIVERB_INPLACEACTIVATE }, + new() { lVerb = OLEIVERB.OLEIVERB_UIACTIVATE }, + new() { lVerb = OLEIVERB.OLEIVERB_HIDE }, + new() { lVerb = OLEIVERB.OLEIVERB_PRIMARY }, + ]; return ComHelpers.GetComPointer(new ActiveXVerbEnum(s_axVerbs)); } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/Control_ActiveXControlInterfaces.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/Control_ActiveXControlInterfaces.cs index bf6b5f25311..8ff03cb91e7 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/Control_ActiveXControlInterfaces.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/Control_ActiveXControlInterfaces.cs @@ -198,7 +198,7 @@ HRESULT IOleObject.Interface.GetClipboardData(uint dwReserved, ComIDataObject** return HRESULT.E_POINTER; } - ppDataObject = null; + *ppDataObject = null; return HRESULT.E_NOTIMPL; } @@ -535,6 +535,8 @@ HRESULT IViewObject.Interface.Draw( pfnContinue, dwContinue); + Debug.Assert(hr.Succeeded); + return HRESULT.S_OK; } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Application.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Application.cs index 021b30265b1..33723c489d1 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Application.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Application.cs @@ -1093,9 +1093,14 @@ private static FileVersionInfo GetAppFileVersionInfo() if (s_appFileVersion is null) { Type? type = GetAppMainType(); + + // In a single-file, "Location" will be empty and it will fall back to ExecutablePath, + // which gives the desired result. +#pragma warning disable IL3000 // Avoid accessing Assembly file path when publishing as a single file s_appFileVersion = type is not null && type.Assembly.Location.Length > 0 ? FileVersionInfo.GetVersionInfo(type.Module.FullyQualifiedName) : FileVersionInfo.GetVersionInfo(ExecutablePath); +#pragma warning restore IL3000 } } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ComponentModel/COM2Interop/COM2PropertyDescriptor.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ComponentModel/COM2Interop/COM2PropertyDescriptor.cs index 4d5e0530367..33dd3d9e801 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/ComponentModel/COM2Interop/COM2PropertyDescriptor.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/ComponentModel/COM2Interop/COM2PropertyDescriptor.cs @@ -692,11 +692,13 @@ public void GetTypeConverterAndTypeEditor([NotNull] ref TypeConverter? typeConve // We don't do this if the state came from an attribute. if ((_refreshState & Com2PropertyDescriptorRefresh.TypeConverterAttr) == 0 && PropertyType == typeof(Com2Variant)) { - Type editorType = PropertyType; + // The results were never used here, they probably were intended to be used. + // Without specific scenarios, leaving the access as is to avoid breaking changes. + _ = PropertyType; object? value = GetValue(TargetObject); if (value is not null) { - editorType = value.GetType(); + _ = value.GetType(); } ComNativeDescriptor.ResolveVariantTypeConverterAndTypeEditor(value, ref localConverter, editorBaseType, ref localEditor); diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ComponentModel/COM2Interop/COM2TypeInfoProcessor.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ComponentModel/COM2Interop/COM2TypeInfoProcessor.cs index 4a41e660f63..82d08137c97 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/ComponentModel/COM2Interop/COM2TypeInfoProcessor.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/ComponentModel/COM2Interop/COM2TypeInfoProcessor.cs @@ -218,7 +218,6 @@ private static Com2Properties ProcessTypeInfos(object comObject, ITypeInfo*[] ty { int defaultProperty = -1; List propList = []; - Guid[] typeGuids = new Guid[typeInfos.Length]; for (int i = 0; i < typeInfos.Length; i++) { @@ -436,10 +435,8 @@ private static Com2PropertyDescriptor[] InternalGetProperties( } Com2PropertyDescriptor[] properties = new Com2PropertyDescriptor[propertyCount]; - int defaultProperty = -1; - HRESULT hr = HRESULT.S_OK; - object? pvar = null; + HRESULT hr; // For each item in our list, create the descriptor an check if it's the default one. foreach (PropertyInfo info in propertyInfo.Values) @@ -449,7 +446,7 @@ private static Com2PropertyDescriptor[] InternalGetProperties( // Finally, for each property, make sure we can get the value // if we can't then we should mark it non-browsable. - hr = ComNativeDescriptor.GetPropertyValue(dispatch, info.DispId, out pvar); + hr = ComNativeDescriptor.GetPropertyValue(dispatch, info.DispId, out object? pvar); if (!hr.Succeeded) { @@ -471,11 +468,6 @@ private static Com2PropertyDescriptor[] InternalGetProperties( info.ValueType, info.TypeData, !hr.Succeeded); - - if (info.IsDefault) - { - defaultProperty = info.Index; - } } if (addAboutBox) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Control.ControlVersionInfo.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Control.ControlVersionInfo.cs index 0df95a43cec..233e89aa691 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Control.ControlVersionInfo.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Control.ControlVersionInfo.cs @@ -153,8 +153,7 @@ internal string ProductVersion } /// - /// Retrieves the FileVersionInfo associated with the main module for - /// the component. + /// Retrieves the FileVersionInfo associated with the main module for the component. /// [RequiresAssemblyFiles($"Throws if {nameof(_owner)} is an in-memory assembly. Check {nameof(OwnerIsInMemoryAssembly)} first")] private FileVersionInfo GetFileVersionInfo() @@ -162,13 +161,15 @@ private FileVersionInfo GetFileVersionInfo() if (_versionInfo is null) { string path = _owner.GetType().Module.FullyQualifiedName; - _versionInfo = FileVersionInfo.GetVersionInfo(path); } return _versionInfo; } + // We're deliberately checking for the empty string scenario to see if this is single-file. +#pragma warning disable IL3000 // Avoid accessing Assembly file path when publishing as a single file private bool OwnerIsInMemoryAssembly => _owner.GetType().Assembly.Location.Length == 0; +#pragma warning restore IL3000 } } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Control.Ime.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Control.Ime.cs index c6158f47168..334c13360e1 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Control.Ime.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Control.Ime.cs @@ -746,7 +746,7 @@ public static void Enable(IntPtr handle) public static unsafe ImeMode GetImeMode(IntPtr handle) { HIMC inputContext = (HIMC)IntPtr.Zero; - ImeMode retval = ImeMode.NoControl; + ImeMode retval; // Get the right table for the current keyboard layout ImeMode[] countryTable = ImeModeConversion.InputLanguageTable; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Control.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Control.cs index 7a696612762..6129e480b90 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Control.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Control.cs @@ -9664,33 +9664,23 @@ protected virtual void ScaleControl(SizeF factor, BoundsSpecified specified) Size minSize = MinimumSize; Size maxSize = MaximumSize; - // clear out min and max size, otherwise this could affect the scaling logic. + // Clear out min and max size, otherwise this could affect the scaling logic. MinimumSize = Size.Empty; MaximumSize = Size.Empty; - // this is raw because Min/Max size have been cleared at this point. + // This is raw because Min/Max size have been cleared at this point. Rectangle rawScaledBounds = GetScaledBounds(Bounds, factor, specified); // // Scale Padding and Margin // + float dx = factor.Width; float dy = factor.Height; Padding padding = Padding; Padding margins = Margin; - // Clear off specified bits for 1.0 scaling factors - if (dx == 1.0F) - { - specified &= ~(BoundsSpecified.X | BoundsSpecified.Width); - } - - if (dy == 1.0F) - { - specified &= ~(BoundsSpecified.Y | BoundsSpecified.Height); - } - if (dx != 1.0F) { padding.Left = (int)Math.Round(padding.Left * dx); @@ -9722,17 +9712,19 @@ protected virtual void ScaleControl(SizeF factor, BoundsSpecified specified) if (!minSize.IsEmpty) { minSize -= adornmentSize; - minSize = ScaleSize(LayoutUtils.UnionSizes(Size.Empty, minSize), // make sure we don't go below 0. - factor.Width, - factor.Height) + adornmentSize; + minSize = ScaleSize( + LayoutUtils.UnionSizes(Size.Empty, minSize), // make sure we don't go below 0. + factor.Width, + factor.Height) + adornmentSize; } if (!maxSize.IsEmpty) { maxSize -= adornmentSize; - maxSize = ScaleSize(LayoutUtils.UnionSizes(Size.Empty, maxSize), // make sure we don't go below 0. - factor.Width, - factor.Height) + adornmentSize; + maxSize = ScaleSize( + LayoutUtils.UnionSizes(Size.Empty, maxSize), // make sure we don't go below 0. + factor.Width, + factor.Height) + adornmentSize; } // Apply the min/max size constraints - don't call ApplySizeConstraints @@ -12466,7 +12458,7 @@ protected virtual void WndProc(ref Message m) SYSTEM_PARAMETERS_INFO_ACTION action = (SYSTEM_PARAMETERS_INFO_ACTION)(uint)m.WParamInternal; // Left here for debugging purposes. - string? text = m.LParamInternal == 0 ? null : new((char*)m.LParamInternal); + // string? text = m.LParamInternal == 0 ? null : new((char*)m.LParamInternal); if (action is SYSTEM_PARAMETERS_INFO_ACTION.SPI_SETNONCLIENTMETRICS && m.LParamInternal == 0) { diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/CheckBox.CheckBoxAccessibleObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/CheckBox.CheckBoxAccessibleObject.cs index 88208e2f2d9..30246ec6d6f 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/CheckBox.CheckBoxAccessibleObject.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/CheckBox.CheckBoxAccessibleObject.cs @@ -8,7 +8,7 @@ namespace System.Windows.Forms; public partial class CheckBox { - public class CheckBoxAccessibleObject(Control owner) : ButtonBaseAccessibleObject((owner is CheckBox owningCheckBox) + public class CheckBoxAccessibleObject(Control owner) : ButtonBaseAccessibleObject((owner is CheckBox) ? owner : throw new ArgumentException(string.Format(SR.ConstructorArgumentInvalidValueType, nameof(owner), typeof(CheckBox)))) { diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ComboBox/ComboBox.ACNativeWindow.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ComboBox/ComboBox.ACNativeWindow.cs index 2cf45c37264..8464175208c 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ComboBox/ComboBox.ACNativeWindow.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ComboBox/ComboBox.ACNativeWindow.cs @@ -27,7 +27,7 @@ private static BOOL RegisterACWindowRecursive(HWND handle) { if (!s_acWindows.ContainsKey(handle)) { - ACNativeWindow newAC = new(handle); + _ = new ACNativeWindow(handle); } return true; @@ -89,7 +89,7 @@ internal static void RegisterACWindow(HWND acHandle, bool subclass) { if (subclass) { - ACNativeWindow newAC = new(acHandle); + new ACNativeWindow(acHandle); } else { diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ComboBox/ComboBox.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ComboBox/ComboBox.cs index 2ba076ddf47..d078054db08 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ComboBox/ComboBox.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ComboBox/ComboBox.cs @@ -808,7 +808,8 @@ public int PreferredHeight // of the combo box, we need to use the same calculation they do. private int GetComboHeight() { - int cyCombo = 0; + int cyCombo; + // Add on CYEDGE just for some extra space in the edit field/static item. // It's really only for static text items, but we want static & editable // controls to be the same height. diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridView.Methods.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridView.Methods.cs index 74efce3f78d..fe2233e5ac3 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridView.Methods.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridView.Methods.cs @@ -1390,7 +1390,7 @@ public bool AreAllCellsSelected(bool includeInvisibleCells) return true; } - DataGridViewRow? dataGridViewRow = null; + DataGridViewRow? dataGridViewRow; bool allCellsSelected; switch (SelectionMode) { @@ -4566,7 +4566,7 @@ private void ComputeLayoutShortcut(bool computeVisibleRows) private void ComputeVisibleColumns() { - DataGridViewColumn? dataGridViewColumn = null; + DataGridViewColumn? dataGridViewColumn; int numVisibleScrollingCols = 0, visibleScrollingColumnsTmp = 0; int displayWidth = _layout.Data.Width, cx = 0; int numDisplayedFrozenCols = 0, firstDisplayedFrozenCol = -1, lastDisplayedFrozenCol = -1; @@ -7140,13 +7140,14 @@ internal DataGridViewCell GetCellInternal(int columnIndex, int rowIndex) ]; DataObject dataObject = new(); - bool includeColumnHeaders = false, includeRowHeaders = false; - string? cellContent = null; + bool includeColumnHeaders; + bool includeRowHeaders; StringBuilder? sbContent = null; DataGridViewColumn? dataGridViewColumn; DataGridViewColumn? prevDataGridViewColumn; DataGridViewColumn? nextDataGridViewColumn; + string? cellContent; switch (SelectionMode) { case DataGridViewSelectionMode.FullRowSelect: diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewBand.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewBand.cs index 0d593a98f73..cdc110224e1 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewBand.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewBand.cs @@ -348,7 +348,7 @@ internal int MinimumThickness { if (IsRow && Index > -1) { - GetHeightInfo(Index, out int height, out int minimumHeight); + GetHeightInfo(Index, out _, out int minimumHeight); return minimumHeight; } @@ -609,7 +609,7 @@ internal int Thickness { if (IsRow && Index > -1) { - GetHeightInfo(Index, out int height, out int minimumHeight); + GetHeightInfo(Index, out int height, out _); return height; } @@ -649,7 +649,7 @@ not DataGridViewAutoSizeColumnMode.None and { if (dataGridViewColumn.Visible) { - IntPtr handle = DataGridView.Handle; + _ = DataGridView.Handle; DataGridView.AdjustFillingColumn(dataGridViewColumn, value); setThickness = false; } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewCellStyle.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewCellStyle.cs index 1e611f18d29..01998573699 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewCellStyle.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewCellStyle.cs @@ -659,7 +659,6 @@ public override string ToString() } sb.Append($" Tag={Tag}"); - firstPropAdded = false; } sb.Append(" }"); diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewCheckBoxCell.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewCheckBoxCell.cs index e29f6989649..cee95b9b3d1 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewCheckBoxCell.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewCheckBoxCell.cs @@ -728,8 +728,9 @@ protected override Size GetPreferredSize( ComputeBorderStyleCellStateAndCellBounds( rowIndex, out DataGridViewAdvancedBorderStyle dgvabsEffective, - out DataGridViewElementStates cellState, - out Rectangle cellBounds); + out _, + out _); + Rectangle borderWidths = BorderWidths(dgvabsEffective); preferredSize.Width += borderWidths.X; preferredSize.Height += borderWidths.Y; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewComboBoxCell.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewComboBoxCell.cs index 8fee75afc2d..07c70ff0a5a 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewComboBoxCell.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewComboBoxCell.cs @@ -1172,7 +1172,6 @@ protected override Size GetPreferredSize( ArgumentNullException.ThrowIfNull(cellStyle); - Size preferredSize = Size.Empty; DataGridViewFreeDimension freeDimension = GetFreeDimensionFromConstraint(constraintSize); Rectangle borderWidthsRect = StdBorderWidths; int borderAndPaddingWidths = borderWidthsRect.Left + borderWidthsRect.Width + cellStyle.Padding.Horizontal; @@ -1180,14 +1179,9 @@ protected override Size GetPreferredSize( TextFormatFlags flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode); string? formattedValue = GetFormattedValue(rowIndex, ref cellStyle, DataGridViewDataErrorContexts.Formatting | DataGridViewDataErrorContexts.PreferredSize) as string; - if (!string.IsNullOrEmpty(formattedValue)) - { - preferredSize = MeasureTextSize(graphics, formattedValue, cellStyle.Font!, flags); - } - else - { - preferredSize = MeasureTextSize(graphics, " ", cellStyle.Font!, flags); - } + + Size preferredSize = + MeasureTextSize(graphics, string.IsNullOrEmpty(formattedValue) ? " " : formattedValue, cellStyle.Font!, flags); if (freeDimension == DataGridViewFreeDimension.Height) { @@ -1200,11 +1194,13 @@ protected override Size GetPreferredSize( if (freeDimension != DataGridViewFreeDimension.Height) { - preferredSize.Width += SystemInformation.HorizontalScrollBarThumbWidth + 1 + 2 * Margin + borderAndPaddingWidths; + preferredSize.Width += SystemInformation.HorizontalScrollBarThumbWidth + 1 + (2 * Margin) + borderAndPaddingWidths; if (DataGridView.ShowCellErrors) { // Making sure that there is enough room for the potential error icon - preferredSize.Width = Math.Max(preferredSize.Width, borderAndPaddingWidths + SystemInformation.HorizontalScrollBarThumbWidth + 1 + IconMarginWidth * 2 + s_iconsWidth); + preferredSize.Width = Math.Max( + preferredSize.Width, + borderAndPaddingWidths + SystemInformation.HorizontalScrollBarThumbWidth + 1 + (IconMarginWidth * 2) + s_iconsWidth); } } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Dialogs/ThreadExceptionDialog.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Dialogs/ThreadExceptionDialog.cs index 6bb84211774..a360704cf96 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Dialogs/ThreadExceptionDialog.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Dialogs/ThreadExceptionDialog.cs @@ -179,7 +179,15 @@ public ThreadExceptionDialog(Exception t) foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) { AssemblyName name = assembly.GetName(); - detailsTextBuilder.AppendFormat(SR.ExDlgMsgLoadedAssembliesEntry, name.Name, name.Version, assembly.Location); +#pragma warning disable IL3000 // Avoid accessing Assembly file path when publishing as a single file + string location = assembly.Location; +#pragma warning restore IL3000 + + detailsTextBuilder.AppendFormat( + SR.ExDlgMsgLoadedAssembliesEntry, + name.Name, + name.Version, + string.IsNullOrEmpty(location) ? AppContext.BaseDirectory : location); detailsTextBuilder.Append(separator); } diff --git a/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/GlobalSuppressions.cs b/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/GlobalSuppressions.cs deleted file mode 100644 index 54988ed8c75..00000000000 --- a/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/GlobalSuppressions.cs +++ /dev/null @@ -1,4 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "VSTHRD200:Use \"Async\" suffix for async methods")] diff --git a/src/System.Windows.Forms/tests/UnitTests/GlobalSuppressions.cs b/src/System.Windows.Forms/tests/UnitTests/GlobalSuppressions.cs deleted file mode 100644 index c53e2f07e87..00000000000 --- a/src/System.Windows.Forms/tests/UnitTests/GlobalSuppressions.cs +++ /dev/null @@ -1,8 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Diagnostics.CodeAnalysis; - -[assembly: SuppressMessage("Style", "IDE0028:Simplify collection initialization", Justification = "Creates ambiguity", Scope = "member", Target = "~M:System.Windows.Forms.Tests.AutoCompleteStringCollectionTests.AutoCompleteStringCollection_IListRemove_String_Success")] -[assembly: SuppressMessage("Style", "IDE0028:Simplify collection initialization", Justification = "Creates ambiguity", Scope = "member", Target = "~M:System.Windows.Forms.Tests.AutoCompleteStringCollectionTests.AutoCompleteStringCollection_IListRemove_InvalidItem_Nop(System.Object)")] -[assembly: SuppressMessage("Style", "IDE0028:Simplify collection initialization", Justification = "", Scope = "member", Target = "~M:System.Windows.Forms.Tests.AutoCompleteStringCollectionTests.AutoCompleteStringCollection_IListGetEnumerator_InvokeNotEmpty_ReturnsExpected")] From 680fcadac30734de1728a1f893ab5d8afe0643ad Mon Sep 17 00:00:00 2001 From: Loni Tra Date: Fri, 22 Nov 2024 11:05:39 -0800 Subject: [PATCH 042/106] Update Templates (#12532) * Add 10.0 template * remove 7.0 templates --- .../localize/templatestrings.cs.json | 4 ++-- .../localize/templatestrings.de.json | 4 ++-- .../localize/templatestrings.en.json | 4 ++-- .../localize/templatestrings.es.json | 4 ++-- .../localize/templatestrings.fr.json | 4 ++-- .../localize/templatestrings.it.json | 4 ++-- .../localize/templatestrings.ja.json | 4 ++-- .../localize/templatestrings.ko.json | 4 ++-- .../localize/templatestrings.pl.json | 4 ++-- .../localize/templatestrings.pt-BR.json | 4 ++-- .../localize/templatestrings.ru.json | 4 ++-- .../localize/templatestrings.tr.json | 4 ++-- .../localize/templatestrings.zh-Hans.json | 4 ++-- .../localize/templatestrings.zh-Hant.json | 4 ++-- .../.template.config/template.json | 22 ++++++++--------- .../localize/templatestrings.cs.json | 4 ++-- .../localize/templatestrings.de.json | 4 ++-- .../localize/templatestrings.en.json | 6 ++--- .../localize/templatestrings.es.json | 4 ++-- .../localize/templatestrings.fr.json | 4 ++-- .../localize/templatestrings.it.json | 4 ++-- .../localize/templatestrings.ja.json | 4 ++-- .../localize/templatestrings.ko.json | 4 ++-- .../localize/templatestrings.pl.json | 4 ++-- .../localize/templatestrings.pt-BR.json | 4 ++-- .../localize/templatestrings.ru.json | 4 ++-- .../localize/templatestrings.tr.json | 4 ++-- .../localize/templatestrings.zh-Hans.json | 4 ++-- .../localize/templatestrings.zh-Hant.json | 4 ++-- .../.template.config/template.json | 18 +++++++------- .../localize/templatestrings.cs.json | 4 ++-- .../localize/templatestrings.de.json | 4 ++-- .../localize/templatestrings.en.json | 6 ++--- .../localize/templatestrings.es.json | 4 ++-- .../localize/templatestrings.fr.json | 4 ++-- .../localize/templatestrings.it.json | 4 ++-- .../localize/templatestrings.ja.json | 4 ++-- .../localize/templatestrings.ko.json | 4 ++-- .../localize/templatestrings.pl.json | 4 ++-- .../localize/templatestrings.pt-BR.json | 4 ++-- .../localize/templatestrings.ru.json | 4 ++-- .../localize/templatestrings.tr.json | 4 ++-- .../localize/templatestrings.zh-Hans.json | 4 ++-- .../localize/templatestrings.zh-Hant.json | 4 ++-- .../.template.config/template.json | 24 +++++++++---------- .../localize/templatestrings.cs.json | 4 ++-- .../localize/templatestrings.de.json | 4 ++-- .../localize/templatestrings.en.json | 6 ++--- .../localize/templatestrings.es.json | 4 ++-- .../localize/templatestrings.fr.json | 4 ++-- .../localize/templatestrings.it.json | 4 ++-- .../localize/templatestrings.ja.json | 4 ++-- .../localize/templatestrings.ko.json | 4 ++-- .../localize/templatestrings.pl.json | 4 ++-- .../localize/templatestrings.pt-BR.json | 4 ++-- .../localize/templatestrings.ru.json | 4 ++-- .../localize/templatestrings.tr.json | 4 ++-- .../localize/templatestrings.zh-Hans.json | 4 ++-- .../localize/templatestrings.zh-Hant.json | 4 ++-- .../.template.config/template.json | 18 +++++++------- .../localize/templatestrings.cs.json | 4 ++-- .../localize/templatestrings.de.json | 4 ++-- .../localize/templatestrings.en.json | 6 ++--- .../localize/templatestrings.es.json | 4 ++-- .../localize/templatestrings.fr.json | 4 ++-- .../localize/templatestrings.it.json | 4 ++-- .../localize/templatestrings.ja.json | 4 ++-- .../localize/templatestrings.ko.json | 4 ++-- .../localize/templatestrings.pl.json | 4 ++-- .../localize/templatestrings.pt-BR.json | 4 ++-- .../localize/templatestrings.ru.json | 4 ++-- .../localize/templatestrings.tr.json | 4 ++-- .../localize/templatestrings.zh-Hans.json | 4 ++-- .../localize/templatestrings.zh-Hant.json | 4 ++-- .../.template.config/template.json | 24 +++++++++---------- .../localize/templatestrings.cs.json | 4 ++-- .../localize/templatestrings.de.json | 4 ++-- .../localize/templatestrings.en.json | 6 ++--- .../localize/templatestrings.es.json | 4 ++-- .../localize/templatestrings.fr.json | 4 ++-- .../localize/templatestrings.it.json | 4 ++-- .../localize/templatestrings.ja.json | 4 ++-- .../localize/templatestrings.ko.json | 4 ++-- .../localize/templatestrings.pl.json | 4 ++-- .../localize/templatestrings.pt-BR.json | 4 ++-- .../localize/templatestrings.ru.json | 4 ++-- .../localize/templatestrings.tr.json | 4 ++-- .../localize/templatestrings.zh-Hans.json | 4 ++-- .../localize/templatestrings.zh-Hant.json | 4 ++-- .../.template.config/template.json | 18 +++++++------- 90 files changed, 235 insertions(+), 235 deletions(-) diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.cs.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.cs.json index 6431ab3a8df..044730cb13b 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.cs.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.cs.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Cílová architektura pro projekt", "symbols/Framework/choices/net6.0/description": "Cílit na net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Cílový net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Target net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "Framework", "symbols/langVersion/description": "Nastaví langVersion ve vytvořeném souboru projektu.", "symbols/langVersion/displayName": "Verze jazyka", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.de.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.de.json index 7c2480a8f8d..1a10b7e5577 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.de.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.de.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Das Zielframework für das Projekt.", "symbols/Framework/choices/net6.0/description": "Auf „net6.0“ abzielen", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Target net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Ziel net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Ziel net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "Framework", "symbols/langVersion/description": "Legt „langVersion“ in der erstellten Projektdatei fest", "symbols/langVersion/displayName": "Sprachversion", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.en.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.en.json index 7fa8a71411d..fa6613da7e8 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.en.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.en.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "The target framework for the project.", "symbols/Framework/choices/net6.0/description": "Target net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Target net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Target net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "Framework", "symbols/langVersion/description": "Sets langVersion in the created project file", "symbols/langVersion/displayName": "Language Version", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.es.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.es.json index 2f874d2126e..f9ad3f888dd 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.es.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.es.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Marco de destino del proyecto.", "symbols/Framework/choices/net6.0/description": "Objetivo net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Objetivo net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Net8.0 de destino", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 de destino", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "Plataforma", "symbols/langVersion/description": "Establece langVersion en el archivo de proyecto creado.", "symbols/langVersion/displayName": "Versión de lenguaje", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.fr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.fr.json index 0516d7b982b..ff47217a3cc 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.fr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.fr.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Framework cible du projet.", "symbols/Framework/choices/net6.0/description": "net6.0 cible", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Cible net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Cible Net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 cible", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "Framework", "symbols/langVersion/description": "Définit langVersion dans le fichier projet créé", "symbols/langVersion/displayName": "Version du Langage", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.it.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.it.json index 3ea63418dc5..0b96754ce1d 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.it.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.it.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Il framework di destinazione per il progetto.", "symbols/Framework/choices/net6.0/description": "Net6.0 di destinazione", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Destinazione net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Destinazione net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 di destinazione", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "Framework", "symbols/langVersion/description": "Imposta langVersion nel file di progetto creato", "symbols/langVersion/displayName": "Versione linguaggio", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ja.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ja.json index 684bb523028..c441683f6f6 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ja.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ja.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "プロジェクトのターゲット フレームワークです。", "symbols/Framework/choices/net6.0/description": "ターゲット net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "ターゲット net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "ターゲット net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "ターゲット net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "フレームワーク", "symbols/langVersion/description": "作成されたプロジェクト ファイルで langVersion を設定します", "symbols/langVersion/displayName": "言語バージョン", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ko.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ko.json index abb149f3f98..09f34aaa47b 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ko.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ko.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "프로젝트에 대한 대상 프레임워크입니다.", "symbols/Framework/choices/net6.0/description": "대상 net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "대상 net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "대상 net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "프레임워크", "symbols/langVersion/description": "만든 프로젝트 파일의 langVersion를 설정합니다", "symbols/langVersion/displayName": "언어 버전", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.pl.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.pl.json index 5b9b5375895..2ef61c2776f 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.pl.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.pl.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Platforma docelowa dla tego projektu.", "symbols/Framework/choices/net6.0/description": "Docelowy net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Docelowe środowisko net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Docelowa platforma NET 8.0", "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Docelowa platforma net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "Platforma", "symbols/langVersion/description": "Ustawia langVersion w utworzonym pliku projektu", "symbols/langVersion/displayName": "Wersja języka", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.pt-BR.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.pt-BR.json index 77440bf1a4a..dc93b5b3bd0 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.pt-BR.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.pt-BR.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "A estrutura de destino do projeto.", "symbols/Framework/choices/net6.0/description": "Net6.0 de destino", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Alvo .NET7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": ".NET 8.0 de destino", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "Framework", "symbols/langVersion/description": "Define a langVersion no arquivo do projeto criado", "symbols/langVersion/displayName": "Versão da Linguagem", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ru.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ru.json index 84ea3e2a030..7d8a11f8579 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ru.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ru.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Целевая платформа для проекта.", "symbols/Framework/choices/net6.0/description": "Целевая платформа: net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Целевая версия net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Целевая net8.0", "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Целевая среда net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "Платформа", "symbols/langVersion/description": "Задает свойство langVersion в созданном файле проекта", "symbols/langVersion/displayName": "Версия языка", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.tr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.tr.json index 8486046ac6c..762ca92c7f3 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.tr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.tr.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Projenin hedef çerçevesi.", "symbols/Framework/choices/net6.0/description": "Hedef net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Hedef net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Hedef net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Hedef net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "Çerçeve", "symbols/langVersion/description": "Oluşturulan proje dosyasında langVersion'ı ayarlar", "symbols/langVersion/displayName": "Dil Sürümü", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.zh-Hans.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.zh-Hans.json index 97253bfdd72..70b910e1967 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.zh-Hans.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.zh-Hans.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "项目的目标框架。", "symbols/Framework/choices/net6.0/description": "目标 net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "目标 net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "目标 net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目标 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "框架", "symbols/langVersion/description": "在创建的项目文件中设置 langVersion", "symbols/langVersion/displayName": "语言版本", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.zh-Hant.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.zh-Hant.json index 3cbd0ad31ae..24261d312d8 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.zh-Hant.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.zh-Hant.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "專案的目標 Framework。", "symbols/Framework/choices/net6.0/description": "目標 net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "目標 net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "目標 net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目標 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "架構", "symbols/langVersion/description": "在建立的專案檔中設定 langVersion", "symbols/langVersion/displayName": "語言版本", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/template.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/template.json index d4e3ad4cd1f..47243cea33d 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/template.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/template.json @@ -6,8 +6,8 @@ "generatorVersions": "[1.0.0.0-*)", "description": "A project template for creating a .NET Windows Forms (WinForms) App.", "groupIdentity": "Microsoft.Common.WinForms", - "precedence": "9000", - "identity": "Microsoft.Common.WinForms.CSharp.9.0", + "precedence": "10000", + "identity": "Microsoft.Common.WinForms.CSharp.10.0", "shortName": "winforms", "tags": { "language": "C#", @@ -34,11 +34,6 @@ "description": "Target net6.0", "displayName": ".NET 6.0" }, - { - "choice": "net7.0", - "description": "Target net7.0", - "displayName": ".NET 7.0" - }, { "choice": "net8.0", "description": "Target net8.0", @@ -48,10 +43,15 @@ "choice": "net9.0", "description": "Target net9.0", "displayName": ".NET 9.0" + }, + { + "choice": "net10.0", + "description": "Target net10.0", + "displayName": ".NET 10.0" } ], "replaces": "FrameworkParameter", - "defaultValue": "net9.0", + "defaultValue": "net10.0", "displayName": "Framework" }, "langVersion": { @@ -95,11 +95,11 @@ }, "csharpFeature_ImplicitUsings": { "type": "computed", - "value": "(Framework == \"net9.0\" || Framework == \"net8.0\" || Framework == \"net7.0\" || Framework == \"net6.0\") && csharp10orLater == \"true\"" + "value": "(Framework == \"net10.0\" || Framework == \"net9.0\" || Framework == \"net8.0\" || Framework == \"net6.0\") && csharp10orLater == \"true\"" }, "csharpFeature_FileScopedNamespaces": { "type": "computed", - "value": "(Framework == \"net9.0\" || Framework == \"net8.0\" || Framework == \"net7.0\" || Framework == \"net6.0\" || langVersion != \"\") && csharp10orLater == \"true\"" + "value": "(Framework == \"net10.0\" || Framework == \"net9.0\" || Framework == \"net8.0\" || Framework == \"net6.0\" || langVersion != \"\") && csharp10orLater == \"true\"" } }, "primaryOutputs": [ @@ -112,7 +112,7 @@ "sources": [ { "exclude": [ "**/[Bb]in/**", "**/[Oo]bj/**", ".template.config/**/*", "**/*.filelist", "**/*.lock.json" ], - "condition": "(Framework == \"net9.0\" || Framework == \"net8.0\" || Framework == \"net7.0\" || Framework == \"net6.0\")", + "condition": "(Framework == \"net10.0\" || Framework == \"net9.0\" || Framework == \"net8.0\" || Framework == \"net6.0\")", "source": "./net6.0", "target": "./" } diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.cs.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.cs.json index b5b4e506e61..1f140f3a323 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.cs.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.cs.json @@ -8,12 +8,12 @@ "symbols/Framework/description": "Cílová architektura pro projekt", "symbols/Framework/choices/net6.0/description": "Cílit na net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Cílový net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Target net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Nastaví langVersion ve vytvořeném souboru projektu.", "symbols/langVersion/displayName": "Verze jazyka", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.de.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.de.json index c55435b0780..04f3735649e 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.de.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.de.json @@ -8,12 +8,12 @@ "symbols/Framework/description": "Das Zielframework für das Projekt.", "symbols/Framework/choices/net6.0/description": "Auf „net6.0“ abzielen", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Target net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Ziel net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Ziel net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Legt „langVersion“ in der erstellten Projektdatei fest", "symbols/langVersion/displayName": "Sprachversion", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.en.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.en.json index 6e4397a8e91..11f484dbe0c 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.en.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.en.json @@ -8,13 +8,13 @@ "symbols/Framework/description": "The target framework for the project.", "symbols/Framework/choices/net6.0/description": "Target net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Target net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Target net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Sets langVersion in the created project file", "symbols/langVersion/displayName": "Language Version", "symbols/skipRestore/description": "If specified, skips the automatic restore of the project on create.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.es.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.es.json index 0c4b7ecaf0a..cf4529c40f7 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.es.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.es.json @@ -8,12 +8,12 @@ "symbols/Framework/description": "Marco de destino del proyecto.", "symbols/Framework/choices/net6.0/description": "Objetivo net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Objetivo net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Net8.0 de destino", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 de destino", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Establece langVersion en el archivo de proyecto creado.", "symbols/langVersion/displayName": "Versión de lenguaje", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.fr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.fr.json index 828b1e9c26a..d78a6115e18 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.fr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.fr.json @@ -8,12 +8,12 @@ "symbols/Framework/description": "Framework cible du projet.", "symbols/Framework/choices/net6.0/description": "net6.0 cible", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Cible net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Cible Net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 cible", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Définit langVersion dans le fichier projet créé", "symbols/langVersion/displayName": "Version du Langage", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.it.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.it.json index e9b86c664c4..843914325d6 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.it.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.it.json @@ -8,12 +8,12 @@ "symbols/Framework/description": "Il framework di destinazione per il progetto.", "symbols/Framework/choices/net6.0/description": "Net6.0 di destinazione", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Destinazione net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Destinazione net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 di destinazione", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Imposta langVersion nel file di progetto creato", "symbols/langVersion/displayName": "Versione linguaggio", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ja.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ja.json index b646724da8c..b1107380863 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ja.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ja.json @@ -8,12 +8,12 @@ "symbols/Framework/description": "プロジェクトのターゲット フレームワークです。", "symbols/Framework/choices/net6.0/description": "ターゲット net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "ターゲット net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "ターゲット net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "ターゲット net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "作成されたプロジェクト ファイルで langVersion を設定します", "symbols/langVersion/displayName": "言語バージョン", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ko.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ko.json index 6ce5a2e8167..e6f3b5d3417 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ko.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ko.json @@ -8,12 +8,12 @@ "symbols/Framework/description": "프로젝트에 대한 대상 프레임워크입니다.", "symbols/Framework/choices/net6.0/description": "대상 net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "대상 net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "대상 net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "대상 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "만든 프로젝트 파일의 langVersion를 설정합니다", "symbols/langVersion/displayName": "언어 버전", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.pl.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.pl.json index 7b287850ba2..043ac2ab6a5 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.pl.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.pl.json @@ -8,12 +8,12 @@ "symbols/Framework/description": "Platforma docelowa dla tego projektu.", "symbols/Framework/choices/net6.0/description": "Docelowy net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Docelowe środowisko net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Docelowa platforma NET 8.0", "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Docelowa platforma net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Ustawia langVersion w utworzonym pliku projektu", "symbols/langVersion/displayName": "Wersja języka", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.pt-BR.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.pt-BR.json index af9d3078a7a..bea421370bc 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.pt-BR.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.pt-BR.json @@ -8,12 +8,12 @@ "symbols/Framework/description": "A estrutura de destino do projeto.", "symbols/Framework/choices/net6.0/description": "Net6.0 de destino", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Alvo .NET7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": ".NET 8.0 de destino", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Define a langVersion no arquivo do projeto criado", "symbols/langVersion/displayName": "Versão da Linguagem", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ru.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ru.json index 3f38e6f52de..9d9b7b165da 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ru.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ru.json @@ -8,12 +8,12 @@ "symbols/Framework/description": "Целевая платформа для проекта.", "symbols/Framework/choices/net6.0/description": "Целевая платформа: net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Целевая версия net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Целевая net8.0", "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Целевая среда net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Задает свойство langVersion в созданном файле проекта", "symbols/langVersion/displayName": "Версия языка", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.tr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.tr.json index 3b562046b7c..12fa834440a 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.tr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.tr.json @@ -8,12 +8,12 @@ "symbols/Framework/description": "Projenin hedef çerçevesi.", "symbols/Framework/choices/net6.0/description": "Hedef net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Hedef net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Hedef net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Hedef net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Oluşturulan proje dosyasında langVersion'ı ayarlar", "symbols/langVersion/displayName": "Dil Sürümü", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json index 021ad8633dd..5375f589a48 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json @@ -8,12 +8,12 @@ "symbols/Framework/description": "项目的目标框架。", "symbols/Framework/choices/net6.0/description": "目标 net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "目标 net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "目标 net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目标 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "在创建的项目文件中设置 langVersion", "symbols/langVersion/displayName": "语言版本", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json index dcccca650a5..0a87d2f1d6d 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json @@ -8,12 +8,12 @@ "symbols/Framework/description": "專案的目標 Framework。", "symbols/Framework/choices/net6.0/description": "目標 net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "目標 net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "目標 net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目標 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "在建立的專案檔中設定 langVersion", "symbols/langVersion/displayName": "語言版本", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/template.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/template.json index 74f2ec67d76..3839dd2dbcb 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/template.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/template.json @@ -6,8 +6,8 @@ "generatorVersions": "[1.0.0.0-*)", "description": "A project template for creating a .NET Windows Forms (WinForms) App.", "groupIdentity": "Microsoft.Common.WinForms", - "precedence": "9000", - "identity": "Microsoft.Common.WinForms.VisualBasic.9.0", + "precedence": "10000", + "identity": "Microsoft.Common.WinForms.VisualBasic.10.0", "shortName": "winforms", "tags": { "language": "VB", @@ -40,11 +40,6 @@ "description": "Target net6.0", "displayName": ".NET 6.0" }, - { - "choice": "net7.0", - "description": "Target net7.0", - "displayName": ".NET 7.0" - }, { "choice": "net8.0", "description": "Target net8.0", @@ -54,11 +49,16 @@ "choice": "net9.0", "description": "Target net9.0", "displayName": ".NET 9.0" + }, + { + "choice": "net10.0", + "description": "Target net10.0", + "displayName": ".NET 10.0" } ], "replaces": "FrameworkParameter", - "defaultValue": "net9.0", - "displayName": ".NET 9.0" + "defaultValue": "net10.0", + "displayName": ".NET 10.0" }, "UseWindowsDesktopSdk": { "type": "computed", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.cs.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.cs.json index 4f815ca37df..e416a7c87f6 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.cs.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.cs.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Cílová architektura pro projekt", "symbols/Framework/choices/net6.0/description": "Cílit na net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Cílový net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Target net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Nastaví langVersion ve vytvořeném souboru projektu.", "symbols/langVersion/displayName": "Verze jazyka", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.de.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.de.json index f41dd603bd1..d495109b6f0 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.de.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.de.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Das Zielframework für das Projekt.", "symbols/Framework/choices/net6.0/description": "Auf „net6.0“ abzielen", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Target net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Ziel net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Ziel net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Legt „langVersion“ in der erstellten Projektdatei fest", "symbols/langVersion/displayName": "Sprachversion", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.en.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.en.json index 5197f39b2ba..fe48efded0c 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.en.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.en.json @@ -7,13 +7,13 @@ "symbols/Framework/description": "The target framework for the project.", "symbols/Framework/choices/net6.0/description": "Target net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Target net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Target net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Sets langVersion in the created project file", "symbols/langVersion/displayName": "Language Version", "symbols/skipRestore/description": "If specified, skips the automatic restore of the project on create.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.es.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.es.json index 069c7d64a50..cb2e95aad7d 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.es.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.es.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Marco de destino del proyecto.", "symbols/Framework/choices/net6.0/description": "Objetivo net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Objetivo net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Net8.0 de destino", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 de destino", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Establece langVersion en el archivo de proyecto creado.", "symbols/langVersion/displayName": "Versión de lenguaje", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.fr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.fr.json index 9d80a79b2ce..28df94cf08a 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.fr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.fr.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Framework cible du projet.", "symbols/Framework/choices/net6.0/description": "net6.0 cible", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Cible net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Cible Net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 cible", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Définit langVersion dans le fichier projet créé", "symbols/langVersion/displayName": "Version du Langage", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.it.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.it.json index 507bba8a02e..b41072959dc 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.it.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.it.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Il framework di destinazione per il progetto.", "symbols/Framework/choices/net6.0/description": "Net6.0 di destinazione", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Destinazione net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Destinazione net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 di destinazione", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Imposta langVersion nel file di progetto creato", "symbols/langVersion/displayName": "Versione linguaggio", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ja.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ja.json index 174c332eb23..c2fc5096d3b 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ja.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ja.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "プロジェクトのターゲット フレームワークです。", "symbols/Framework/choices/net6.0/description": "ターゲット net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "ターゲット net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "ターゲット net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "ターゲット net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "作成されたプロジェクト ファイルで langVersion を設定します", "symbols/langVersion/displayName": "言語バージョン", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ko.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ko.json index 08b4751cf93..c20a10867ad 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ko.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ko.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "프로젝트에 대한 대상 프레임워크입니다.", "symbols/Framework/choices/net6.0/description": "대상 net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "대상 net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "대상 net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "만든 프로젝트 파일의 langVersion를 설정합니다", "symbols/langVersion/displayName": "언어 버전", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.pl.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.pl.json index 091d4b38836..753b29a8fe9 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.pl.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.pl.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Platforma docelowa dla tego projektu.", "symbols/Framework/choices/net6.0/description": "Docelowy net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Docelowe środowisko net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Docelowa platforma NET 8.0", "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Docelowa platforma net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Ustawia langVersion w utworzonym pliku projektu", "symbols/langVersion/displayName": "Wersja języka", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.pt-BR.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.pt-BR.json index 850420f6043..6522693f762 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.pt-BR.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.pt-BR.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "A estrutura de destino do projeto.", "symbols/Framework/choices/net6.0/description": "Net6.0 de destino", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Alvo .NET7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": ".NET 8.0 de destino", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Define a langVersion no arquivo do projeto criado", "symbols/langVersion/displayName": "Versão da Linguagem", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ru.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ru.json index 28d4ce36a0e..bb10305737f 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ru.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ru.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Целевая платформа для проекта.", "symbols/Framework/choices/net6.0/description": "Целевая платформа: net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Целевая версия net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Целевая net8.0", "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Целевая среда net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Задает свойство langVersion в созданном файле проекта", "symbols/langVersion/displayName": "Версия языка", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.tr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.tr.json index 45ecfc78bdd..60b79a5440f 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.tr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.tr.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Projenin hedef çerçevesi.", "symbols/Framework/choices/net6.0/description": "Hedef net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Hedef net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Hedef net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Hedef net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Oluşturulan proje dosyasında langVersion'ı ayarlar", "symbols/langVersion/displayName": "Dil Sürümü", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.zh-Hans.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.zh-Hans.json index 317f95537df..0542a7f1c55 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.zh-Hans.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.zh-Hans.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "项目的目标框架。", "symbols/Framework/choices/net6.0/description": "目标 net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "目标 net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "目标 net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目标 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "在创建的项目文件中设置 langVersion", "symbols/langVersion/displayName": "语言版本", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.zh-Hant.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.zh-Hant.json index 7e8484b1671..c182d9d4bd9 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.zh-Hant.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.zh-Hant.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "專案的目標 Framework。", "symbols/Framework/choices/net6.0/description": "目標 net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "目標 net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "目標 net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目標 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "在建立的專案檔中設定 langVersion", "symbols/langVersion/displayName": "語言版本", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/template.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/template.json index 766625f14cb..67d31d48656 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/template.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/template.json @@ -6,8 +6,8 @@ "generatorVersions": "[1.0.0.0-*)", "description": "A project template for creating a control library that targets .NET Windows Forms (WinForms).", "groupIdentity": "Microsoft.Common.WinForms.ControlLibrary", - "precedence": "9000", - "identity": "Microsoft.Common.WinForms.ControlLibrary.CSharp.9.0", + "precedence": "10000", + "identity": "Microsoft.Common.WinForms.ControlLibrary.CSharp.10.0", "shortName": "winformscontrollib", "tags": { "language": "C#", @@ -34,11 +34,6 @@ "description": "Target net6.0", "displayName": ".NET 6.0" }, - { - "choice": "net7.0", - "description": "Target net7.0", - "displayName": ".NET 7.0" - }, { "choice": "net8.0", "description": "Target net8.0", @@ -48,11 +43,16 @@ "choice": "net9.0", "description": "Target net9.0", "displayName": ".NET 9.0" + }, + { + "choice": "net10.0", + "description": "Target net10.0", + "displayName": ".NET 10.0" } ], "replaces": "FrameworkParameter", - "defaultValue": "net9.0", - "displayName": ".NET 9.0" + "defaultValue": "net10.0", + "displayName": ".NET 10.0" }, "langVersion": { "type": "parameter", @@ -95,11 +95,11 @@ }, "csharpFeature_ImplicitUsings": { "type": "computed", - "value": "(Framework == \"net9.0\" || Framework == \"net8.0\" || Framework == \"net7.0\" || Framework == \"net6.0\") && csharp10orLater == \"true\"" + "value": "(Framework == \"net10.0\" || Framework == \"net9.0\" || Framework == \"net8.0\" || Framework == \"net6.0\") && csharp10orLater == \"true\"" }, "csharpFeature_FileScopedNamespaces": { "type": "computed", - "value": "(Framework == \"net9.0\" || Framework == \"net8.0\" || Framework == \"net7.0\" || Framework == \"net6.0\" || langVersion != \"\") && csharp10orLater == \"true\"" + "value": "(Framework == \"net10.0\" || Framework == \"net9.0\" || Framework == \"net8.0\" || Framework == \"net6.0\" || langVersion != \"\") && csharp10orLater == \"true\"" } }, "primaryOutputs": [ @@ -112,7 +112,7 @@ "sources": [ { "exclude": [ "**/[Bb]in/**", "**/[Oo]bj/**", ".template.config/**/*", "**/*.filelist", "**/*.lock.json" ], - "condition": "(Framework == \"net9.0\" || Framework == \"net8.0\" || Framework == \"net7.0\" || Framework == \"net6.0\")", + "condition": "(Framework == \"net10.0\" || Framework == \"net9.0\" || Framework == \"net8.0\" || Framework == \"net6.0\")", "source": "./net6.0", "target": "./" } diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.cs.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.cs.json index 30c93ef8e73..f97e4192151 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.cs.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.cs.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Cílová architektura pro projekt", "symbols/Framework/choices/net6.0/description": "Cílit na net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Cílový net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Target net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Nastaví langVersion ve vytvořeném souboru projektu.", "symbols/langVersion/displayName": "Verze jazyka", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.de.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.de.json index 0cf903d2f22..805c4655ba6 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.de.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.de.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Das Zielframework für das Projekt.", "symbols/Framework/choices/net6.0/description": "Auf „net6.0“ abzielen", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Target net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Ziel net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Ziel net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Legt „langVersion“ in der erstellten Projektdatei fest", "symbols/langVersion/displayName": "Sprachversion", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.en.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.en.json index cba16939477..8809204ab55 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.en.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.en.json @@ -7,13 +7,13 @@ "symbols/Framework/description": "The target framework for the project.", "symbols/Framework/choices/net6.0/description": "Target net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Target net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Target net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Sets langVersion in the created project file", "symbols/langVersion/displayName": "Language Version", "symbols/skipRestore/description": "If specified, skips the automatic restore of the project on create.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.es.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.es.json index c373d3e595c..c73e4d1e9d4 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.es.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.es.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Marco de destino del proyecto.", "symbols/Framework/choices/net6.0/description": "Objetivo net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Objetivo net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Net8.0 de destino", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 de destino", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Establece langVersion en el archivo de proyecto creado.", "symbols/langVersion/displayName": "Versión de lenguaje", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.fr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.fr.json index 5b5a38b6909..481c575c558 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.fr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.fr.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Framework cible du projet.", "symbols/Framework/choices/net6.0/description": "net6.0 cible", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Cible net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Cible Net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 cible", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Définit langVersion dans le fichier projet créé", "symbols/langVersion/displayName": "Version du Langage", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.it.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.it.json index 9cc531c1deb..87d3565bbe3 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.it.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.it.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Il framework di destinazione per il progetto.", "symbols/Framework/choices/net6.0/description": "Net6.0 di destinazione", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Destinazione net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Destinazione net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 di destinazione", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Imposta langVersion nel file di progetto creato", "symbols/langVersion/displayName": "Versione linguaggio", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ja.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ja.json index ca837ea467b..732dfa35aef 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ja.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ja.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "プロジェクトのターゲット フレームワークです。", "symbols/Framework/choices/net6.0/description": "ターゲット net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "ターゲット net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "ターゲット net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "ターゲット net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "作成されたプロジェクト ファイルで langVersion を設定します", "symbols/langVersion/displayName": "言語バージョン", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ko.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ko.json index 449eb0c25ab..e0c9bcab908 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ko.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ko.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "프로젝트에 대한 대상 프레임워크입니다.", "symbols/Framework/choices/net6.0/description": "대상 net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "대상 net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "대상 net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "대상 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "만든 프로젝트 파일의 langVersion를 설정합니다", "symbols/langVersion/displayName": "언어 버전", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.pl.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.pl.json index 136f6f971d1..80a990b5582 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.pl.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.pl.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Platforma docelowa dla tego projektu.", "symbols/Framework/choices/net6.0/description": "Docelowy net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Docelowe środowisko net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Docelowa platforma NET 8.0", "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Docelowa platforma net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Ustawia langVersion w utworzonym pliku projektu", "symbols/langVersion/displayName": "Wersja języka", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.pt-BR.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.pt-BR.json index 2a4cf62f7a2..622e9ff6f8d 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.pt-BR.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.pt-BR.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "A estrutura de destino do projeto.", "symbols/Framework/choices/net6.0/description": "Net6.0 de destino", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Alvo .NET7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": ".NET 8.0 de destino", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Define a langVersion no arquivo do projeto criado", "symbols/langVersion/displayName": "Versão da Linguagem", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ru.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ru.json index af1cae49344..c39735dee98 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ru.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ru.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Целевая платформа для проекта.", "symbols/Framework/choices/net6.0/description": "Целевая платформа: net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Целевая версия net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Целевая net8.0", "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Целевая среда net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Задает свойство langVersion в созданном файле проекта", "symbols/langVersion/displayName": "Версия языка", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.tr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.tr.json index a5205354487..21dc672fd5b 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.tr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.tr.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Projenin hedef çerçevesi.", "symbols/Framework/choices/net6.0/description": "Hedef net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Hedef net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Hedef net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Hedef net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Oluşturulan proje dosyasında langVersion'ı ayarlar", "symbols/langVersion/displayName": "Dil Sürümü", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json index 490d0ef546d..c4129527166 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "项目的目标框架。", "symbols/Framework/choices/net6.0/description": "目标 net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "目标 net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "目标 net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目标 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "在创建的项目文件中设置 langVersion", "symbols/langVersion/displayName": "语言版本", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json index 0696e3b09d0..8945552e94f 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "專案的目標 Framework。", "symbols/Framework/choices/net6.0/description": "目標 net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "目標 net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "目標 net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目標 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "在建立的專案檔中設定 langVersion", "symbols/langVersion/displayName": "語言版本", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/template.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/template.json index f4f236df9ec..7fa311d6a5e 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/template.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/template.json @@ -6,8 +6,8 @@ "generatorVersions": "[1.0.0.0-*)", "description": "A project template for creating a control library that targets .NET Windows Forms (WinForms).", "groupIdentity": "Microsoft.Common.WinForms.ControlLibrary", - "precedence": "9000", - "identity": "Microsoft.Common.WinForms.ControlLibrary.VisualBasic.9.0", + "precedence": "10000", + "identity": "Microsoft.Common.WinForms.ControlLibrary.VisualBasic.10.0", "shortName": "winformscontrollib", "tags": { "language": "VB", @@ -34,11 +34,6 @@ "description": "Target net6.0", "displayName": ".NET 6.0" }, - { - "choice": "net7.0", - "description": "Target net7.0", - "displayName": ".NET 7.0" - }, { "choice": "net8.0", "description": "Target net8.0", @@ -48,11 +43,16 @@ "choice": "net9.0", "description": "Target net9.0", "displayName": ".NET 9.0" + }, + { + "choice": "net10.0", + "description": "Target net10.0", + "displayName": ".NET 10.0" } ], "replaces": "FrameworkParameter", - "defaultValue": "net9.0", - "displayName": ".NET 9.0" + "defaultValue": "net10.0", + "displayName": ".NET 10.0" }, "UseWindowsDesktopSdk": { "type": "computed", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.cs.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.cs.json index b4bed9cdbcf..d468697d3a6 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.cs.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.cs.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Cílová architektura pro projekt", "symbols/Framework/choices/net6.0/description": "Cílit na net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Cílový net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Target net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Nastaví langVersion ve vytvořeném souboru projektu.", "symbols/langVersion/displayName": "Verze jazyka", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.de.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.de.json index c49b85cb450..158a2103d94 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.de.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.de.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Das Zielframework für das Projekt.", "symbols/Framework/choices/net6.0/description": "Auf „net6.0“ abzielen", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Target net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Ziel net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Ziel net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Legt „langVersion“ in der erstellten Projektdatei fest", "symbols/langVersion/displayName": "Sprachversion", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.en.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.en.json index 08920f15452..6faed73616b 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.en.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.en.json @@ -7,13 +7,13 @@ "symbols/Framework/description": "The target framework for the project.", "symbols/Framework/choices/net6.0/description": "Target net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Target net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Target net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Sets langVersion in the created project file", "symbols/langVersion/displayName": "Language Version", "symbols/skipRestore/description": "If specified, skips the automatic restore of the project on create.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.es.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.es.json index 58a163b1c70..901ec6a1821 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.es.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.es.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Marco de destino del proyecto.", "symbols/Framework/choices/net6.0/description": "Objetivo net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Objetivo net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Net8.0 de destino", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 de destino", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Establece langVersion en el archivo de proyecto creado.", "symbols/langVersion/displayName": "Versión de lenguaje", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.fr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.fr.json index 3600f1af51b..162c2d7bdf4 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.fr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.fr.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Framework cible du projet.", "symbols/Framework/choices/net6.0/description": "net6.0 cible", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Cible net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Cible Net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 cible", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Définit langVersion dans le fichier projet créé", "symbols/langVersion/displayName": "Version du Langage", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.it.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.it.json index 7dc50d76167..876523e2d06 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.it.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.it.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Il framework di destinazione per il progetto.", "symbols/Framework/choices/net6.0/description": "Net6.0 di destinazione", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Destinazione net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Destinazione net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 di destinazione", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Imposta langVersion nel file di progetto creato", "symbols/langVersion/displayName": "Versione linguaggio", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ja.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ja.json index 8b1df61314e..a754950edc8 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ja.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ja.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "プロジェクトのターゲット フレームワークです。", "symbols/Framework/choices/net6.0/description": "ターゲット net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "ターゲット net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "ターゲット net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "ターゲット net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "作成されたプロジェクト ファイルで langVersion を設定します", "symbols/langVersion/displayName": "言語バージョン", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ko.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ko.json index 40d75ded3c6..179a12388da 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ko.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ko.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "프로젝트에 대한 대상 프레임워크입니다.", "symbols/Framework/choices/net6.0/description": "대상 net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "대상 net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "대상 net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "만든 프로젝트 파일의 langVersion를 설정합니다", "symbols/langVersion/displayName": "언어 버전", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.pl.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.pl.json index 56be7143892..fd873b11bcf 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.pl.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.pl.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Platforma docelowa dla tego projektu.", "symbols/Framework/choices/net6.0/description": "Docelowy net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Docelowe środowisko net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Docelowa platforma NET 8.0", "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Docelowa platforma net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Ustawia langVersion w utworzonym pliku projektu", "symbols/langVersion/displayName": "Wersja języka", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.pt-BR.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.pt-BR.json index 5f6cdea82fa..79b88fa3f2a 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.pt-BR.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.pt-BR.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "A estrutura de destino do projeto.", "symbols/Framework/choices/net6.0/description": "Net6.0 de destino", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Alvo .NET7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": ".NET 8.0 de destino", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Define a langVersion no arquivo do projeto criado", "symbols/langVersion/displayName": "Versão da Linguagem", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ru.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ru.json index cb28f9a978a..8357dfb3f04 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ru.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ru.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Целевая платформа для проекта.", "symbols/Framework/choices/net6.0/description": "Целевая платформа: net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Целевая версия net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Целевая net8.0", "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Целевая среда net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Задает свойство langVersion в созданном файле проекта", "symbols/langVersion/displayName": "Версия языка", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.tr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.tr.json index d44668aa10e..80a5bb9b001 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.tr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.tr.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Projenin hedef çerçevesi.", "symbols/Framework/choices/net6.0/description": "Hedef net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Hedef net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Hedef net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Hedef net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Oluşturulan proje dosyasında langVersion'ı ayarlar", "symbols/langVersion/displayName": "Dil Sürümü", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.zh-Hans.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.zh-Hans.json index 175c89769d0..0835ca6281a 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.zh-Hans.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.zh-Hans.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "项目的目标框架。", "symbols/Framework/choices/net6.0/description": "目标 net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "目标 net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "目标 net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目标 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "在创建的项目文件中设置 langVersion", "symbols/langVersion/displayName": "语言版本", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.zh-Hant.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.zh-Hant.json index 7ea9cf04fc3..9ffa17d0943 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.zh-Hant.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.zh-Hant.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "專案的目標 Framework。", "symbols/Framework/choices/net6.0/description": "目標 net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "目標 net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "目標 net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目標 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "在建立的專案檔中設定 langVersion", "symbols/langVersion/displayName": "語言版本", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/template.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/template.json index 9253f07c827..1e8fda21793 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/template.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/template.json @@ -6,8 +6,8 @@ "generatorVersions": "[1.0.0.0-*)", "description": "A project template for creating a class library that targets .NET Windows Forms (WinForms).", "groupIdentity": "Microsoft.Common.WinForms.Library", - "precedence": "9000", - "identity": "Microsoft.Common.WinForms.Library.CSharp.9.0", + "precedence": "10000", + "identity": "Microsoft.Common.WinForms.Library.CSharp.10.0", "shortName": "winformslib", "tags": { "language": "C#", @@ -34,11 +34,6 @@ "description": "Target net6.0", "displayName": ".NET 6.0" }, - { - "choice": "net7.0", - "description": "Target net7.0", - "displayName": ".NET 7.0" - }, { "choice": "net8.0", "description": "Target net8.0", @@ -48,11 +43,16 @@ "choice": "net9.0", "description": "Target net9.0", "displayName": ".NET 9.0" + }, + { + "choice": "net10.0", + "description": "Target net10.0", + "displayName": ".NET 10.0" } ], "replaces": "FrameworkParameter", - "defaultValue": "net9.0", - "displayName": ".NET 9.0" + "defaultValue": "net10.0", + "displayName": ".NET 10.0" }, "langVersion": { "type": "parameter", @@ -95,11 +95,11 @@ }, "csharpFeature_ImplicitUsings": { "type": "computed", - "value": "(Framework == \"net9.0\" || Framework == \"net8.0\" || Framework == \"net7.0\" || Framework == \"net6.0\") && csharp10orLater == \"true\"" + "value": "(Framework == \"net10.0\" || Framework == \"net9.0\" || Framework == \"net8.0\" || Framework == \"net6.0\") && csharp10orLater == \"true\"" }, "csharpFeature_FileScopedNamespaces": { "type": "computed", - "value": "(Framework == \"net9.0\" || Framework == \"net8.0\" || Framework == \"net7.0\" || Framework == \"net6.0\" || langVersion != \"\") && csharp10orLater == \"true\"" + "value": "(Framework == \"net10.0\" || Framework == \"net9.0\" || Framework == \"net8.0\" || Framework == \"net6.0\" || langVersion != \"\") && csharp10orLater == \"true\"" } }, "primaryOutputs": [ @@ -111,7 +111,7 @@ ], "sources": [ { - "condition": "(Framework == \"net9.0\" || Framework == \"net8.0\" || Framework == \"net7.0\" || Framework == \"net6.0\")", + "condition": "(Framework == \"net10.0\" || Framework == \"net9.0\" || Framework == \"net8.0\" || Framework == \"net6.0\")", "source": "./net6.0", "target": "./" } diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.cs.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.cs.json index 369b968f6df..f5b7a026b8d 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.cs.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.cs.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Cílová architektura pro projekt", "symbols/Framework/choices/net6.0/description": "Cílit na net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Cílový net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Target net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Nastaví langVersion ve vytvořeném souboru projektu.", "symbols/langVersion/displayName": "Verze jazyka", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.de.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.de.json index 2c6f1b5fce1..b0046074833 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.de.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.de.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Das Zielframework für das Projekt.", "symbols/Framework/choices/net6.0/description": "Auf „net6.0“ abzielen", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Target net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Ziel net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Ziel net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Legt „langVersion“ in der erstellten Projektdatei fest", "symbols/langVersion/displayName": "Sprachversion", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.en.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.en.json index bc2bc87023c..9733bb04caf 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.en.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.en.json @@ -7,13 +7,13 @@ "symbols/Framework/description": "The target framework for the project.", "symbols/Framework/choices/net6.0/description": "Target net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Target net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Target net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Sets langVersion in the created project file", "symbols/langVersion/displayName": "Language Version", "symbols/skipRestore/description": "If specified, skips the automatic restore of the project on create.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.es.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.es.json index cbf9636ad26..1e4d982d5ad 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.es.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.es.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Marco de destino del proyecto.", "symbols/Framework/choices/net6.0/description": "Objetivo net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Objetivo net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Net8.0 de destino", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 de destino", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Establece langVersion en el archivo de proyecto creado.", "symbols/langVersion/displayName": "Versión de lenguaje", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.fr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.fr.json index f6b85b5081e..bc124f6a53e 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.fr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.fr.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Framework cible du projet.", "symbols/Framework/choices/net6.0/description": "net6.0 cible", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Cible net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Cible Net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 cible", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Définit langVersion dans le fichier projet créé", "symbols/langVersion/displayName": "Version du Langage", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.it.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.it.json index 1cc51bcd7b5..cb6f76c0b7f 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.it.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.it.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Il framework di destinazione per il progetto.", "symbols/Framework/choices/net6.0/description": "Net6.0 di destinazione", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Destinazione net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Destinazione net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 di destinazione", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Imposta langVersion nel file di progetto creato", "symbols/langVersion/displayName": "Versione linguaggio", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ja.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ja.json index 3094c0f15f2..6f6fb6cadf4 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ja.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ja.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "プロジェクトのターゲット フレームワークです。", "symbols/Framework/choices/net6.0/description": "ターゲット net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "ターゲット net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "ターゲット net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "ターゲット net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "作成されたプロジェクト ファイルで langVersion を設定します", "symbols/langVersion/displayName": "言語バージョン", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ko.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ko.json index 1f9cc8a9758..fe446fb6065 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ko.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ko.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "프로젝트에 대한 대상 프레임워크입니다.", "symbols/Framework/choices/net6.0/description": "대상 net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "대상 net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "대상 net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "대상 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "만든 프로젝트 파일의 langVersion를 설정합니다", "symbols/langVersion/displayName": "언어 버전", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.pl.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.pl.json index 4853eeb371a..92cb533e798 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.pl.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.pl.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Platforma docelowa dla tego projektu.", "symbols/Framework/choices/net6.0/description": "Docelowy net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Docelowe środowisko net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Docelowa platforma NET 8.0", "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Docelowa platforma net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Ustawia langVersion w utworzonym pliku projektu", "symbols/langVersion/displayName": "Wersja języka", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.pt-BR.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.pt-BR.json index 6eb16104050..2f69491e49d 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.pt-BR.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.pt-BR.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "A estrutura de destino do projeto.", "symbols/Framework/choices/net6.0/description": "Net6.0 de destino", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Alvo .NET7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": ".NET 8.0 de destino", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Define a langVersion no arquivo do projeto criado", "symbols/langVersion/displayName": "Versão da Linguagem", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ru.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ru.json index f6d48ece47a..625003ab5a7 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ru.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ru.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Целевая платформа для проекта.", "symbols/Framework/choices/net6.0/description": "Целевая платформа: net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Целевая версия net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Целевая net8.0", "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Целевая среда net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Задает свойство langVersion в созданном файле проекта", "symbols/langVersion/displayName": "Версия языка", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.tr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.tr.json index aafc510c9ed..e3566507e47 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.tr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.tr.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "Projenin hedef çerçevesi.", "symbols/Framework/choices/net6.0/description": "Hedef net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "Hedef net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "Hedef net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Hedef net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "Oluşturulan proje dosyasında langVersion'ı ayarlar", "symbols/langVersion/displayName": "Dil Sürümü", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json index dd13bd1f026..eecf4960a36 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "项目的目标框架。", "symbols/Framework/choices/net6.0/description": "目标 net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "目标 net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "目标 net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目标 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "在创建的项目文件中设置 langVersion", "symbols/langVersion/displayName": "语言版本", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json index a5a808ffe5f..64260319a8b 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json @@ -7,12 +7,12 @@ "symbols/Framework/description": "專案的目標 Framework。", "symbols/Framework/choices/net6.0/description": "目標 net6.0", "symbols/Framework/choices/net6.0/displayName": ".NET 6.0", - "symbols/Framework/choices/net7.0/description": "目標 net7.0", - "symbols/Framework/choices/net7.0/displayName": ".NET 7.0", "symbols/Framework/choices/net8.0/description": "目標 net8.0", "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目標 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": ".NET 9.0", "symbols/langVersion/description": "在建立的專案檔中設定 langVersion", "symbols/langVersion/displayName": "語言版本", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/template.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/template.json index 2f96f75b2ce..d8f450cf6e1 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/template.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/template.json @@ -6,8 +6,8 @@ "generatorVersions": "[1.0.0.0-*)", "description": "A project template for creating a class library that targets .NET Windows Forms (WinForms).", "groupIdentity": "Microsoft.Common.WinForms.Library", - "precedence": "9000", - "identity": "Microsoft.Common.WinForms.Library.VisualBasic.9.0", + "precedence": "10000", + "identity": "Microsoft.Common.WinForms.Library.VisualBasic.10.0", "shortName": "winformslib", "tags": { "language": "VB", @@ -34,11 +34,6 @@ "description": "Target net6.0", "displayName": ".NET 6.0" }, - { - "choice": "net7.0", - "description": "Target net7.0", - "displayName": ".NET 7.0" - }, { "choice": "net8.0", "description": "Target net8.0", @@ -48,11 +43,16 @@ "choice": "net9.0", "description": "Target net9.0", "displayName": ".NET 9.0" + }, + { + "choice": "net10.0", + "description": "Target net10.0", + "displayName": ".NET 10.0" } ], "replaces": "FrameworkParameter", - "defaultValue": "net9.0", - "displayName": ".NET 9.0" + "defaultValue": "net10.0", + "displayName": ".NET 10.0" }, "UseWindowsDesktopSdk": { "type": "computed", From df463417707fb57b0759308a1a5ff99fa3f1557d Mon Sep 17 00:00:00 2001 From: v-zhgl <38325459+Zheng-Li01@users.noreply.github.com> Date: Sat, 23 Nov 2024 04:46:58 +0800 Subject: [PATCH 043/106] Add code coverage for DataGridViewCellStyleConverter (#12462) * Add code coverage for DataGridViewCellStyleConverter * Handle FeedBacks * Handle FeedBacks --- .../DataGridViewCellStyleConverterTests.cs | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewCellStyleConverterTests.cs diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewCellStyleConverterTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewCellStyleConverterTests.cs new file mode 100644 index 00000000000..199298ab72d --- /dev/null +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewCellStyleConverterTests.cs @@ -0,0 +1,48 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using System.ComponentModel.Design.Serialization; +using System.Globalization; + +namespace System.Windows.Forms.Tests; + +public class DataGridViewCellStyleConverterTests +{ + private readonly DataGridViewCellStyleConverter _converter; + private readonly DataGridViewCellStyle _style; + + public DataGridViewCellStyleConverterTests() + { + _converter = new(); + _style = new(); + } + + [WinFormsFact] + public void CanConvertTo_InstanceDescriptor_ReturnsTrue() + { + _converter.CanConvertTo(null, typeof(InstanceDescriptor)).Should().BeTrue(); + } + + [WinFormsFact] + public void CanConvertTo_OtherType_ReturnsFalse() + { + _converter.CanConvertTo(null, typeof(int)).Should().BeFalse(); + } + + [WinFormsFact] + public void ConvertTo_InstanceDescriptor_ReturnsInstanceDescriptor() + { + object? convertTo = _converter.ConvertTo(null, CultureInfo.InvariantCulture, _style, typeof(InstanceDescriptor)); + convertTo.Should().NotBeNull(); + convertTo.Should().BeOfType(); + } + + [WinFormsFact] + public void ConvertTo_UnsupportedType_ThrowsNotSupportedException() + { + Action action = () => _converter.ConvertTo(null, CultureInfo.InvariantCulture, _style, typeof(int)); + action.Should().Throw(); + } +} From a4daa07a13f7e10e09f2003273d539156aed4d0c Mon Sep 17 00:00:00 2001 From: Liv-Goh Date: Fri, 22 Nov 2024 23:01:29 +0000 Subject: [PATCH 044/106] Add unit test for TextBoxBaseDesigner (#12433) * Add unit test for TextBoxBaseDesigner * Update Initialize function and remove blank line * Remove white space, add line before assertion and check default textbox text * update testcase * Removed whitespace --- .../Forms/Design/TextBoxBaseDesignerTests.cs | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/TextBoxBaseDesignerTests.cs diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/TextBoxBaseDesignerTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/TextBoxBaseDesignerTests.cs new file mode 100644 index 00000000000..b5c3a592186 --- /dev/null +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/TextBoxBaseDesignerTests.cs @@ -0,0 +1,93 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using Moq; +using System.ComponentModel.Design; +using System.ComponentModel; +using System.Windows.Forms.Design.Behavior; + +namespace System.Windows.Forms.Design.Tests; + +public class TextBoxBaseDesignerTests : IDisposable +{ + private readonly TextBoxBaseDesigner _designer; + private readonly TextBox _textbox; + + public TextBoxBaseDesignerTests() + { + _designer = new(); + _textbox = new(); + Mock site = new(); + site.Setup(s => s.GetService(typeof(IDesignerHost))).Returns(new Mock().Object); + _textbox.Site = site.Object; + } + + public void Dispose() + { + _designer.Dispose(); + _textbox.Dispose(); + } + + [Fact] + public void Constructor_SetsAutoResizeHandlesToTrue_AND_SelectionRules_ReturnsCorrectRules() + { + _designer.AutoResizeHandles.Should().BeTrue(); + _designer.Initialize(_textbox); + + SelectionRules rules = _designer.SelectionRules; + + rules.Should().NotHaveFlag(SelectionRules.TopSizeable | SelectionRules.BottomSizeable); + } + + [WinFormsTheory] + [InlineData(BorderStyle.None, 0)] + [InlineData(BorderStyle.FixedSingle, 2)] + [InlineData(BorderStyle.Fixed3D, 3)] + public void SnapLines_ReturnsCorrectSnapLines(BorderStyle borderStyle, int expectedBaselineOffset) + { + _textbox.BorderStyle = borderStyle; + _designer.Initialize(_textbox); + + List snapLines = (List)_designer.SnapLines; + + snapLines.Should().NotBeNull(); + + SnapLine? baselineSnapLine = snapLines.Cast().FirstOrDefault(sl => sl.SnapLineType == SnapLineType.Baseline); + + baselineSnapLine.Should().NotBeNull(); + baselineSnapLine!.Priority.Should().Be(SnapLinePriority.Medium); + int expectedBaseline = DesignerUtils.GetTextBaseline(_textbox, Drawing.ContentAlignment.TopLeft) + expectedBaselineOffset; + + baselineSnapLine.Offset.Should().Be(expectedBaseline); + } + + [WinFormsTheory] + [InlineData(false, true, SelectionRules.LeftSizeable | SelectionRules.RightSizeable)] + [InlineData(true, true, SelectionRules.AllSizeable)] + [InlineData(false, false, SelectionRules.AllSizeable)] + public void SelectionRules_ReturnsCorrectRules(bool multiline, bool autoSize, SelectionRules expectedRules) + { + _textbox.Multiline = multiline; + _textbox.AutoSize = autoSize; + _designer.Initialize(_textbox); + + _designer.SelectionRules.Should().HaveFlag(expectedRules); + } + + [Fact] + public void InitializeNewComponent_ClearsTextProperty() + { + _textbox.Text.Should().BeEmpty(); + + _textbox.Text = "Test Text"; + _designer.Initialize(_textbox); + + _textbox.Text.Should().Be("Test Text"); + + _designer.InitializeNewComponent(null); + + _textbox.Text.Should().BeEmpty(); + } +} From cac5a6c98c506e8e115b8d20136f590a8faab0c9 Mon Sep 17 00:00:00 2001 From: Jeremy Kuhne Date: Fri, 22 Nov 2024 17:01:59 -0800 Subject: [PATCH 045/106] Finish enabling unnecessary assignment analyzer (#12534) Now is enabled as a warning again and will fail the command line build. Removes last TODOs from .editorconfig --- .editorconfig | 8 +- .../Forms/VbFileCleanupTestBaseTests.vb | 4 +- .../Drawing/Printing/PrinterSettingsTests.cs | 26 ++--- .../mono/System.Drawing/GraphicsTests.cs | 2 +- .../Design/Serialization/CodeDomSerializer.cs | 70 ++++++------ .../DesignerSerializationManager.cs | 2 +- .../Serialization/EnumCodeDomSerializer.cs | 4 +- .../Serialization/TypeCodeDomSerializer.cs | 2 +- .../src/System/Drawing/Design/ImageEditor.cs | 4 +- .../Behavior/ToolStripPanelSelectionGlyph.cs | 8 +- .../Forms/Design/ControlCodeDomSerializer.cs | 71 +++++++----- .../Windows/Forms/Design/ControlDesigner.cs | 6 +- .../Design/DataGridViewAddColumnDialog.cs | 47 ++++---- .../DataGridViewColumnCollectionDialog.cs | 17 +-- .../Forms/Design/DesignBindingPicker.cs | 1 - .../Windows/Forms/Design/DocumentDesigner.cs | 105 ++++++++---------- .../Forms/Design/ImageListImageEditor.cs | 2 +- .../Forms/Design/ParentControlDesigner.cs | 3 +- .../Forms/Design/PictureBoxDesigner.cs | 6 +- .../Windows/Forms/Design/StyleEditorForm.cs | 35 +++--- .../Forms/Design/TabControlDesigner.cs | 3 +- .../Forms/Design/TableLayoutPanelDesigner.cs | 13 +-- .../Windows/Forms/Design/ToolStripDesigner.cs | 7 +- .../Forms/Design/TreeNodeCollectionEditor.cs | 2 +- .../Design/DesignerHostTests.cs | 1 - .../DesignerSerializationManagerTests.cs | 37 +++--- .../Drawing/Design/BitmapEditorTests.cs | 1 - .../Interop/Oleaut32/VARIANTTests.cs | 5 +- .../Forms/Automation/UiaTextProviderTests.cs | 10 +- .../DataGridView/DataGridView.Methods.cs | 86 ++++++++------ .../DataGridView/DataGridViewComboBoxCell.cs | 2 +- .../DataGridView/DataGridViewIntLinkedList.cs | 2 +- .../Controls/DataGridView/DataGridViewRow.cs | 7 +- .../DataGridViewRowCollection.RowComparer.cs | 2 +- .../DataGridView/DataGridViewRowCollection.cs | 11 +- .../Windows/Forms/Controls/Labels/Label.cs | 2 +- .../LinkLabel.LinkLabelAccessibleObject.cs | 2 +- .../ListView.ColumnHeaderCollection.cs | 6 +- .../Forms/Controls/ListView/ListView.cs | 18 +-- ...opertyGrid.PropertyGridAccessibleObject.cs | 1 - .../PropertyDescriptorGridEntry.cs | 2 +- ...ridView.GridViewListBoxAccessibleObject.cs | 2 +- .../PropertyGridInternal/PropertyGridView.cs | 17 +-- .../Forms/Controls/TextBox/MaskedTextBox.cs | 21 +--- .../Forms/Controls/TextBox/TextBoxBase.cs | 26 ++--- .../Forms/Controls/ToolStrips/ToolStrip.cs | 17 +-- .../Controls/ToolStrips/ToolStripDropDown.cs | 7 +- .../ToolStrips/ToolStripDropDownMenu.cs | 7 +- .../ToolStrips/ToolStripDropTargetManager.cs | 2 +- .../Controls/ToolStrips/ToolStripItem.cs | 18 +-- .../ToolStrips/ToolStripItemCollection.cs | 12 +- .../Controls/ToolStrips/ToolStripManager.cs | 2 +- .../Controls/ToolStrips/ToolStripMenuItem.cs | 2 +- ...lStripPanel.ToolStripPanelRowCollection.cs | 21 +--- .../Controls/ToolStrips/ToolStripPanel.cs | 8 -- .../Controls/ToolStrips/ToolStripPanelCell.cs | 2 +- .../ToolStripSplitStackDragDropHandler.cs | 13 +-- .../ToolStrips/ToolStripSplitStackLayout.cs | 14 +-- .../Forms/Controls/UpDown/DomainUpDown.cs | 16 +-- .../Windows/Forms/DataBinding/Binding.cs | 2 +- .../Forms/DataBinding/BindingSource.cs | 13 ++- .../Forms/DataBinding/ListBindingHelper.cs | 7 +- .../Windows/Forms/Internal/Formatter.cs | 15 +-- .../Windows/Forms/Layout/ArrangedElement.cs | 5 +- .../Windows/Forms/Layout/CommonProperties.cs | 15 +-- .../Layout/Containers/ContainerControl.cs | 2 +- .../Windows/Forms/Layout/DefaultLayout.cs | 2 +- .../System/Windows/Forms/Layout/FlowLayout.cs | 3 +- .../Windows/Forms/Layout/TableLayout.cs | 9 +- ...rol.PrintPreviewControlAccessibleObject.cs | 4 +- .../Forms/Application.ParkingWindowTests.cs | 5 +- .../System/Windows/Forms/AxHostTests.cs | 8 +- .../Windows/Forms/BindingContextTests.cs | 1 - ...ComboBox.ComboBoxChildNativeWindowTests.cs | 1 + .../Forms/DataGridViewCellStyleTests.cs | 3 - .../Forms/DataGridViewHeaderCellTests.cs | 7 +- .../Forms/ListViewSubItemCollectionTests.cs | 1 - .../Windows/Forms/ListViewSubItemTests.cs | 1 - .../Windows/Forms/PropertyManagerTests.cs | 2 - .../Windows/Forms/ScrollableControlTests.cs | 2 +- .../Windows/Forms/ToolTipBufferTests.cs | 1 - .../System/Windows/Forms/WebBrowserTests.cs | 4 +- 82 files changed, 406 insertions(+), 557 deletions(-) diff --git a/.editorconfig b/.editorconfig index 251d904316c..da4aa372085 100644 --- a/.editorconfig +++ b/.editorconfig @@ -264,7 +264,7 @@ dotnet_diagnostic.IDE0057.severity = suggestion dotnet_diagnostic.IDE0058.severity = silent # IDE0059: Unnecessary assignment of a value -dotnet_diagnostic.IDE0059.severity = suggestion # TODO: warning +dotnet_diagnostic.IDE0059.severity = warning # IDE0060: Remove unused parameter dotnet_diagnostic.IDE0060.severity = silent @@ -708,7 +708,7 @@ dotnet_diagnostic.CA1819.severity = none dotnet_diagnostic.CA1820.severity = none # CA1821: Remove empty Finalizers -dotnet_diagnostic.CA1821.severity = none # TODO: warning +dotnet_diagnostic.CA1821.severity = warning # CA1822: Mark members as static dotnet_diagnostic.CA1822.severity = warning @@ -1523,8 +1523,8 @@ dotnet_diagnostic.SA1204.severity = none # SA1205: Partial elements should declare an access modifier dotnet_diagnostic.SA1205.severity = warning -# SA1206: Keyword ordering - TODO Re-enable as warning after https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3527 -dotnet_diagnostic.SA1206.severity = suggestion +# SA1206: Keyword ordering +dotnet_diagnostic.SA1206.severity = warning # SA1207: Protected should come before internal dotnet_diagnostic.SA1207.severity = none diff --git a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/VbFileCleanupTestBaseTests.vb b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/VbFileCleanupTestBaseTests.vb index 1e69b347326..ca3a32a4b36 100644 --- a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/VbFileCleanupTestBaseTests.vb +++ b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/VbFileCleanupTestBaseTests.vb @@ -14,9 +14,9 @@ Namespace Microsoft.VisualBasic.Forms.Tests Public Sub CreateTempDirectoryTest() Dim tempDirectory As String = CreateTempDirectory() tempDirectory.Should.StartWith(Path.GetTempPath) - tempDirectory = CreateTempDirectory() + CreateTempDirectory() _testDirectories.Count.Should.Be(1) - tempDirectory = CreateTempDirectory(lineNumber:=1) + CreateTempDirectory(lineNumber:=1) _testDirectories.Count.Should.Be(2) End Sub diff --git a/src/System.Drawing.Common/tests/System/Drawing/Printing/PrinterSettingsTests.cs b/src/System.Drawing.Common/tests/System/Drawing/Printing/PrinterSettingsTests.cs index 29660da2f69..e93960cfaf1 100644 --- a/src/System.Drawing.Common/tests/System/Drawing/Printing/PrinterSettingsTests.cs +++ b/src/System.Drawing.Common/tests/System/Drawing/Printing/PrinterSettingsTests.cs @@ -43,14 +43,14 @@ public void Ctor_Default_Success() public void CanDuplex_ReturnsExpected() { PrinterSettings printerSettings = new(); - bool canDuplex = printerSettings.CanDuplex; + _ = printerSettings.CanDuplex; } [Fact] public void Copies_Default_ReturnsExpected() { PrinterSettings printerSettings = new(); - int copies = printerSettings.Copies; + _ = printerSettings.Copies; } [Theory] @@ -79,7 +79,7 @@ public void Copies_SetValue_ThrowsArgumentException(short copies) public void Collate_Default_ReturnsExpected() { PrinterSettings printerSettings = new(); - bool collate = printerSettings.Collate; + _ = printerSettings.Collate; } [Fact] @@ -380,7 +380,7 @@ public static IEnumerable IsDirectPrintingSupported_ImageFormatSupport public void IsDirectPrintingSupported_ImageFormatSupported_ReturnsExpected(ImageFormat imageFormat) { PrinterSettings printerSettings = new(); - bool supported = printerSettings.IsDirectPrintingSupported(imageFormat); + _ = printerSettings.IsDirectPrintingSupported(imageFormat); } public static IEnumerable IsDirectPrintingSupported_ImageFormatNotSupported_TestData() @@ -508,10 +508,8 @@ public void CreateMeasurementGraphics_Null_ThrowsNullReferenceException() public void GetHdevmode_ReturnsExpected() { PrinterSettings printerSettings = new(); - IntPtr handle = IntPtr.Zero; - - handle = printerSettings.GetHdevmode(); - Assert.NotEqual(IntPtr.Zero, handle); + nint handle = printerSettings.GetHdevmode(); + Assert.NotEqual(0, handle); } [Fact] @@ -519,10 +517,8 @@ public void GetHdevmode_PageSettings_ReturnsExpected() { PrinterSettings printerSettings = new(); PageSettings pageSettings = new(); - IntPtr handle = IntPtr.Zero; - - handle = printerSettings.GetHdevmode(pageSettings); - Assert.NotEqual(IntPtr.Zero, handle); + nint handle = printerSettings.GetHdevmode(pageSettings); + Assert.NotEqual(0, handle); } [Fact] @@ -536,10 +532,8 @@ public void GetHdevmode_Null_ThrowsNullReferenceException() public void GetHdevnames_ReturnsExpected() { PrinterSettings printerSettings = new(); - IntPtr handle = IntPtr.Zero; - - handle = printerSettings.GetHdevnames(); - Assert.NotEqual(IntPtr.Zero, handle); + nint handle = printerSettings.GetHdevnames(); + Assert.NotEqual(0, handle); } [ConditionalFact(typeof(PrinterSettingsTests), nameof(CanTestSetHdevmode_IntPtr_Success))] diff --git a/src/System.Drawing.Common/tests/mono/System.Drawing/GraphicsTests.cs b/src/System.Drawing.Common/tests/mono/System.Drawing/GraphicsTests.cs index df547abaab7..c1ddee4c0bc 100644 --- a/src/System.Drawing.Common/tests/mono/System.Drawing/GraphicsTests.cs +++ b/src/System.Drawing.Common/tests/mono/System.Drawing/GraphicsTests.cs @@ -83,7 +83,7 @@ private static void CheckForEmptyBitmap(Bitmap bitmap) private static void CheckForNonEmptyBitmap(Bitmap bitmap) { - if (IsEmptyBitmap(bitmap, out int x, out int y)) + if (IsEmptyBitmap(bitmap, out int _, out int _)) Assert.True(false); } diff --git a/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/CodeDomSerializer.cs b/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/CodeDomSerializer.cs index 0f41c451a1d..8e7104e8b29 100644 --- a/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/CodeDomSerializer.cs +++ b/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/CodeDomSerializer.cs @@ -293,49 +293,49 @@ public virtual CodeStatementCollection SerializeMemberAbsolute(IDesignerSerializ [Obsolete("This method has been deprecated. Use SerializeToExpression or GetExpression instead. https://go.microsoft.com/fwlink/?linkid=14202")] protected CodeExpression? SerializeToReferenceExpression(IDesignerSerializationManager manager, object value) { - CodeExpression? expression = null; - // First - try GetExpression - expression = GetExpression(manager, value); + if (GetExpression(manager, value) is { } expression) + { + return expression; + } + + if (value is not IComponent) + { + return null; + } + // Next, we check for a named IComponent, and return a reference to it. - if (expression is null && value is IComponent) + string? name = manager.GetName(value); + bool referenceName = false; + if (name is null) { - string? name = manager.GetName(value); - bool referenceName = false; - if (name is null) + IReferenceService? referenceService = manager.GetService(); + if (referenceService is not null) { - IReferenceService? referenceService = manager.GetService(); - if (referenceService is not null) - { - name = referenceService.GetName(value); - referenceName = name is not null; - } + name = referenceService.GetName(value); + referenceName = name is not null; } + } - if (name is not null) - { - // Check to see if this is a reference to the root component. If it is, then use "this". - if (manager.TryGetContext(out RootContext? root) && root.Value == value) - { - expression = root.Expression; - } - else - { - int dotIndex = name.IndexOf('.'); - if (referenceName && dotIndex != -1) - { - // if it's a reference name with a dot, we've actually got a property here... - expression = new CodePropertyReferenceExpression(new CodeFieldReferenceExpression(s_thisRef, name[..dotIndex]), name[(dotIndex + 1)..]); - } - else - { - expression = new CodeFieldReferenceExpression(s_thisRef, name); - } - } - } + if (name is null) + { + return null; + } + + // Check to see if this is a reference to the root component. If it is, then use "this". + if (manager.TryGetContext(out RootContext? root) && root.Value == value) + { + return root.Expression; } - return expression; + // If it's a reference name with a dot, we've actually got a property. + + int dotIndex = name.IndexOf('.'); + return referenceName && dotIndex != -1 + ? new CodePropertyReferenceExpression( + new CodeFieldReferenceExpression(s_thisRef, name[..dotIndex]), + name[(dotIndex + 1)..]) + : new CodeFieldReferenceExpression(s_thisRef, name); } private static void ResetBrowsableProperties(object? instance) diff --git a/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/DesignerSerializationManager.cs b/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/DesignerSerializationManager.cs index 845cafda7c9..43ccb471320 100644 --- a/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/DesignerSerializationManager.cs +++ b/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/DesignerSerializationManager.cs @@ -485,7 +485,7 @@ public IDisposable CreateSession() // Check for a default serialization provider if (_defaultProviderTable is null || !_defaultProviderTable.Contains(serializerType)) { - Type? defaultSerializerType = null; + Type? defaultSerializerType; DefaultSerializationProviderAttribute? attribute = (DefaultSerializationProviderAttribute?)TypeDescriptor.GetAttributes(serializerType)[typeof(DefaultSerializationProviderAttribute)]; if (attribute is not null) { diff --git a/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/EnumCodeDomSerializer.cs b/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/EnumCodeDomSerializer.cs index 7f249928686..958e36ed35d 100644 --- a/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/EnumCodeDomSerializer.cs +++ b/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/EnumCodeDomSerializer.cs @@ -30,13 +30,13 @@ public override object Serialize(IDesignerSerializationManager manager, object? return null!; } - bool needCast = false; + bool needCast; Enum[] values; TypeConverter? converter = TypeDescriptor.GetConverter(enumValue); if (converter is not null && converter.CanConvertTo(typeof(Enum[]))) { values = (Enum[])converter.ConvertTo(enumValue, typeof(Enum[]))!; - needCast = (values.Length > 1); + needCast = values.Length > 1; } else { diff --git a/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/TypeCodeDomSerializer.cs b/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/TypeCodeDomSerializer.cs index baa3d009ef5..ecff01f7b51 100644 --- a/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/TypeCodeDomSerializer.cs +++ b/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/TypeCodeDomSerializer.cs @@ -214,7 +214,7 @@ public virtual object Deserialize(IDesignerSerializationManager manager, CodeTyp /// private object? DeserializeName(IDesignerSerializationManager manager, string name, CodeStatementCollection? statements) { - object? value = null; + object? value; // If the name we're looking for isn't in our dictionary, we return null. // It is up to the caller to decide if this is an error or not. diff --git a/src/System.Windows.Forms.Design/src/System/Drawing/Design/ImageEditor.cs b/src/System.Windows.Forms.Design/src/System/Drawing/Design/ImageEditor.cs index 0076eb366db..43e59295904 100644 --- a/src/System.Windows.Forms.Design/src/System/Drawing/Design/ImageEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Drawing/Design/ImageEditor.cs @@ -62,7 +62,7 @@ protected static string CreateFilterEntry(ImageEditor e) public override object? EditValue(ITypeDescriptorContext? context, IServiceProvider provider, object? value) { - if (!provider.TryGetService(out IWindowsFormsEditorService? editorService)) + if (!provider.TryGetService(out IWindowsFormsEditorService? _)) { return value; } @@ -86,6 +86,7 @@ protected static string CreateFilterEntry(ImageEditor e) binder: null, args: null, culture: null); + if (editor is not null && editor.GetType() is Type editorClass && !myClass.Equals(editorClass) @@ -118,7 +119,6 @@ protected static string CreateFilterEntry(ImageEditor e) return value; } - /// public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext? context) => UITypeEditorEditStyle.Modal; protected virtual string GetFileDialogDescription() => SR.imageFileDescription; diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/ToolStripPanelSelectionGlyph.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/ToolStripPanelSelectionGlyph.cs index 7f9400e9174..0225ea3e4d0 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/ToolStripPanelSelectionGlyph.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/ToolStripPanelSelectionGlyph.cs @@ -98,8 +98,8 @@ private void SetBitmap(string fileName) private void CollapseGlyph(Rectangle bounds) { DockStyle? dock = _relatedPanel?.Dock; - int x = 0; - int y = 0; + int x; + int y; switch (dock) { @@ -147,8 +147,8 @@ private void CollapseGlyph(Rectangle bounds) private void ExpandGlyph(Rectangle bounds) { DockStyle? dock = _relatedPanel?.Dock; - int x = 0; - int y = 0; + int x; + int y; switch (dock) { diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ControlCodeDomSerializer.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ControlCodeDomSerializer.cs index fe799ab40d9..390a928e022 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ControlCodeDomSerializer.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ControlCodeDomSerializer.cs @@ -334,45 +334,58 @@ private static Type[] ToTargetTypes(object context, Type[] runtimeTypes) /// /// Serializes a method invocation on the control being serialized. Used to serialize Suspend/ResumeLayout pairs, etc. /// - private void SerializeMethodInvocation(IDesignerSerializationManager manager, CodeStatementCollection statements, object control, string methodName, CodeExpressionCollection? parameters, Type[] paramTypes, StatementOrdering ordering) + private void SerializeMethodInvocation( + IDesignerSerializationManager manager, + CodeStatementCollection statements, + object control, + string methodName, + CodeExpressionCollection? parameters, + Type[] paramTypes, + StatementOrdering ordering) { - string? name = manager.GetName(control); + // Not doing anything with the name, keeping the access for compat. + _ = manager.GetName(control); // Use IReflect to see if this method name exists on the control. paramTypes = ToTargetTypes(control, paramTypes); - MethodInfo? mi = TypeDescriptor.GetReflectionType(control).GetMethod(methodName, BindingFlags.Public | BindingFlags.Instance, binder: null, paramTypes, modifiers: null); - - if (mi is not null) + if (TypeDescriptor.GetReflectionType(control).GetMethod( + methodName, + BindingFlags.Public | BindingFlags.Instance, + binder: null, + paramTypes, + modifiers: null) is null) { - CodeExpression? field = SerializeToExpression(manager, control); - CodeMethodReferenceExpression method = new(field, methodName); - CodeMethodInvokeExpression methodInvoke = new() - { - Method = method - }; + return; + } - if (parameters is not null) - { - methodInvoke.Parameters.AddRange(parameters); - } + CodeExpression? field = SerializeToExpression(manager, control); + CodeMethodReferenceExpression method = new(field, methodName); + CodeMethodInvokeExpression methodInvoke = new() + { + Method = method + }; - CodeExpressionStatement statement = new(methodInvoke); + if (parameters is not null) + { + methodInvoke.Parameters.AddRange(parameters); + } - switch (ordering) - { - case StatementOrdering.Prepend: - statement.UserData["statement-ordering"] = "begin"; - break; - case StatementOrdering.Append: - statement.UserData["statement-ordering"] = "end"; - break; - default: - Debug.Fail($"Unsupported statement ordering: {ordering}"); - break; - } + CodeExpressionStatement statement = new(methodInvoke); - statements.Add(statement); + switch (ordering) + { + case StatementOrdering.Prepend: + statement.UserData["statement-ordering"] = "begin"; + break; + case StatementOrdering.Append: + statement.UserData["statement-ordering"] = "end"; + break; + default: + Debug.Fail($"Unsupported statement ordering: {ordering}"); + break; } + + statements.Add(statement); } private void SerializePerformLayout(IDesignerSerializationManager manager, CodeStatementCollection statements, object control) diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ControlDesigner.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ControlDesigner.cs index 91468f43523..74f02794c36 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ControlDesigner.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ControlDesigner.cs @@ -1665,7 +1665,7 @@ protected override void PreFilterProperties(IDictionary properties) } /// - /// Hooks the children of the given control. We need to do this for child controls that are not in design + /// Unhooks the children of the given control. We need to do this for child controls that are not in design /// mode, which is the case for composite controls. /// protected void UnhookChildControls(Control firstChild) @@ -1674,11 +1674,9 @@ protected void UnhookChildControls(Control firstChild) foreach (Control child in firstChild.Controls) { - IWindowTarget? oldTarget = null; if (child is not null) { - // No, no designer means we must replace the window target in this control. - oldTarget = child.WindowTarget; + IWindowTarget? oldTarget = child.WindowTarget; if (oldTarget is ChildWindowTarget target) { child.WindowTarget = target.OldWindowTarget; diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DataGridViewAddColumnDialog.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DataGridViewAddColumnDialog.cs index 342f35091ba..acc4ae47f07 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DataGridViewAddColumnDialog.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DataGridViewAddColumnDialog.cs @@ -52,8 +52,7 @@ public DataGridViewAddColumnDialog(DataGridViewColumnCollection dataGridViewColu _liveDataGridView = liveDataGridView; // PERF: set the Dialog Font before InitializeComponent. - // - Font uiFont = Control.DefaultFont; + Font uiFont = DefaultFont; if (_liveDataGridView.Site.TryGetService(out IUIService? uiService)) { uiFont = (Font)uiService.Styles["DialogFont"]!; @@ -639,14 +638,14 @@ private void nameTextBox_Validating(object? sender, CancelEventArgs e) nameCreationService = _liveDataGridView.Site.GetService(); } - string errorString = string.Empty; - if (!ValidName(_nameTextBox.Text, - _dataGridViewColumns, - container, - nameCreationService, - _liveDataGridView.Columns, - !_persistChangesToDesigner, - out errorString)) + if (!ValidName( + _nameTextBox.Text, + _dataGridViewColumns, + container, + nameCreationService, + _liveDataGridView.Columns, + !_persistChangesToDesigner, + out string errorString)) { IUIService? uiService = _liveDataGridView.Site?.GetService(); DataGridViewDesigner.ShowErrorDialog(uiService, errorString, _liveDataGridView); @@ -717,7 +716,6 @@ private void PopulateDataColumns() } catch (ArgumentException) { - currencyManager = null; } PropertyDescriptorCollection? propertyDescriptorCollection = currencyManager?.GetItemProperties(); @@ -742,14 +740,9 @@ private void PopulateDataColumns() } } - if (selectedIndex != -1 && selectedIndex < _dataColumns.Items.Count) - { - _dataColumns.SelectedIndex = selectedIndex; - } - else - { - _dataColumns.SelectedIndex = _dataColumns.Items.Count > 0 ? 0 : -1; - } + _dataColumns.SelectedIndex = selectedIndex != -1 && selectedIndex < _dataColumns.Items.Count + ? selectedIndex + : _dataColumns.Items.Count > 0 ? 0 : -1; } private void addButton_Click(object? sender, EventArgs e) @@ -778,14 +771,14 @@ protected override bool ProcessDialogKey(Keys keyData) IContainer? container = host?.Container; INameCreationService? nameCreationService = _liveDataGridView.Site?.GetService(); - string errorString = string.Empty; - if (ValidName(_nameTextBox.Text, - _dataGridViewColumns, - container, - nameCreationService, - _liveDataGridView.Columns, - !_persistChangesToDesigner, - out errorString)) + if (ValidName( + _nameTextBox.Text, + _dataGridViewColumns, + container, + nameCreationService, + _liveDataGridView.Columns, + !_persistChangesToDesigner, + out string errorString)) { AddColumn(); Close(); diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DataGridViewColumnCollectionDialog.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DataGridViewColumnCollectionDialog.cs index ce4f5ac01a5..1c92d8d4eb6 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DataGridViewColumnCollectionDialog.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DataGridViewColumnCollectionDialog.cs @@ -361,8 +361,6 @@ private static void CopyDefaultCellStyle(DataGridViewColumn srcColumn, DataGridV { throw; } - - defaultSrcColumn = null; } // 2.b Go thru the public properties in the DataGridViewCellStyle and copy only the property @@ -1269,7 +1267,7 @@ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[]? at { PropertyDescriptorCollection props = TypeDescriptor.GetProperties(DataGridViewColumn); - PropertyDescriptor[]? propArray = null; + PropertyDescriptor[]? propArray; if (DataGridViewColumnDesigner is not null) { // PropertyDescriptorCollection does not let us change properties. @@ -1302,17 +1300,8 @@ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[]? at return new PropertyDescriptorCollection(propArray); } - object ICustomTypeDescriptor.GetPropertyOwner(PropertyDescriptor? pd) - { - if (pd is ColumnTypePropertyDescriptor) - { - return this; - } - else - { - return DataGridViewColumn; - } - } + object ICustomTypeDescriptor.GetPropertyOwner(PropertyDescriptor? pd) => + pd is ColumnTypePropertyDescriptor ? this : DataGridViewColumn; ISite? IComponent.Site { diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DesignBindingPicker.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DesignBindingPicker.cs index fd7af6b19ee..2020d974386 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DesignBindingPicker.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DesignBindingPicker.cs @@ -440,7 +440,6 @@ public DesignBindingPicker() _windowsFormsEditorService = null; _dataSourceProviderService = null; _designerHost = null; - context = null; // Return final selection to caller return finalSelectedItem; diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DocumentDesigner.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DocumentDesigner.cs index 139dcd9b63b..aed8c39c349 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DocumentDesigner.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DocumentDesigner.cs @@ -249,12 +249,16 @@ internal virtual bool CanDropComponents(DragEventArgs de) { // If there is no tray we bail. if (_componentTray is null) + { return true; + } // Figure out if any of the components in the drag-drop are children // of our own tray. If so, we should prevent this drag-drop from proceeding. - // - OleDragDropHandler ddh = GetOleDragHandler(); + + // Keeping GetOleDragHandler() for compat. + _ = GetOleDragHandler(); + object[] dragComps = OleDragDropHandler.GetDraggingObjects(de); if (dragComps is not null) @@ -275,12 +279,7 @@ internal virtual bool CanDropComponents(DragEventArgs de) } // ToolStripItems cannot be dropped on any ParentControlDesigners since they have custom DataObject Format. - if (de.Data is ToolStripItemDataObject) - { - return false; - } - - return true; + return de.Data is not ToolStripItemDataObject; } private AxToolboxItem CreateAxToolboxItem(IDataObject dataObject) @@ -877,69 +876,55 @@ private void OnUndoing(object source, EventArgs e) /// private void OnComponentAdded(object source, ComponentEventArgs ce) { - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); - if (host is not null) + if (!TryGetService(out IDesignerHost host)) { - IComponent component = ce.Component; + return; + } - bool addControl = true; + IComponent component = ce.Component; - // This is the mirror to logic in ParentControlDesigner. The component should be - // added somewhere, and this logic decides where. + // This is the mirror to logic in ParentControlDesigner. The component should be + // added somewhere, and this logic decides where. - // LETS SEE IF WE ARE TOOLSTRIP in which case we want to get added - // to the componentTray even though this is a control.. - // We should think of implementing an interface so that we can have many more - // controls behaving like this. + // If the component is a toolstrip or a top level form, we should add to the tray. - if (host.GetDesigner(component) is not ToolStripDesigner td) - { - ControlDesigner cd = host.GetDesigner(component) as ControlDesigner; - if (cd is not null) - { - if (cd.Control is not Form form || !form.TopLevel) - { - addControl = false; - } - } - } + IDesigner designer = host.GetDesigner(component); + bool addControl = designer is ToolStripDesigner + || designer is not ControlDesigner cd + || (cd.Control is Form form && form.TopLevel); - if (addControl && - TypeDescriptor.GetAttributes(component).Contains(DesignTimeVisibleAttribute.Yes)) - { - if (_componentTray is null) - { - ISplitWindowService sws = (ISplitWindowService)GetService(typeof(ISplitWindowService)); - if (sws is not null) - { - _componentTray = new ComponentTray(this, Component.Site); - sws.AddSplitWindow(_componentTray); + if (!addControl || !TypeDescriptor.GetAttributes(component).Contains(DesignTimeVisibleAttribute.Yes)) + { + return; + } - _componentTray.Height = _trayHeight; - _componentTray.ShowLargeIcons = _trayLargeIcon; - _componentTray.AutoArrange = _trayAutoArrange; + if (_componentTray is null && TryGetService(out ISplitWindowService sws)) + { + _componentTray = new ComponentTray(this, Component.Site); + sws.AddSplitWindow(_componentTray); - host.AddService(_componentTray); - } - } + _componentTray.Height = _trayHeight; + _componentTray.ShowLargeIcons = _trayLargeIcon; + _componentTray.AutoArrange = _trayAutoArrange; - if (_componentTray is not null) - { - // Suspend the layout of the tray through the loading - // process. This way, we won't continuously try to layout - // components in auto arrange mode. We will instead let - // the controls restore themselves to their persisted state - // and then let auto-arrange kick in once. - // - if (host is not null && host.Loading && !_trayLayoutSuspended) - { - _trayLayoutSuspended = true; - _componentTray.SuspendLayout(); - } + host.AddService(_componentTray); + } - _componentTray.AddComponent(component); - } + if (_componentTray is not null) + { + // Suspend the layout of the tray through the loading + // process. This way, we won't continuously try to layout + // components in auto arrange mode. We will instead let + // the controls restore themselves to their persisted state + // and then let auto-arrange kick in once. + + if (host is not null && host.Loading && !_trayLayoutSuspended) + { + _trayLayoutSuspended = true; + _componentTray.SuspendLayout(); } + + _componentTray.AddComponent(component); } } diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ImageListImageEditor.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ImageListImageEditor.cs index 029d5e5bc94..b550a87ebcd 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ImageListImageEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ImageListImageEditor.cs @@ -29,7 +29,7 @@ public class ImageListImageEditor : ImageEditor } ArrayList images = []; - if (!provider.TryGetService(out IWindowsFormsEditorService? editorService)) + if (!provider.TryGetService(out IWindowsFormsEditorService? _)) { return images; } diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ParentControlDesigner.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ParentControlDesigner.cs index 188d78f9b40..1e168abf271 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ParentControlDesigner.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ParentControlDesigner.cs @@ -1481,7 +1481,8 @@ protected override void OnDragEnter(DragEventArgs de) } else { - OleDragDropHandler ddh = GetOleDragHandler(); + // Keep GetOleDragHandler() for compat. + _ = GetOleDragHandler(); dragComps = OleDragDropHandler.GetDraggingObjects(de); } diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/PictureBoxDesigner.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/PictureBoxDesigner.cs index 167528a1723..74423de9f9c 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/PictureBoxDesigner.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/PictureBoxDesigner.cs @@ -85,9 +85,9 @@ public override SelectionRules SelectionRules { SelectionRules rules = base.SelectionRules; PictureBoxSizeMode sizeMode = PictureBoxSizeMode.Normal; - PropertyDescriptorCollection props = TypeDescriptor.GetProperties(Component); - PropertyDescriptor? propSizeMode = TypeDescriptor.GetProperties(Component)["SizeMode"]; - if (props.TryGetPropertyDescriptorValue( + PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(Component); + + if (properties.TryGetPropertyDescriptorValue( "SizeMode", Component, ref sizeMode)) diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/StyleEditorForm.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/StyleEditorForm.cs index e0009ea4eca..d513b9784e0 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/StyleEditorForm.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/StyleEditorForm.cs @@ -818,33 +818,30 @@ private void ClearAndSetSelectionAndFocus(int index) ///
private void AddItem(int index) { - string member = null; _tableLayoutPanelDesigner.InsertRowCol(_isRowCollection, index); - member = _isRowCollection - ? "Row" + _tableLayoutPanel.RowStyles.Count.ToString(CultureInfo.InvariantCulture) - : "Column" + _tableLayoutPanel.RowStyles.Count.ToString(CultureInfo.InvariantCulture); + string member = _isRowCollection + ? $"Row{_tableLayoutPanel.RowStyles.Count}" + : $"Column{_tableLayoutPanel.RowStyles.Count}"; - if (member is not null) - { - _columnsAndRowsListView.Items.Insert( - index, - new ListViewItem( - [ - member, SizeType.Absolute.ToString(), - DesignerUtils.s_minimumStyleSize.ToString(CultureInfo.InvariantCulture) - ])); - - // If we inserted at the beginning, then we have to change the Member of string of all the existing listView items, - // so we might as well just update the entire listView. - UpdateListViewMember(); - ClearAndSetSelectionAndFocus(index); - } + _columnsAndRowsListView.Items.Insert( + index, + new ListViewItem( + [ + member, SizeType.Absolute.ToString(), + DesignerUtils.s_minimumStyleSize.ToString(CultureInfo.InvariantCulture) + ])); + + // If we inserted at the beginning, then we have to change the Member of string of all the existing listView items, + // so we might as well just update the entire listView. + UpdateListViewMember(); + ClearAndSetSelectionAndFocus(index); } private void OnAddButtonClick(object sender, EventArgs e) { _isDialogDirty = true; + // Add an item to the end of the listView AddItem(_columnsAndRowsListView.Items.Count); } diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TabControlDesigner.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TabControlDesigner.cs index 88fc6433980..8da11eb7f78 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TabControlDesigner.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TabControlDesigner.cs @@ -388,7 +388,8 @@ private void OnControlAdded(object sender, ControlEventArgs e) { if (e.Control is not null && !e.Control.IsHandleCreated) { - IntPtr hwnd = e.Control.Handle; + // Force handle creation. + _ = e.Control.Handle; } } diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TableLayoutPanelDesigner.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TableLayoutPanelDesigner.cs index d945ff8023c..1ea69253c32 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TableLayoutPanelDesigner.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TableLayoutPanelDesigner.cs @@ -679,7 +679,7 @@ private void InitializeNewStyles() private static bool SubsetExists(bool[,] cells, int columns, int rows, int subsetColumns, int subsetRows) { bool exists = false; - int column = 0; + int column; int row; for (row = 0; row < rows - subsetRows + 1; row++) @@ -1946,17 +1946,10 @@ private void OnDeleteClick(object sender, EventArgs e) private void ChangeSizeType(bool isRow, SizeType newType) { - TableLayoutStyleCollection styles = null; + TableLayoutStyleCollection styles; try { - if (isRow) - { - styles = Table.RowStyles; - } - else - { - styles = Table.ColumnStyles; - } + styles = isRow ? Table.RowStyles : Table.ColumnStyles; int index = isRow ? _curRow : _curCol; diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ToolStripDesigner.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ToolStripDesigner.cs index 4bd12aa5eff..a67faa8347e 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ToolStripDesigner.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ToolStripDesigner.cs @@ -782,7 +782,6 @@ private bool CheckIfItemSelected() if (dropDown is not null) { ToolStripItem ownerItem = dropDown.OwnerItem; - ToolStripMenuItemDesigner itemDesigner = (ToolStripMenuItemDesigner)_host.GetDesigner(ownerItem); ToolStripDropDown topmost = ToolStripItemDesigner.GetFirstDropDown((ToolStripDropDownItem)(ownerItem)); ToolStripItem topMostItem = (topmost is null) ? ownerItem : topmost.OwnerItem; @@ -2385,12 +2384,12 @@ private void SelSvc_SelectionChanged(object sender, EventArgs e) } } - // REQUIRED FOR THE REFRESH OF GLYPHS BUT TRY TO BE SMART ABOUT THE REGION TO INVALIDATE.... - if (SelectionService.PrimarySelection is not ToolStripItem selectedItem) + // Required for the refresh of glyphs. + if (SelectionService.PrimarySelection is not ToolStripItem) { if (KeyboardHandlingService is not null) { - selectedItem = KeyboardHandlingService.SelectedDesignerControl as ToolStripItem; + _ = KeyboardHandlingService.SelectedDesignerControl; } } diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TreeNodeCollectionEditor.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TreeNodeCollectionEditor.cs index 86e5fab5772..36eea7e4ff3 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TreeNodeCollectionEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TreeNodeCollectionEditor.cs @@ -151,7 +151,7 @@ private int NextNode private void Add(TreeNode parent) { - TreeNode newNode = null; + TreeNode newNode; string baseNodeName = SR.BaseNodeName; if (parent is null) diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/ComponentModel/Design/DesignerHostTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/ComponentModel/Design/DesignerHostTests.cs index c536ad4bed3..03141d7a67f 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/ComponentModel/Design/DesignerHostTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/ComponentModel/Design/DesignerHostTests.cs @@ -2318,7 +2318,6 @@ public void DesignerHost_GetService_IMultitargetHelperServiceWithLoader_ReturnsE [WinFormsFact] public void DesignerHost_GetServiceIMultitargetHelperServiceWithoutLoader_ReturnsNull() { - object service = new(); Mock mockServiceProvider = new(MockBehavior.Strict); SubDesignSurface surface = new(mockServiceProvider.Object); IDesignerLoaderHost2 host = surface.Host; diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/ComponentModel/Design/Serialization/DesignerSerializationManagerTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/ComponentModel/Design/Serialization/DesignerSerializationManagerTests.cs index d10dd7470d0..af9a27b9b1a 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/ComponentModel/Design/Serialization/DesignerSerializationManagerTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/ComponentModel/Design/Serialization/DesignerSerializationManagerTests.cs @@ -22,7 +22,6 @@ public void DesignerSerializationManager_Ctor_Default() Assert.Null(manager.PropertyProvider); Assert.False(manager.RecycleInstances); Assert.True(manager.ValidateRecycledTypes); - ; } public static IEnumerable Ctor_IServiceProvider_TestData() @@ -110,7 +109,7 @@ public void DesignerSerializationManager_Context_GetWithSession_ReturnsExpected( { DesignerSerializationManager manager = new(); IDesignerSerializationManager iManager = manager; - IDisposable session = manager.CreateSession(); + _ = manager.CreateSession(); ContextStack context = iManager.Context; Assert.Null(context.Current); Assert.Same(context, iManager.Context); @@ -141,7 +140,7 @@ public void DesignerSerializationManager_Context_GetNoSession_ThrowsInvalidOpera public void DesignerSerializationManager_Errors_GetWithSession_ReturnsExpected() { DesignerSerializationManager manager = new(); - IDisposable session = manager.CreateSession(); + _ = manager.CreateSession(); IList errors = manager.Errors; Assert.Empty(errors); Assert.Same(errors, manager.Errors); @@ -480,7 +479,7 @@ public void DesignerSerializationManager_CreateSession_Invoke_CallsOnSessionCrea .Protected() .Setup("OnSessionCreated", EventArgs.Empty) .Verifiable(); - IDisposable session = mockManager.Object.CreateSession(); + _ = mockManager.Object.CreateSession(); mockManager.Protected().Verify("OnSessionCreated", Times.Once(), EventArgs.Empty); } @@ -545,7 +544,7 @@ public void DesignerSerializationManager_CreateSession_Dispose_ClearsErrors() // Dispose, get another and ensure cleared. session1.Dispose(); - IDisposable session2 = manager.CreateSession(); + _ = manager.CreateSession(); IList errors2 = manager.Errors; Assert.Empty(errors2); Assert.Same(errors2, manager.Errors); @@ -565,7 +564,7 @@ public void DesignerSerializationManager_CreateSession_Dispose_ClearsContext() // Dispose, get another and ensure cleared. session1.Dispose(); - IDisposable session2 = manager.CreateSession(); + _ = manager.CreateSession(); ContextStack stack2 = iManager.Context; Assert.NotNull(stack2); Assert.Same(stack2, iManager.Context); @@ -1716,7 +1715,7 @@ public void DesignerSerializationManager_OnSessionDisposed_Invoke_ClearsErrors() SubDesignerSerializationManager manager = new(); IDesignerSerializationManager iManager = manager; - IDisposable session1 = manager.CreateSession(); + _ = manager.CreateSession(); IList errors1 = manager.Errors; Assert.Empty(errors1); Assert.Same(errors1, manager.Errors); @@ -1726,7 +1725,7 @@ public void DesignerSerializationManager_OnSessionDisposed_Invoke_ClearsErrors() // Dispose, get another and ensure cleared. manager.OnSessionDisposed(EventArgs.Empty); - IDisposable session2 = manager.CreateSession(); + _ = manager.CreateSession(); IList errors2 = manager.Errors; Assert.Empty(errors2); Assert.Same(errors2, manager.Errors); @@ -1739,14 +1738,14 @@ public void DesignerSerializationManager_OnSessionDisposed_Invoke_ClearsContext( SubDesignerSerializationManager manager = new(); IDesignerSerializationManager iManager = manager; - IDisposable session1 = manager.CreateSession(); + _ = manager.CreateSession(); ContextStack stack1 = iManager.Context; Assert.NotNull(stack1); Assert.Same(stack1, iManager.Context); // Dispose, get another and ensure cleared. manager.OnSessionDisposed(EventArgs.Empty); - IDisposable session2 = manager.CreateSession(); + _ = manager.CreateSession(); ContextStack stack2 = iManager.Context; Assert.NotNull(stack2); Assert.Same(stack2, iManager.Context); @@ -1758,7 +1757,7 @@ public void DesignerSerializationManager_OnSessionDisposed_Invoke_ClearsSerializ { SubDesignerSerializationManager manager = new(); - IDisposable session1 = manager.CreateSession(); + _ = manager.CreateSession(); object serializer1 = manager.GetSerializer(typeof(ClassWithPublicDesignerSerializer), typeof(BaseClass)); Assert.IsType(serializer1); Assert.Same(serializer1, manager.GetSerializer(typeof(ClassWithPublicDesignerSerializer), typeof(PublicDesignerSerializationProvider))); @@ -2027,32 +2026,32 @@ private class NestedClass { } - [DesignerSerializerAttribute("System.Int32", (string)null)] + [DesignerSerializer("System.Int32", (string)null)] private class ClassWithNullBaseDesignerSerializer { } - [DesignerSerializerAttribute("System.Int32", "")] + [DesignerSerializer("System.Int32", "")] private class ClassWithEmptyBaseDesignerSerializer { } - [DesignerSerializerAttribute("System.Int32", "NoSuchType")] + [DesignerSerializer("System.Int32", "NoSuchType")] private class ClassWithNoSuchBaseDesignerSerializer { } - [DesignerSerializerAttribute((string)null, typeof(int))] + [DesignerSerializer((string)null, typeof(int))] private class ClassWithNullSubDesignerSerializer { } - [DesignerSerializerAttribute("", typeof(int))] + [DesignerSerializer("", typeof(int))] private class ClassWithEmptySubDesignerSerializer { } - [DesignerSerializerAttribute("NoSuchType", typeof(int))] + [DesignerSerializer("NoSuchType", typeof(int))] private class ClassWithNoSuchSubDesignerSerializer { } @@ -2065,12 +2064,12 @@ private class SubClass : BaseClass { } - [DesignerSerializerAttribute(typeof(PublicDesignerSerializationProvider), typeof(BaseClass))] + [DesignerSerializer(typeof(PublicDesignerSerializationProvider), typeof(BaseClass))] private class ClassWithPublicDesignerSerializer { } - [DesignerSerializerAttribute(typeof(PrivateDesignerSerializationProvider), typeof(BaseClass))] + [DesignerSerializer(typeof(PrivateDesignerSerializationProvider), typeof(BaseClass))] private class ClassWithPrivateDesignerSerializer { } diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Drawing/Design/BitmapEditorTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Drawing/Design/BitmapEditorTests.cs index d88eb65f80c..af90b171346 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Drawing/Design/BitmapEditorTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Drawing/Design/BitmapEditorTests.cs @@ -19,7 +19,6 @@ public void BitmapEditor_Ctor_Default() [Fact] public void BitmapEditor_BitmapExtensions_Get_ReturnsExpected() { - SubBitmapEditor editor = new(); List extensions = SubBitmapEditor.BitmapExtensions; Assert.Equal(new string[] { "bmp", "gif", "jpg", "jpeg", "png", "ico" }, extensions); Assert.Same(extensions, SubBitmapEditor.BitmapExtensions); diff --git a/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Oleaut32/VARIANTTests.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Oleaut32/VARIANTTests.cs index 01294ac63e4..540973f716e 100644 --- a/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Oleaut32/VARIANTTests.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Oleaut32/VARIANTTests.cs @@ -952,7 +952,6 @@ public void VARIANT_ToObject_DispatchBYREFNullData_ReturnsNull() public void VARIANT_ToObject_UNKNOWN_ReturnsExpected() { object o = new(); - nint pUnk = Marshal.GetIUnknownForObject(o); using VARIANT variant = Create(VT_UNKNOWN, (void*)Marshal.GetIUnknownForObject(o)); AssertToObjectEqual(o, variant); } @@ -5274,7 +5273,6 @@ public void VARIANT_ToObject_ARRAYVARIANTMultiDimension_ReturnsExpected() [InlineData((ushort)VT_BLOB_OBJECT)] public void VARIANT_ToObject_ARRAYNoData_ReturnsExpected(ushort vt) { - SAFEARRAY* psa = CreateSafeArray(VT_I1, Array.Empty()); using VARIANT variant = new() { vt = VT_ARRAY | (VARENUM)vt @@ -5289,7 +5287,6 @@ public void VARIANT_ToObject_ARRAYNoData_ReturnsExpected(ushort vt) [InlineData((ushort)VT_BSTR_BLOB)] public void VARIANT_ToObject_ARRAYInvalidTypeNoData_ThrowsInvalidOleVariantTypeException(ushort vt) { - SAFEARRAY* psa = CreateSafeArray(VT_I1, Array.Empty()); using VARIANT variant = new() { vt = VT_ARRAY | (VARENUM)vt @@ -5301,11 +5298,11 @@ public void VARIANT_ToObject_ARRAYInvalidTypeNoData_ThrowsInvalidOleVariantTypeE [StaFact] public void VARIANT_ToObject_ARRAYVECTOR_ThrowsInvalidOleVariantTypeException() { - SAFEARRAY* psa = CreateSafeArray(VT_I1, Array.Empty()); using VARIANT variant = new() { vt = VT_ARRAY | VT_VECTOR | VT_I4 }; + Assert.Throws(variant.ToObject); } diff --git a/src/System.Windows.Forms.Primitives/tests/UnitTests/System/Windows/Forms/Automation/UiaTextProviderTests.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/System/Windows/Forms/Automation/UiaTextProviderTests.cs index 27d1958cc47..99ddd2ba467 100644 --- a/src/System.Windows.Forms.Primitives/tests/UnitTests/System/Windows/Forms/Automation/UiaTextProviderTests.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/System/Windows/Forms/Automation/UiaTextProviderTests.cs @@ -65,8 +65,6 @@ public void UiaTextProvider_GetWindowExStyle_ContainsClientedge() [StaFact] public void UiaTextProvider_RectArrayToDoubleArray_ReturnsCorrectValue() { - Mock providerMock = new(MockBehavior.Strict); - double[] expected = [0, 0, 10, 5, 10, 10, 20, 30]; using SafeArrayScope actual = UiaTextProvider.RectListToDoubleArray( [ @@ -82,22 +80,16 @@ public void UiaTextProvider_RectArrayToDoubleArray_ReturnsCorrectValue() } } -#pragma warning disable CS8625 // RectArrayToDoubleArray doesn't accept a null parameter [StaFact] public void UiaTextProvider_RectArrayToDoubleArray_NullParameter_ReturnsNull() { - Mock providerMock = new(MockBehavior.Strict); - - using SafeArrayScope actual = UiaTextProvider.RectListToDoubleArray(null); + using SafeArrayScope actual = UiaTextProvider.RectListToDoubleArray(null!); Assert.True(actual.IsEmpty); } -#pragma warning restore CS8625 [StaFact] public void UiaTextProvider_RectArrayToDoubleArray_EmptyArrayParameter_ReturnsEmptyArrayResult() { - Mock providerMock = new(MockBehavior.Strict); - using SafeArrayScope actual = UiaTextProvider.RectListToDoubleArray([]); Assert.True(actual.IsEmpty); } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridView.Methods.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridView.Methods.cs index fe2233e5ac3..403a1170cb4 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridView.Methods.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridView.Methods.cs @@ -10799,7 +10799,8 @@ internal void OnAddingColumn(DataGridViewColumn dataGridViewColumn) if (dataGridViewColumn.CellTemplate!.DefaultNewRowValue is not null && NewRowIndex != -1) { // New row needs to be un-shared before addition of new cell with a Value is not null - DataGridViewRow newRow = Rows[NewRowIndex]; + // (Accessing the indexer has this side-effect) + _ = Rows[NewRowIndex]; } int newColumnCount = Columns.Count + 1; @@ -10943,7 +10944,8 @@ internal void OnAddingColumns(DataGridViewColumn[] dataGridViewColumns) if (dataGridViewColumn.CellTemplate!.DefaultNewRowValue is not null && NewRowIndex != -1) { // New row needs to be un-shared before addition of new cell with a Value is not null - DataGridViewRow newRow = Rows[NewRowIndex]; + // (Accessing the indexer has this side-effect) + _ = Rows[NewRowIndex]; break; } } @@ -11550,7 +11552,8 @@ protected virtual void OnCellClick(DataGridViewCellEventArgs e) ThrowInvalidOperationExceptionIfNull(dataGridViewCell); if (e.RowIndex >= 0 && dataGridViewCell.ClickUnsharesRowInternal(e)) { - DataGridViewRow dataGridViewRow = Rows[e.RowIndex]; + // Accessing the indexer unshares the row + _ = Rows[e.RowIndex]; GetCellInternal(e.ColumnIndex, e.RowIndex).OnClickInternal(e); } else @@ -11633,7 +11636,8 @@ protected virtual void OnCellContentClick(DataGridViewCellEventArgs e) ThrowInvalidOperationExceptionIfNull(dataGridViewCell); if (e.RowIndex >= 0 && dataGridViewCell.ContentClickUnsharesRowInternal(e)) { - DataGridViewRow dataGridViewRow = Rows[e.RowIndex]; + // Accessing the indexer unshares the row + _ = Rows[e.RowIndex]; GetCellInternal(e.ColumnIndex, e.RowIndex).OnContentClickInternal(e); } else @@ -11657,7 +11661,8 @@ protected virtual void OnCellContentDoubleClick(DataGridViewCellEventArgs e) ThrowInvalidOperationExceptionIfNull(dataGridViewCell); if (e.RowIndex >= 0 && dataGridViewCell.ContentDoubleClickUnsharesRowInternal(e)) { - DataGridViewRow dataGridViewRow = Rows[e.RowIndex]; + // Accessing the indexer unshares the row + _ = Rows[e.RowIndex]; GetCellInternal(e.ColumnIndex, e.RowIndex).OnContentDoubleClickInternal(e); } else @@ -11701,7 +11706,8 @@ protected virtual void OnCellDoubleClick(DataGridViewCellEventArgs e) ThrowInvalidOperationExceptionIfNull(dataGridViewCell); if (e.RowIndex >= 0 && dataGridViewCell.DoubleClickUnsharesRowInternal(e)) { - DataGridViewRow dataGridViewRow = Rows[e.RowIndex]; + // Accessing the indexer unshares the row + _ = Rows[e.RowIndex]; GetCellInternal(e.ColumnIndex, e.RowIndex).OnDoubleClickInternal(e); } else @@ -11847,7 +11853,8 @@ protected virtual void OnCellMouseClick(DataGridViewCellMouseEventArgs e) ThrowInvalidOperationExceptionIfNull(dataGridViewCell); if (e.RowIndex >= 0 && dataGridViewCell.MouseClickUnsharesRowInternal(e)) { - DataGridViewRow dataGridViewRow = Rows[e.RowIndex]; + // Accessing the indexer unshares the row + _ = Rows[e.RowIndex]; GetCellInternal(e.ColumnIndex, e.RowIndex).OnMouseClickInternal(e); } else @@ -11867,7 +11874,8 @@ protected virtual void OnCellMouseDoubleClick(DataGridViewCellMouseEventArgs e) ThrowInvalidOperationExceptionIfNull(dataGridViewCell); if (e.RowIndex >= 0 && dataGridViewCell.MouseDoubleClickUnsharesRowInternal(e)) { - DataGridViewRow dataGridViewRow = Rows[e.RowIndex]; + // Accessing the indexer unshares the row + _ = Rows[e.RowIndex]; GetCellInternal(e.ColumnIndex, e.RowIndex).OnMouseDoubleClickInternal(e); } else @@ -11930,7 +11938,8 @@ and not DataGridViewHitTestType.HorizontalScrollBar { if (e.RowIndex >= 0 && dataGridViewCell.MouseDownUnsharesRowInternal(e)) { - DataGridViewRow dataGridViewRow = Rows[e.RowIndex]; + // Accessing the indexer unshares the row + _ = Rows[e.RowIndex]; GetCellInternal(e.ColumnIndex, e.RowIndex).OnMouseDownInternal(e); } else @@ -12610,7 +12619,8 @@ protected virtual void OnCellMouseEnter(DataGridViewCellEventArgs e) ThrowInvalidOperationExceptionIfNull(dataGridViewCell); if (e.RowIndex >= 0 && dataGridViewCell.MouseEnterUnsharesRowInternal(e.RowIndex)) { - DataGridViewRow dataGridViewRow = Rows[e.RowIndex]; + // Accessing the indexer unshares the row + _ = Rows[e.RowIndex]; GetCellInternal(e.ColumnIndex, e.RowIndex).OnMouseEnterInternal(e.RowIndex); } else @@ -12632,7 +12642,8 @@ protected virtual void OnCellMouseLeave(DataGridViewCellEventArgs e) ThrowInvalidOperationExceptionIfNull(dataGridViewCell); if (e.RowIndex >= 0 && dataGridViewCell.MouseLeaveUnsharesRowInternal(e.RowIndex)) { - DataGridViewRow dataGridViewRow = Rows[e.RowIndex]; + // Accessing the indexer unshares the row + _ = Rows[e.RowIndex]; GetCellInternal(e.ColumnIndex, e.RowIndex).OnMouseLeaveInternal(e.RowIndex); } else @@ -12651,7 +12662,8 @@ protected virtual void OnCellMouseMove(DataGridViewCellMouseEventArgs e) ThrowInvalidOperationExceptionIfNull(dataGridViewCell); if (e.RowIndex >= 0 && dataGridViewCell.MouseMoveUnsharesRowInternal(e)) { - DataGridViewRow dataGridViewRow = Rows[e.RowIndex]; + // Accessing the indexer unshares the row + _ = Rows[e.RowIndex]; GetCellInternal(e.ColumnIndex, e.RowIndex).OnMouseMoveInternal(e); } else @@ -12708,7 +12720,8 @@ protected virtual void OnCellMouseUp(DataGridViewCellMouseEventArgs e) ThrowInvalidOperationExceptionIfNull(dataGridViewCell); if (e.RowIndex >= 0 && dataGridViewCell.MouseUpUnsharesRowInternal(e)) { - DataGridViewRow dataGridViewRow = Rows[e.RowIndex]; + // Accessing the indexer unshares the row + _ = Rows[e.RowIndex]; GetCellInternal(e.ColumnIndex, e.RowIndex).OnMouseUpInternal(e); } else @@ -14651,7 +14664,8 @@ internal void OnDataGridViewElementStateChanged(DataGridViewElement element, int { if (element is DataGridViewRow dataGridViewRow) { - if (Events[s_rowStateChangedEvent] is DataGridViewRowStateChangedEventHandler eh && dataGridViewRow.DataGridView is not null && dataGridViewRow.Index == -1) + if (Events[s_rowStateChangedEvent] is DataGridViewRowStateChangedEventHandler + && dataGridViewRow.DataGridView is not null && dataGridViewRow.Index == -1) { dataGridViewRow = Rows[index]; } @@ -15420,7 +15434,8 @@ internal void OnInsertingColumn(int columnIndexInserted, DataGridViewColumn data if (dataGridViewColumn.CellTemplate!.DefaultNewRowValue is not null && NewRowIndex != -1) { // New row needs to be un-shared before addition of new cell with a Value is not null - DataGridViewRow newRow = Rows[NewRowIndex]; + // (Accessing the indexer has this side effect) + _ = Rows[NewRowIndex]; } int newColumnCount = Columns.Count + 1; @@ -15670,7 +15685,8 @@ protected override void OnKeyDown(KeyEventArgs e) ThrowInvalidOperationExceptionIfNull(dataGridViewCell); if (dataGridViewCell.KeyDownUnsharesRowInternal(e, _ptCurrentCell.Y)) { - DataGridViewRow dataGridViewRow = Rows[_ptCurrentCell.Y]; + // Accessing the indexer unshares the row + _ = Rows[_ptCurrentCell.Y]; CurrentCellInternal.OnKeyDownInternal(e, _ptCurrentCell.Y); } else @@ -15728,7 +15744,8 @@ protected override void OnKeyPress(KeyPressEventArgs e) ThrowInvalidOperationExceptionIfNull(dataGridViewCell); if (dataGridViewCell.KeyPressUnsharesRowInternal(e, _ptCurrentCell.Y)) { - DataGridViewRow dataGridViewRow = Rows[_ptCurrentCell.Y]; + // Accessing the indexer unshares the row + _ = Rows[_ptCurrentCell.Y]; CurrentCellInternal.OnKeyPressInternal(e, _ptCurrentCell.Y); } else @@ -15761,7 +15778,8 @@ protected override void OnKeyUp(KeyEventArgs e) ThrowInvalidOperationExceptionIfNull(dataGridViewCell); if (dataGridViewCell.KeyUpUnsharesRowInternal(e, _ptCurrentCell.Y)) { - DataGridViewRow dataGridViewRow = Rows[_ptCurrentCell.Y]; + // Accessing the indexer unshares the row + _ = Rows[_ptCurrentCell.Y]; CurrentCellInternal.OnKeyUpInternal(e, _ptCurrentCell.Y); } else @@ -19269,11 +19287,11 @@ private void PaintBorder(Graphics g, Rectangle clipRect, Rectangle bounds) return; } - bool paintingNeeded = false; int borderWidth = BorderWidth; + // Does the clipRect intersect with the top edge? Rectangle edge = new(0, 0, bounds.Width, borderWidth); - paintingNeeded = clipRect.IntersectsWith(edge); + bool paintingNeeded = clipRect.IntersectsWith(edge); if (!paintingNeeded) { // Does the clipRect intersect with the bottom edge? @@ -19334,10 +19352,11 @@ private void PaintColumnHeaders(Graphics g, Rectangle clipBounds, bool singleBor DataGridViewCell cell; DataGridViewCellStyle inheritedCellStyle = new(); DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceholder = new(), dgvabsEffective; - DataGridViewColumn? dataGridViewColumnNext = null; // first paint the visible frozen columns DataGridViewColumn? dataGridViewColumn = Columns.GetFirstColumn(DataGridViewElementStates.Visible | DataGridViewElementStates.Frozen); + DataGridViewColumn? dataGridViewColumnNext; + while (dataGridViewColumn is not null) { cell = dataGridViewColumn.HeaderCell; @@ -20116,9 +20135,7 @@ protected override bool ProcessDialogKey(Keys keyData) } keyData &= ~Keys.Control; - bool ret = false; - - ret = base.ProcessDialogKey(keyData); + bool result = base.ProcessDialogKey(keyData); if (_dataGridViewState1[State1_LeavingWithTabKey] && Focused) { @@ -20127,17 +20144,14 @@ protected override bool ProcessDialogKey(Keys keyData) OnEnter(EventArgs.Empty); } - return ret; + return result; } } return base.ProcessDialogKey(keyData); } - protected bool ProcessDownKey(Keys keyData) - { - return ProcessDownKeyInternal(keyData, out bool moved); - } + protected bool ProcessDownKey(Keys keyData) => ProcessDownKeyInternal(keyData, out bool _); private bool ProcessDownKeyInternal(Keys keyData, out bool moved) { @@ -22919,7 +22933,10 @@ protected bool ProcessNextKey(Keys keyData) return false; } - int nextScreenVisibleRowIndexTmp, nextScreenVisibleRowIndex = -1, jumpRows = 0; + int nextScreenVisibleRowIndexTmp; + int nextScreenVisibleRowIndex; + int jumpRows = 0; + if (_ptCurrentCell.Y == -1) { nextScreenVisibleRowIndex = Rows.GetFirstRow(DataGridViewElementStates.Visible); @@ -23178,7 +23195,9 @@ protected bool ProcessPriorKey(Keys keyData) return false; } - int previousScreenVisibleRowIndexTmp, previousScreenVisibleRowIndex = -1; + int previousScreenVisibleRowIndexTmp; + int previousScreenVisibleRowIndex; + if (_ptCurrentCell.Y == -1) { previousScreenVisibleRowIndex = Rows.GetFirstRow(DataGridViewElementStates.Visible); @@ -26537,7 +26556,6 @@ public void SelectAll() _noSelectionChangeCount++; try { - DataGridViewRow? dataGridViewRow = null; switch (SelectionMode) { case DataGridViewSelectionMode.CellSelect: @@ -26547,8 +26565,8 @@ public void SelectAll() int rowIndex = 0, maxRowIndex = Rows.Count; while (rowIndex < maxRowIndex) { - // un-sharing each row! - dataGridViewRow = Rows[rowIndex]; + // Accessing the indexer unshares the row. + _ = Rows[rowIndex]; int columnIndex = 0; while (columnIndex < maxColumnIndex) { diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewComboBoxCell.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewComboBoxCell.cs index 07c70ff0a5a..8dc639df56c 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewComboBoxCell.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewComboBoxCell.cs @@ -1580,7 +1580,7 @@ private bool LookupValue(object? formattedValue, out object? value) Debug.Assert(DisplayMemberProperty is not null || ValueMemberProperty is not null || !string.IsNullOrEmpty(DisplayMember) || !string.IsNullOrEmpty(ValueMember)); - object? item = null; + object? item; if (DisplayMemberProperty is not null || ValueMemberProperty is not null) { // Now look up the item in the DataGridViewComboBoxCell datasource - this can be horribly inefficient diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewIntLinkedList.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewIntLinkedList.cs index 9bfbdaaa71e..155cf66156e 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewIntLinkedList.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewIntLinkedList.cs @@ -71,7 +71,7 @@ public int this[int index] Debug.Assert(index >= 0); if (index != _lastAccessedIndex) { - int currentInt = this[index]; + _ = this[index]; Debug.Assert(index == _lastAccessedIndex); } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewRow.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewRow.cs index a7e9c080916..6927fe09346 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewRow.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewRow.cs @@ -1419,7 +1419,6 @@ protected internal virtual void Paint( ArgumentNullException.ThrowIfNull(graphics); DataGridView dataGridView = DataGridView; - Rectangle updatedClipBounds = clipBounds; DataGridViewRow sharedRow = dataGridView.Rows.SharedRow(rowIndex); DataGridViewCellStyle inheritedRowStyle = new(); BuildInheritedRowStyle(rowIndex, inheritedRowStyle); @@ -1440,7 +1439,7 @@ protected internal virtual void Paint( } DataGridViewPaintParts paintParts = dgvrprepe.PaintParts; - updatedClipBounds = dgvrprepe.ClipBounds; + Rectangle updatedClipBounds = dgvrprepe.ClipBounds; // first paint the potential row header PaintHeader(graphics, @@ -1504,14 +1503,14 @@ protected internal virtual void PaintCells( Rectangle cellBounds = rowBounds; int cx = (dataGridView.RowHeadersVisible ? dataGridView.RowHeadersWidth : 0); bool isFirstDisplayedColumn = true; - DataGridViewElementStates cellState = DataGridViewElementStates.None; DataGridViewCell cell; DataGridViewCellStyle inheritedCellStyle = new(); - DataGridViewColumn? dataGridViewColumnNext = null; DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceholder = new(), dgvabsEffective; // first paint the potential visible frozen cells DataGridViewColumn? dataGridViewColumn = dataGridView.Columns.GetFirstColumn(DataGridViewElementStates.Visible | DataGridViewElementStates.Frozen); + DataGridViewElementStates cellState; + DataGridViewColumn? dataGridViewColumnNext; while (dataGridViewColumn is not null) { cell = Cells[dataGridViewColumn.Index]; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewRowCollection.RowComparer.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewRowCollection.RowComparer.cs index 827ce545a23..d8bcfc8a3ad 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewRowCollection.RowComparer.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewRowCollection.RowComparer.cs @@ -71,7 +71,7 @@ internal int CompareObjects(object? value1, object? value2, int rowIndex1, int r return -1; } - int result = 0; + int result; if (_customComparer is null) { if (_dataGridViewSortedColumn is null) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewRowCollection.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewRowCollection.cs index 0ecb3a5acc7..9f9c64dfad5 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewRowCollection.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewRowCollection.cs @@ -100,7 +100,8 @@ protected ArrayList List int rowCount = Count; for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) { - DataGridViewRow dataGridViewRow = this[rowIndex]; + // Accessing this[rowIndex] will un-share the row. + _ = this[rowIndex]; } return ArrayList.Adapter(_items); @@ -2213,20 +2214,20 @@ internal void RemoveAtInternal(int index, bool force) Debug.Assert(!DataGridView.NoDimensionChangeAllowed); DataGridViewRow dataGridViewRow = SharedRow(index); - Point newCurrentCell = new(-1, -1); if (IsCollectionChangedListenedTo || dataGridViewRow.GetDisplayed(index)) { - dataGridViewRow = this[index]; // need to un-share row because dev is listening to OnCollectionChanged event or the row is displayed + _ = this[index]; // need to un-share row because dev is listening to OnCollectionChanged event or the row is displayed } dataGridViewRow = SharedRow(index); Debug.Assert(DataGridView is not null); - DataGridView.OnRemovingRow(index, out newCurrentCell, force); + DataGridView.OnRemovingRow(index, out _, force); UpdateRowCaches(index, ref dataGridViewRow, adding: false); if (dataGridViewRow.Index != -1) { _rowStates[index] = dataGridViewRow.State; + // Only detach un-shared rows, since a shared row has never been accessed by the user dataGridViewRow.DetachFromDataGridView(); } @@ -2234,7 +2235,7 @@ internal void RemoveAtInternal(int index, bool force) // Note: cannot set dataGridViewRow.DataGridView to null because this row may be shared and still be used. // Note that OnCollectionChanged takes care of calling _items.RemoveAt(index) & // _rowStates.RemoveAt(index). Can't do it here since OnCollectionChanged uses the arrays. - OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Remove, dataGridViewRow), index, 1, true, false, false, newCurrentCell); + OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Remove, dataGridViewRow), index, 1, true, false, false, new Point(-1, -1)); } private static bool RowHasValueOrToolTipText(DataGridViewRow dataGridViewRow) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Labels/Label.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Labels/Label.cs index 4a9dd494326..ae260809a81 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Labels/Label.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Labels/Label.cs @@ -875,7 +875,7 @@ protected Rectangle CalcImageRenderBounds(Image image, Rectangle r, ContentAlign Size pointImageSize = image.Size; int xLoc = r.X + 2; - int yLoc = r.Y + 2; + int yLoc; if ((align & WindowsFormsUtils.AnyRightAlign) != 0) { diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Labels/LinkLabel.LinkLabelAccessibleObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Labels/LinkLabel.LinkLabelAccessibleObject.cs index d909bfee198..224fc19d68f 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Labels/LinkLabel.LinkLabelAccessibleObject.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Labels/LinkLabel.LinkLabelAccessibleObject.cs @@ -18,7 +18,7 @@ public LinkLabelAccessibleObject(LinkLabel owner) : base(owner) } internal override IRawElementProviderFragment.Interface? ElementProviderFromPoint(double x, double y) - => !this.IsOwnerHandleCreated(out LinkLabel? owner) + => !this.IsOwnerHandleCreated(out LinkLabel? _) ? base.ElementProviderFromPoint(x, y) : HitTest((int)x, (int)y) ?? base.ElementProviderFromPoint(x, y); diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ListView/ListView.ColumnHeaderCollection.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ListView/ListView.ColumnHeaderCollection.cs index 02f064a3133..53efd9c4343 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ListView/ListView.ColumnHeaderCollection.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ListView/ListView.ColumnHeaderCollection.cs @@ -313,7 +313,7 @@ public virtual void Clear() // in Tile view our ListView uses the column header collection to update the Tile Information for (int colIdx = _owner._columnHeaders.Length - 1; colIdx >= 0; colIdx--) { - int w = _owner._columnHeaders[colIdx].Width; // Update width before detaching from ListView + _ = _owner._columnHeaders[colIdx].Width; // Update width before detaching from ListView _owner._columnHeaders[colIdx].OwnerListview = null; _owner._columnHeaders[colIdx].ReleaseUiaProvider(); } @@ -328,7 +328,7 @@ public virtual void Clear() { for (int colIdx = _owner._columnHeaders.Length - 1; colIdx >= 0; colIdx--) { - int w = _owner._columnHeaders[colIdx].Width; // Update width before detaching from ListView + _ = _owner._columnHeaders[colIdx].Width; // Update width before detaching from ListView if (_owner.IsHandleCreated) { PInvokeCore.SendMessage(_owner, PInvoke.LVM_DELETECOLUMN, (WPARAM)colIdx); @@ -499,7 +499,7 @@ public virtual void RemoveAt(int index) { ColumnHeader columnHeader = _owner.GetColumnHeader(index); - int w = columnHeader.Width; // Update width before detaching from ListView + _ = columnHeader.Width; // Update width before detaching from ListView // in Tile view our ListView uses the column header collection to update the Tile Information if (_owner.IsHandleCreated && _owner.View != View.Tile) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ListView/ListView.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ListView/ListView.cs index d656f327e26..5949a52df76 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ListView/ListView.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ListView/ListView.cs @@ -1753,13 +1753,17 @@ public ListViewItem? TopItem ListViewItem? topItem = TopItem; if ((topItem is null) && (_topIndex == Items.Count)) - { // There's a - topItem = value; // a single item. Result of the - if (Scrollable) // message is the number of items in the list rather than an index of an item in the list. - { // This causes TopItem to return null. A side issue is that EnsureVisible doesn't do too well - EnsureVisible(0); // here either, because it causes the listview to go blank rather than displaying anything useful. - Scroll(0, value.Index); // To work around this, we force the listbox to display the first item, then scroll down to the item - } // user is setting as the top item. + { + // Result of the message is the number of items in the list rather than an index of an item in the list. + // This causes TopItem to return null. A side issue is that EnsureVisible doesn't do too well + // here either, because it causes the listview to go blank rather than displaying anything useful. + // To work around this, we force the listbox to display the first item, then scroll down to the item + // user is setting as the top item. + if (Scrollable) + { + EnsureVisible(0); + Scroll(0, value.Index); + } return; } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGrid.PropertyGridAccessibleObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGrid.PropertyGridAccessibleObject.cs index 0544ba7da43..d3f8c4d2b61 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGrid.PropertyGridAccessibleObject.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGrid.PropertyGridAccessibleObject.cs @@ -80,7 +80,6 @@ public PropertyGridAccessibleObject(PropertyGrid owningPropertyGrid) : base(owni return null; case NavigateDirection.NavigateDirection_PreviousSibling: - fragmentCount = GetChildFragmentCount(); childFragmentIndex = GetChildFragmentIndex(childFragment); if (childFragmentIndex > 0) { diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyDescriptorGridEntry.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyDescriptorGridEntry.cs index d17febf4324..89b75ac6e5c 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyDescriptorGridEntry.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyDescriptorGridEntry.cs @@ -884,7 +884,7 @@ protected bool ViewEvent( transaction?.Cancel(); transaction = null; - OwnerGridView?.ShowInvalidMessage(newHandler, ex); + OwnerGridView?.ShowInvalidMessage(ex); return false; } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.GridViewListBoxAccessibleObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.GridViewListBoxAccessibleObject.cs index ace2917627a..77559636652 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.GridViewListBoxAccessibleObject.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.GridViewListBoxAccessibleObject.cs @@ -19,7 +19,7 @@ private class GridViewListBoxAccessibleObject : ListBox.ListBoxAccessibleObject /// The owning GridViewListBox. public GridViewListBoxAccessibleObject(GridViewListBox owningGridViewListBox) : base(owningGridViewListBox) { - if (owningGridViewListBox.OwningPropertyGridView is not PropertyGridView owningPropertyGridView) + if (owningGridViewListBox.OwningPropertyGridView is null) { throw new ArgumentException(null, nameof(owningGridViewListBox)); } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs index b4344099023..3055e78b1fc 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs @@ -1254,7 +1254,7 @@ public void DoubleClickRow(int row, bool toggleExpand, int type) catch (Exception ex) { SetCommitError(ErrorState.Thrown); - ShowInvalidMessage(gridEntry.PropertyLabel, ex); + ShowInvalidMessage(ex); return; } } @@ -2309,7 +2309,7 @@ private void OnListDrawItem(object? sender, DrawItemEventArgs e) } catch (FormatException ex) { - ShowFormatExceptionMessage(gridEntry.PropertyLabel, ex); + ShowFormatExceptionMessage(ex); if (DropDownListBox.IsHandleCreated) { DropDownListBox.Visible = false; @@ -3072,7 +3072,6 @@ protected override void OnMouseMove(MouseEventArgs e) // Ensure that tooltips don't display when host application is not foreground app. // Assume that we don't want to display the tooltips - HWND foregroundWindow = PInvokeCore.GetForegroundWindow(); if (PInvoke.IsChild(PInvokeCore.GetForegroundWindow(), this)) { // Don't show the tips if a dropdown is showing @@ -4666,7 +4665,7 @@ internal bool CommitValue(GridEntry entry, object? value, bool closeDropDown = t catch (Exception ex) { SetCommitError(ErrorState.Thrown); - ShowInvalidMessage(entry.PropertyLabel, ex); + ShowInvalidMessage(ex); return false; } } @@ -4739,7 +4738,7 @@ private bool CommitText(string text) catch (Exception ex) { SetCommitError(ErrorState.Thrown); - ShowInvalidMessage(currentEntry.PropertyLabel, ex); + ShowInvalidMessage(ex); return false; } @@ -4888,10 +4887,8 @@ public DialogResult ShowDialog(Form dialog) return result; } - private unsafe void ShowFormatExceptionMessage(string? propertyName, Exception? ex) + private unsafe void ShowFormatExceptionMessage(Exception? ex) { - propertyName ??= "(unknown)"; - // We have to uninstall our hook so the user can push the button! bool hooked = EditTextBox.HookMouseDown; EditTextBox.DisableMouseHook = true; @@ -4962,10 +4959,8 @@ private unsafe void ShowFormatExceptionMessage(string? propertyName, Exception? } } - internal unsafe void ShowInvalidMessage(string? propertyName, Exception? ex) + internal unsafe void ShowInvalidMessage(Exception? ex) { - propertyName ??= "(unknown)"; - // We have to uninstall our hook so the user can push the button. bool hooked = EditTextBox.HookMouseDown; EditTextBox.DisableMouseHook = true; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/TextBox/MaskedTextBox.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/TextBox/MaskedTextBox.cs index 1b9cab02888..915f9675ea6 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/TextBox/MaskedTextBox.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/TextBox/MaskedTextBox.cs @@ -2195,8 +2195,6 @@ private void Replace(string text, int startPosition, int selectionLen) } else { - // temp hint used to preserve the 'primary' operation hint (no side effects). - MaskedTextResultHint tempHint = hint; int testPos; foreach (char ch in text) @@ -2222,7 +2220,7 @@ private void Replace(string text, int startPosition, int selectionLen) // if length > 0 we are (re)placing the input char in the current startPosition, otherwise we are inserting the input. bool replace = length > 0; - if (PlaceChar(clonedProvider, ch, startPosition, length, replace, out tempHint)) + if (PlaceChar(clonedProvider, ch, startPosition, length, replace, out MaskedTextResultHint tempHint)) { // caretTestPos is updated in PlaceChar call. startPosition = _caretTestPos + 1; @@ -2245,19 +2243,10 @@ private void Replace(string text, int startPosition, int selectionLen) // At this point we have processed all characters from the input text (if any) but still need to // remove remaining characters from the selected text (if editable and valid chars). - if (startPosition <= endPos) + if (startPosition <= endPos + && !clonedProvider.RemoveAt(startPosition, endPos, out _caretTestPos, out MaskedTextResultHint tempHint)) { - if (!clonedProvider.RemoveAt(startPosition, endPos, out _caretTestPos, out tempHint)) - { - OnMaskInputRejected(new MaskInputRejectedEventArgs(_caretTestPos, tempHint)); - } - - // If 'replace' is not actually performed (maybe the input is empty which means 'remove', hint will be whatever - // the 'remove' operation result hint is. - if (hint == MaskedTextResultHint.NoEffect && hint != tempHint) - { - hint = tempHint; - } + OnMaskInputRejected(new MaskInputRejectedEventArgs(_caretTestPos, tempHint)); } } } @@ -2527,7 +2516,7 @@ private void SetMaskedTextProvider(MaskedTextProvider newProvider, string? textO } int testPos = 0; - bool raiseOnMaskInputRejected = false; // Raise if new provider rejects old text. + bool raiseOnMaskInputRejected; MaskedTextResultHint hint = MaskedTextResultHint.NoEffect; MaskedTextProvider oldProvider = _maskedTextProvider; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/TextBox/TextBoxBase.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/TextBox/TextBoxBase.cs index dc4ddfd02db..b68f7a97850 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/TextBox/TextBoxBase.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/TextBox/TextBoxBase.cs @@ -1006,8 +1006,7 @@ internal virtual void SetSelectedTextInternal(string? text, bool clearUndo) } /// - /// Gets or sets the number of characters selected in the text - /// box. + /// Gets or sets the number of characters selected in the text box. /// [SRCategory(nameof(SR.CatAppearance))] [Browsable(false)] @@ -1017,28 +1016,24 @@ public virtual int SelectionLength { get { - GetSelectionStartAndLength(out int start, out int length); - + GetSelectionStartAndLength(out int _, out int length); return length; } - set { ArgumentOutOfRangeException.ThrowIfNegative(value); - GetSelectionStartAndLength(out int selStart, out int selLength); + GetSelectionStartAndLength(out int start, out int length); - if (value != selLength) + if (value != length) { - Select(selStart, value); + Select(start, value); } } } /// - /// Gets or sets the starting - /// point of text selected in the text - /// box. + /// Gets or sets the starting point of text selected in the text box. /// [SRCategory(nameof(SR.CatAppearance))] [Browsable(false)] @@ -1048,21 +1043,18 @@ public int SelectionStart { get { - GetSelectionStartAndLength(out int selStart, out _); - - return selStart; + GetSelectionStartAndLength(out int start, out _); + return start; } set { ArgumentOutOfRangeException.ThrowIfNegative(value); - Select(value, SelectionLength); } } /// - /// Gets or sets - /// the current text in the text box. + /// Gets or sets the current text in the text box. /// [Localizable(true)] [AllowNull] diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStrip.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStrip.cs index 133b88683e7..040b4ff8ef4 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStrip.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStrip.cs @@ -148,7 +148,6 @@ public ToolStrip() Dock = DefaultDock; AutoSize = true; CausesValidation = false; - Size defaultSize = DefaultSize; SetAutoSizeMode(AutoSizeMode.GrowAndShrink); ShowItemToolTips = DefaultShowItemToolTips; ResumeLayout(true); @@ -538,10 +537,9 @@ public override Font Font /// Deriving classes can override this to configure a default size for their control. /// This is more efficient than setting the size in the control's constructor. ///
- protected override Size DefaultSize - => ScaleHelper.IsThreadPerMonitorV2Aware ? - ScaleHelper.ScaleToDpi(new Size(100, 25), DeviceDpi) : - new Size(100, 25); + protected override Size DefaultSize => ScaleHelper.IsThreadPerMonitorV2Aware + ? ScaleHelper.ScaleToDpi(new Size(100, 25), DeviceDpi) + : new Size(100, 25); protected override Padding DefaultPadding { @@ -4250,7 +4248,9 @@ protected virtual void SetDisplayedItems() // For splitstack layout we re-arrange the items in the displayed items // collection so that we can easily tab through them in natural order - Rectangle displayRect = DisplayRectangle; + + // We've historically called this virtual, still need to for compat. + _ = DisplayRectangle; int lastRightAlignedItem = -1; for (int pass = 0; pass < 2; pass++) @@ -4568,12 +4568,7 @@ private void UpdateOrientation(Orientation newOrientation) { if (newOrientation != Orientation) { - // snap our last dimensions before switching over. - // use specifed bounds so that if something is docked or anchored we don't take the extra stretching - // effects into account. - Size size = CommonProperties.GetSpecifiedBounds(this).Size; Orientation = newOrientation; - // since the Grip affects the DisplayRectangle, we need to re-adjust the size SetupGrip(); } } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripDropDown.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripDropDown.cs index 6d7cd50b15d..83777ba575b 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripDropDown.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripDropDown.cs @@ -988,9 +988,7 @@ internal Rectangle GetDropDownBounds(Rectangle suggestedBounds) Rectangle dropDownBounds; if (TopLevel) { - Point screenPoint = Point.Empty; - - screenPoint = _ownerItem is ToolStripDropDownItem dropDownItem + Point screenPoint = _ownerItem is ToolStripDropDownItem dropDownItem ? dropDownItem.DropDownLocation : suggestedBounds.Location; @@ -1001,8 +999,7 @@ internal Rectangle GetDropDownBounds(Rectangle suggestedBounds) } else { - Point parentClientPoint = Point.Empty; - parentClientPoint = (_ownerItem is ToolStripDropDownItem dropDownItem) && (ParentInternal is not null) + Point parentClientPoint = (_ownerItem is ToolStripDropDownItem dropDownItem) && (ParentInternal is not null) ? ParentInternal.PointToClient(dropDownItem.DropDownLocation) : suggestedBounds.Location; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripDropDownMenu.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripDropDownMenu.cs index 52c8f29362c..eb4acecf443 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripDropDownMenu.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripDropDownMenu.cs @@ -346,7 +346,7 @@ private void CalculateInternalLayoutMetrics() maxTextSize.Width = Math.Max(maxTextSize.Width, maxNonMenuItemSize.Width); Point nextPoint = Point.Empty; - int checkAndImageMarginWidth = 0; + int checkAndImageMarginWidth; int extraImageWidth = Math.Max(0, maxImageSize.Width - _defaultImageSize.Width); @@ -531,10 +531,6 @@ internal override void Initialize() { base.Initialize(); Padding = DefaultPadding; - FlowLayoutSettings settings = new(this) - { - FlowDirection = FlowDirection.TopDown - }; _state[s_stateShowImageMargin] = true; } @@ -760,7 +756,6 @@ internal void ScrollInternal(bool up) if (_indexOfFirstDisplayedItem == Items.Count - 1) { Debug.Fail("We're trying to scroll down, but the top item is displayed!!!"); - delta = 0; } ToolStripItem itemTop = Items[_indexOfFirstDisplayedItem]; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripDropTargetManager.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripDropTargetManager.cs index d3f2f51dcc5..0a308152211 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripDropTargetManager.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripDropTargetManager.cs @@ -98,7 +98,7 @@ public void OnDragEnter(DragEventArgs e) public void OnDragOver(DragEventArgs e) { - IDropTarget? newDropTarget = null; + IDropTarget? newDropTarget; // If we are supporting Item Reordering // and this is a ToolStripItem - snitch it. diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripItem.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripItem.cs index 72a0b621b6f..bf79f970dcd 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripItem.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripItem.cs @@ -1565,17 +1565,9 @@ internal Size PreferredImageSize } } - Size imageSize = Size.Empty; - if (usingImageList) - { - imageSize = Owner?.ImageList?.ImageSize ?? Size.Empty; - } - else - { - imageSize = (image is null) ? Size.Empty : image.Size; - } - - return imageSize; + return usingImageList + ? Owner?.ImageList?.ImageSize ?? Size.Empty + : (image is null) ? Size.Empty : image.Size; } } @@ -2169,7 +2161,7 @@ public unsafe DragDropEffects DoDragDrop(object data, DragDropEffects allowedEff { if (data is not IComDataObject dataObject) { - DataObject? iwdata = null; + DataObject? iwdata; if (data is IDataObject idataObject) { iwdata = new DataObject(idataObject); @@ -3444,7 +3436,7 @@ internal Point TranslatePoint(Point fromPoint, ToolStripPointType fromPointType, return fromPoint; } - Point toPoint = Point.Empty; + Point toPoint; Point currentToolStripItemLocation = Bounds.Location; // From: Screen diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripItemCollection.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripItemCollection.cs index a1a90cc1de4..0d14ec7aea3 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripItemCollection.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripItemCollection.cs @@ -425,15 +425,9 @@ public void RemoveAt(int index) throw new NotSupportedException(SR.ToolStripItemCollectionIsReadOnly); } - ToolStripItem? item = null; - if (index < Count && index >= 0) - { - item = (ToolStripItem)(InnerList[index]); - } - else - { - throw new IndexOutOfRangeException(); - } + ToolStripItem item = index >= Count || index < 0 + ? throw new IndexOutOfRangeException() + : (ToolStripItem)InnerList[index]; InnerList.RemoveAt(index); OnAfterRemove(item); diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripManager.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripManager.cs index ddc65f5eed5..2423e03fb64 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripManager.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripManager.cs @@ -57,7 +57,7 @@ internal static Font DefaultFont return Control.DefaultFont; } - Font? sysFont = null; + Font? sysFont; // We need to cache the default fonts for the different DPIs. if (ScaleHelper.IsThreadPerMonitorV2Aware) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripMenuItem.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripMenuItem.cs index 3abf3fc77ba..7880654c700 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripMenuItem.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripMenuItem.cs @@ -675,7 +675,7 @@ private unsafe bool GetNativeMenuItemEnabled() } // Its a system defined bitmap. - int buttonToUse = -1; + int buttonToUse; if (info.hbmpItem == HBITMAP.HBMMENU_MBAR_CLOSE || info.hbmpItem == HBITMAP.HBMMENU_MBAR_CLOSE_D diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripPanel.ToolStripPanelRowCollection.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripPanel.ToolStripPanelRowCollection.cs index 5b4374c29cb..3904524cad9 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripPanel.ToolStripPanelRowCollection.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripPanel.ToolStripPanelRowCollection.cs @@ -145,25 +145,10 @@ private void OnAdd(ToolStripPanelRow value) } } - public void Remove(ToolStripPanelRow value) - { - InnerList.Remove(value); - } + public void Remove(ToolStripPanelRow value) => InnerList.Remove(value); - public void RemoveAt(int index) - { - ToolStripPanelRow? item = null; - if (index < Count && index >= 0) - { - item = (ToolStripPanelRow)(InnerList[index]); - } + public void RemoveAt(int index) => InnerList.RemoveAt(index); - InnerList.RemoveAt(index); - } - - public void CopyTo(ToolStripPanelRow[] array, int index) - { - InnerList.CopyTo(array, index); - } + public void CopyTo(ToolStripPanelRow[] array, int index) => InnerList.CopyTo(array, index); } } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripPanel.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripPanel.cs index ffa7dc11b69..abc3e0041b2 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripPanel.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripPanel.cs @@ -640,14 +640,6 @@ private void JoinControls(bool forceLayout) controlArray[i].Size = controlArray[i].PreferredSize; } - Point controlLocation = controlArray[i].Location; - - // right to left has changed while layout was deferred... - if (_state[s_stateRightToLeftChanged]) - { - controlLocation = new Point(Width - controlArray[i].Right, controlLocation.Y); - } - var toolStrip = controlArray[i] as ToolStrip; if (toolStrip is not null) { diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripPanelCell.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripPanelCell.cs index 90e6888c169..63da7eb9a78 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripPanelCell.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripPanelCell.cs @@ -263,7 +263,7 @@ protected override ArrangedElementCollection GetChildren() public override Size GetPreferredSize(Size constrainingSize) { ISupportToolStripPanel draggedControl = DraggedControl; - Size preferredSize = Size.Empty; + Size preferredSize; if (draggedControl.Stretch && ToolStripPanelRow is not null) { diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripSplitStackDragDropHandler.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripSplitStackDragDropHandler.cs index 4cc2f6fa33f..55cc552d5c6 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripSplitStackDragDropHandler.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripSplitStackDragDropHandler.cs @@ -206,31 +206,24 @@ private RelativeLocation ComparePositions(Rectangle orig, Point check) if (_owner.Orientation == Orientation.Horizontal) { int widthUnit = orig.Width / 2; - RelativeLocation relativeLocation = RelativeLocation.Left; // we can return here if we are checking abovebelowleftright, because // the left right calculation is more picky than the above/below calculation // and the above below calculation will just override this one. if ((orig.Left + widthUnit) >= check.X) { - relativeLocation = RelativeLocation.Left; - return relativeLocation; + return RelativeLocation.Left; } else if ((orig.Right - widthUnit) <= check.X) { - relativeLocation = RelativeLocation.Right; - return relativeLocation; + return RelativeLocation.Right; } } if (_owner.Orientation == Orientation.Vertical) { int heightUnit = orig.Height / 2; - RelativeLocation relativeLocation = (check.Y <= (orig.Top + heightUnit)) ? - RelativeLocation.Above - : RelativeLocation.Below; - - return relativeLocation; + return (check.Y <= (orig.Top + heightUnit)) ? RelativeLocation.Above : RelativeLocation.Below; } Debug.Fail("Could not calculate the relative position for AllowItemReorder"); diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripSplitStackLayout.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripSplitStackLayout.cs index c8472560596..435742d0623 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripSplitStackLayout.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripSplitStackLayout.cs @@ -213,7 +213,7 @@ private bool LayoutHorizontal() int lastRight = _displayRectangle.Right; int lastLeft = _displayRectangle.Left; bool needsMoreSpace = false; - Size itemSize = Size.Empty; + Size itemSize; Rectangle alignedLeftItems = Rectangle.Empty; Rectangle alignedRightItems = Rectangle.Empty; @@ -238,7 +238,7 @@ private bool LayoutHorizontal() for (int j = -1; j < toolStrip.Items.Count; j++) { - ToolStripItem? item = null; + ToolStripItem? item; if (j == -1) { @@ -284,7 +284,7 @@ private bool LayoutHorizontal() // In RTL.No, Head is to the Left, Tail is to the Right if (item.Placement == ToolStripItemPlacement.Main) { - int x = _displayRectangle.Left; + int x; int y = _displayRectangle.Top; Padding itemMargin = item.Margin; @@ -358,7 +358,7 @@ private bool LayoutVertical() int lastBottom = _displayRectangle.Bottom; int lastTop = _displayRectangle.Top; bool needsMoreSpace = false; - Size itemSize = Size.Empty; + Size itemSize; Rectangle alignedLeftItems = Rectangle.Empty; Rectangle alignedRightItems = Rectangle.Empty; @@ -380,7 +380,7 @@ private bool LayoutVertical() for (int j = -1; j < ToolStrip.Items.Count; j++) { - ToolStripItem? item = null; + ToolStripItem? item; if (j == -1) { @@ -428,7 +428,7 @@ private bool LayoutVertical() { Padding itemMargin = item.Margin; int x = _displayRectangle.Left + itemMargin.Left; - int y = _displayRectangle.Top; + int y; switch (item.Alignment) { @@ -491,7 +491,7 @@ private void SetItemLocation(ToolStripItem item, Point itemLocation, Size itemSi { // overflow buttons can be placed outside the display rect. bool horizontal = (ToolStrip.LayoutStyle == ToolStripLayoutStyle.HorizontalStackWithOverflow); - Rectangle displayRect = _displayRectangle; + Rectangle itemBounds = new(itemLocation, itemSize); // in horizontal if something bleeds over the top/bottom that's ok - its left/right we care about diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/UpDown/DomainUpDown.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/UpDown/DomainUpDown.cs index 495f8d6caab..909fb2ae881 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/UpDown/DomainUpDown.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/UpDown/DomainUpDown.cs @@ -285,7 +285,7 @@ internal int MatchIndex(string text, bool complete, int startPosition) // otherwise returns -1. int index = startPosition; int matchIndex = -1; - bool found = false; + bool found; if (!complete) { @@ -295,14 +295,10 @@ internal int MatchIndex(string text, bool complete, int startPosition) // Attempt to match the string with Items[index] do { - if (complete) - { - found = Items[index]!.ToString()!.Equals(text); - } - else - { - found = Items[index]!.ToString()!.ToUpper(CultureInfo.InvariantCulture).StartsWith(text, StringComparison.Ordinal); - } + found = complete + ? Items[index]!.ToString()!.Equals(text) + : Items[index]!.ToString()!.ToUpper(CultureInfo.InvariantCulture) + .StartsWith(text, StringComparison.Ordinal); if (found) { @@ -386,8 +382,6 @@ private void SelectIndex(int index) Debug.Assert(index < _domainItems.Count && index >= -1, "SelectValue: index out of range"); if (_domainItems is null || index < -1 || index >= _domainItems.Count) { - // Defensive programming - index = -1; return; } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/DataBinding/Binding.cs b/src/System.Windows.Forms/src/System/Windows/Forms/DataBinding/Binding.cs index d61c3fd3af3..2a04bda3885 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/DataBinding/Binding.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/DataBinding/Binding.cs @@ -963,7 +963,7 @@ internal bool PullData(bool reformat, bool force) internal bool PushData(bool force) { - object? dataSourceValue = null; + object? dataSourceValue; Exception? lastException = null; // Don't push if update mode is 'Never' (unless caller is FORCING us to push) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/DataBinding/BindingSource.cs b/src/System.Windows.Forms/src/System/Windows/Forms/DataBinding/BindingSource.cs index 0ab4535ff76..a08ef2824dc 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/DataBinding/BindingSource.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/DataBinding/BindingSource.cs @@ -891,7 +891,7 @@ private void ParentCurrencyManager_CurrentItemChanged(object? sender, EventArgs CurrencyManager cm = (CurrencyManager)sender!; // track if the current list changed - bool currentItemChanged = true; + bool currentItemChanged; if (!string.IsNullOrEmpty(_dataMember)) { @@ -1458,7 +1458,7 @@ public virtual int Count public virtual int Add(object? value) { - int ret = -1; + int position; // Special case: If no data source has been assigned, the inner list will just // be an empty un-typed binding list. @@ -1479,9 +1479,9 @@ public virtual int Add(object? value) throw new InvalidOperationException(SR.BindingSourceItemTypeIsValueType); } - ret = List.Add(value); - OnSimpleListChanged(ListChangedType.ItemAdded, ret); - return ret; + position = List.Add(value); + OnSimpleListChanged(ListChangedType.ItemAdded, position); + return position; } public virtual void Clear() @@ -1513,7 +1513,8 @@ public virtual void Remove(object? value) public virtual void RemoveAt(int index) { - object? value = ((IList)this)[index]; + // Virtual, need to call for compat. + _ = this[index]; List.RemoveAt(index); OnSimpleListChanged(ListChangedType.ItemDeleted, index); } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/DataBinding/ListBindingHelper.cs b/src/System.Windows.Forms/src/System/Windows/Forms/DataBinding/ListBindingHelper.cs index 5d56a4ff76b..8291e405f4e 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/DataBinding/ListBindingHelper.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/DataBinding/ListBindingHelper.cs @@ -152,7 +152,7 @@ public static PropertyDescriptorCollection GetListItemProperties(object? list, P { return GetListItemProperties(list); } - else if (list is Type type) + else if (list is Type) { return GetListItemPropertiesByType(listAccessors, 0); } @@ -344,7 +344,7 @@ private static string GetListNameFromType(Type type) private static PropertyDescriptorCollection GetListItemPropertiesByType(PropertyDescriptor[] listAccessors, int startIndex) { - PropertyDescriptorCollection? pdc = null; + PropertyDescriptorCollection? pdc; if (listAccessors[startIndex] is null) { return new PropertyDescriptorCollection(null); @@ -380,8 +380,9 @@ private static PropertyDescriptorCollection GetListItemPropertiesByType(Property private static PropertyDescriptorCollection GetListItemPropertiesByEnumerable(IEnumerable iEnumerable, PropertyDescriptor[] listAccessors, int startIndex) { - PropertyDescriptorCollection? pdc = null; + PropertyDescriptorCollection? pdc; object? subList = null; + // Walk down the tree - first try and get the value // This is tricky, because we can't do a standard GetValue - we need an instance of one of the // items in the list. diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Internal/Formatter.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Internal/Formatter.cs index c19765724a3..a0724a11370 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Internal/Formatter.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Internal/Formatter.cs @@ -244,9 +244,7 @@ internal static class Formatter object? formattedNullValue, object? dataSourceNullValue) { - // // Strip away any use of nullable types (eg. Nullable), leaving just the 'real' types - // Type oldTargetType = targetType; @@ -255,25 +253,14 @@ internal static class Formatter sourceConverter = NullableUnwrap(sourceConverter); targetConverter = NullableUnwrap(targetConverter); - bool isNullableTargetType = (targetType != oldTargetType); - - // // Call the 'real' method to perform the conversion - // object? result = ParseObjectInternal(value, targetType, sourceType, targetConverter, sourceConverter, formatInfo, formattedNullValue); - // // On the way out, substitute DBNull with the appropriate representation of 'null' for the final target type. // For most types, this is just DBNull. But for a nullable type, its an instance of that type with no value. - // - - if (result == DBNull.Value) - { - return NullData(oldTargetType, dataSourceNullValue); - } - return result; + return result == DBNull.Value ? NullData(oldTargetType, dataSourceNullValue) : result; } /// diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Layout/ArrangedElement.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Layout/ArrangedElement.cs index fa1df952830..529017873e0 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Layout/ArrangedElement.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Layout/ArrangedElement.cs @@ -161,10 +161,7 @@ public virtual void PerformLayout(IArrangedElement container, string? propertyNa OnLayout(new LayoutEventArgs(container, propertyName)); } - protected virtual void OnLayout(LayoutEventArgs e) - { - bool parentNeedsLayout = LayoutEngine.Layout(this, e); - } + protected virtual void OnLayout(LayoutEventArgs e) => LayoutEngine.Layout(this, e); protected virtual void OnBoundsChanged(Rectangle oldBounds, Rectangle newBounds) { diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Layout/CommonProperties.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Layout/CommonProperties.cs index 38b3857a584..fada2341603 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Layout/CommonProperties.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Layout/CommonProperties.cs @@ -148,16 +148,11 @@ internal static Padding GetPadding(IArrangedElement element, Padding defaultPadd /// See . /// /// - internal static Rectangle GetSpecifiedBounds(IArrangedElement element) - { - if (element.Properties.TryGetValue(s_specifiedBoundsProperty, out Rectangle rectangle) - && rectangle != LayoutUtils.s_maxRectangle) - { - return rectangle; - } - - return element.Bounds; - } + internal static Rectangle GetSpecifiedBounds(IArrangedElement element) => + element.Properties.TryGetValue(s_specifiedBoundsProperty, out Rectangle rectangle) + && rectangle != LayoutUtils.s_maxRectangle + ? rectangle + : element.Bounds; /// /// Clears out the padding from the property store. diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Layout/Containers/ContainerControl.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Layout/Containers/ContainerControl.cs index 5dfd0a9655b..bb9e51d2b85 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Layout/Containers/ContainerControl.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Layout/Containers/ContainerControl.cs @@ -319,7 +319,7 @@ public SizeF CurrentAutoScaleDimensions internal SizeF GetCurrentAutoScaleDimensions(HFONT fontHandle) { - var currentAutoScaleDimensions = SizeF.Empty; + SizeF currentAutoScaleDimensions; switch (AutoScaleMode) { case AutoScaleMode.Font: diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Layout/DefaultLayout.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Layout/DefaultLayout.cs index 27f18a76b46..dd9461f611d 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Layout/DefaultLayout.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Layout/DefaultLayout.cs @@ -633,7 +633,7 @@ private static bool TryCalculatePreferredSize(IArrangedElement container, bool m } Size preferredSizeForDocking = Size.Empty; - Size preferredSizeForAnchoring = Size.Empty; + Size preferredSizeForAnchoring; if (dock) { diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Layout/FlowLayout.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Layout/FlowLayout.cs index c0058623770..74a8f2c10a4 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Layout/FlowLayout.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Layout/FlowLayout.cs @@ -116,7 +116,7 @@ private static void LayoutRow( int endIndex, Rectangle rowBounds) { - Size outSize = TryCalculatePreferredSizeRow( + TryCalculatePreferredSizeRow( containerProxy, elementProxy, startIndex, @@ -124,6 +124,7 @@ private static void LayoutRow( rowBounds, breakIndex: out int dummy, measureOnly: false); + Debug.Assert(dummy == endIndex, "EndIndex / BreakIndex mismatch."); } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Layout/TableLayout.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Layout/TableLayout.cs index 37e3d6942d6..e7f6249b574 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Layout/TableLayout.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Layout/TableLayout.cs @@ -416,7 +416,7 @@ private static bool xAssignRowsAndColumns(ContainerInfo containerInfo, LayoutInf // try to layout the absolutely positioned element as if it were non-absolutely positioned. // In this way we can tell whether this element overlaps with others or fits on the table. - AdvanceUntilFits(maxColumns, reservationGrid, fixedElement, out colStop); + AdvanceUntilFits(maxColumns, reservationGrid, fixedElement, out _); // we have exceeded the row limit. just return if (fixedElement.RowStart >= maxRows) @@ -715,7 +715,9 @@ private static int InflateColumns(ContainerInfo containerInfo, Size proposedCons // since InitializeStrips already allocated absolutely sized columns, we can skip over them if (columnSpan > 1 || !IsAbsolutelySized(layoutInfo.ColumnStart, containerInfo.ColumnStyles)) { - int minWidth = 0, maxWidth = 0; + int minWidth; + int maxWidth; + // optimize for the case where one of the parameters is known. if ((columnSpan == 1 && layoutInfo.RowSpan == 1) && (IsAbsolutelySized(layoutInfo.RowStart, containerInfo.RowStyles))) @@ -1080,13 +1082,11 @@ private static int DistributeStyles(int cellBorderWidth, TableLayoutStyleCollect // If there's space left over, then give it to the percentage columns/rows totalPercentAllocatedSpace += remainingSpace; } - else if (remainingSpace < 0) { // If there's not enough space, then remove space from the percentage columns. // We do this by recalculating the space available. totalPercentAllocatedSpace = maxSize - totalAbsoluteAndAutoSizeAllocatedSpace - (strips.Length * cellBorderWidth); - remainingSpace = 0; } // in this case the strips fill up the remaining space. @@ -1178,7 +1178,6 @@ private static void SetElementBounds(ContainerInfo containerInfo, RectangleF dis int currentCol = 0; int currentRow = 0; bool isContainerRTL = false; - Rectangle displayRect = Rectangle.Truncate(displayRectF); if (containerInfo.Container is Control containerAsControl) { diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Printing/PrintPreviewControl.PrintPreviewControlAccessibleObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Printing/PrintPreviewControl.PrintPreviewControlAccessibleObject.cs index c96849ddb03..9e1ea18194b 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Printing/PrintPreviewControl.PrintPreviewControlAccessibleObject.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Printing/PrintPreviewControl.PrintPreviewControlAccessibleObject.cs @@ -99,7 +99,7 @@ HRESULT IScrollProvider.Interface.Scroll(ScrollAmount horizontalAmount, ScrollAm return HRESULT.E_FAIL; } - int scrollValue = 0; + int scrollValue; if (owner._hScrollBar.Visible && horizontalAmount != ScrollAmount.ScrollAmount_NoAmount) { switch (horizontalAmount) @@ -156,7 +156,7 @@ HRESULT IScrollProvider.Interface.SetScrollPercent(double horizontalPercent, dou return HRESULT.E_FAIL; } - int scrollValue = 0; + int scrollValue; if (owner._hScrollBar.Visible && horizontalPercent >= 0 && horizontalPercent <= 100) { scrollValue = owner._hScrollBar.Minimum + (int)((owner._hScrollBar.Maximum - owner._hScrollBar.Minimum) * horizontalPercent); diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/Application.ParkingWindowTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/Application.ParkingWindowTests.cs index 693c51d360e..80c6ca2b2d1 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/Application.ParkingWindowTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/Application.ParkingWindowTests.cs @@ -34,7 +34,7 @@ public void ParkingWindow_DoesNotThrowOnGarbageCollecting() Assert.Equal(RemoteExecutor.SuccessExitCode, invokerHandle.ExitCode); } - private Form InitFormWithControlToGarbageCollect() + private static Form InitFormWithControlToGarbageCollect() { Form form = new(); ComboBox comboBox = new() @@ -51,9 +51,6 @@ private Form InitFormWithControlToGarbageCollect() // Recreate ComboBox handle to set parent to ParkingWindow. comboBox.DropDownStyle = ComboBoxStyle.DropDownList; - // Lose the reference to ComboBox to allow Garbage collecting ComboBox. - comboBox = null; - return form; } diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/AxHostTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/AxHostTests.cs index 27ed2023e5b..6ce1b26c015 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/AxHostTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/AxHostTests.cs @@ -1703,7 +1703,7 @@ public unsafe void AxHost_GetIPictureFromPicture_InvokeEnhancedMetafile_Roundtri iPicture.get_Width(out int width).ThrowOnFailure(); iPicture.get_Height(out int height).ThrowOnFailure(); iPicture.get_Attributes(out uint attributes).ThrowOnFailure(); - iPicture.get_CurDC(out HDC hdc).Should().Be(HRESULT.E_FAIL); + iPicture.get_CurDC(out HDC _).Should().Be(HRESULT.E_FAIL); Assert.NotEqual(0u, handle); Assert.True(iPicture.get_hPal(out _).Failed); @@ -3115,17 +3115,17 @@ private class NoSuchAttribute : Attribute { } - [CustomAttribute] + [Custom] private class CustomAxHost : AxHost { public CustomAxHost(string clsid) : base(clsid) { } - [CustomAttribute] + [Custom] public event EventHandler CustomEvent; - [CustomAttribute] + [Custom] public string CustomProperty { get; set; } } diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BindingContextTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BindingContextTests.cs index 4ac6d1ea272..491e4be601f 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BindingContextTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BindingContextTests.cs @@ -756,7 +756,6 @@ public void BindingContext_CollectionChanged_Remove_Nop() public void BindingContext_OnCollectionChanged_Invoke_Nop() { SubBindingContext context = new(); - CollectionChangeEventHandler handler = (sender, e) => { }; context.OnCollectionChanged(null); } diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ComboBox.ComboBoxChildNativeWindowTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ComboBox.ComboBoxChildNativeWindowTests.cs index 8aa1b2c69af..3ffd865ff78 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ComboBox.ComboBoxChildNativeWindowTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ComboBox.ComboBoxChildNativeWindowTests.cs @@ -16,6 +16,7 @@ public void ComboBoxChildNativeWindow_GetChildAccessibleObject() foreach (object childWindowType in Enum.GetValues(childWindowTypeEnum)) { + childNativeWindow.TestAccessor().Dynamic._childWindowType = childWindowType; Assert.True(childNativeWindow.TestAccessor().Dynamic.GetChildAccessibleObject() is ComboBox.ChildAccessibleObject); } } diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewCellStyleTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewCellStyleTests.cs index f5bb1330b10..404fb1252c1 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewCellStyleTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewCellStyleTests.cs @@ -77,7 +77,6 @@ public void DataGridViewCellStyle_Ctor_NonEmptyDataGridViewCellStyle_Success() [Fact] public void DataGridViewCellStyle_Ctor_EmptyDataGridViewCellStyle_Success() { - NumberFormatInfo formatProvider = new(); DataGridViewCellStyle source = new(); DataGridViewCellStyle style = new(source); @@ -746,7 +745,6 @@ public void DataGridViewCellStyle_Clone_NonEmptyDataGridViewCellStyle_Success() [Fact] public void DataGridViewCellStyle_Clone_EmptyDataGridViewCellStyle_Success() { - NumberFormatInfo formatProvider = new(); DataGridViewCellStyle source = new(); DataGridViewCellStyle style = source.Clone(); @@ -813,7 +811,6 @@ public void DataGridViewCellStyle_ICloneableClone_NonEmptyDataGridViewCellStyle_ [Fact] public void DataGridViewCellStyle_ICloneableClone_EmptyDataGridViewCellStyle_Success() { - NumberFormatInfo formatProvider = new(); ICloneable source = new DataGridViewCellStyle(); DataGridViewCellStyle style = Assert.IsType(source.Clone()); diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewHeaderCellTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewHeaderCellTests.cs index 30ede7d2dcc..60e988686f9 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewHeaderCellTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewHeaderCellTests.cs @@ -1015,11 +1015,8 @@ public static IEnumerable Resizable_GetTopLeftHeaderCell_TestData() { foreach (DataGridViewRowHeadersWidthSizeMode rowHeadersWidthSizeMode in Enum.GetValues(typeof(DataGridViewRowHeadersWidthSizeMode))) { - foreach (DataGridViewTriState rowResizable in Enum.GetValues(typeof(DataGridViewTriState))) - { - bool expected = columnHeadersHeightSizeMode == DataGridViewColumnHeadersHeightSizeMode.EnableResizing || rowHeadersWidthSizeMode == DataGridViewRowHeadersWidthSizeMode.EnableResizing; - yield return new object[] { columnHeadersHeightSizeMode, rowHeadersWidthSizeMode, expected }; - } + bool expected = columnHeadersHeightSizeMode == DataGridViewColumnHeadersHeightSizeMode.EnableResizing || rowHeadersWidthSizeMode == DataGridViewRowHeadersWidthSizeMode.EnableResizing; + yield return new object[] { columnHeadersHeightSizeMode, rowHeadersWidthSizeMode, expected }; } } } diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ListViewSubItemCollectionTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ListViewSubItemCollectionTests.cs index 6fd19519217..fc1f116d123 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ListViewSubItemCollectionTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ListViewSubItemCollectionTests.cs @@ -227,7 +227,6 @@ public void ListViewSubItemCollection_Add_ListViewSubItemExistsInOtherCollection ListViewItem item = new(); var collection = new ListViewItem.ListViewSubItemCollection(item); - ListViewItem otherItem = new(); var otherCollection = new ListViewItem.ListViewSubItemCollection(item); var subItem = new ListViewItem.ListViewSubItem(); diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ListViewSubItemTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ListViewSubItemTests.cs index 56882777287..03736649527 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ListViewSubItemTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ListViewSubItemTests.cs @@ -30,7 +30,6 @@ public static IEnumerable Ctor_ListViewItem_String_TestData() yield return new object[] { new ListViewItem(), "reasonable", "reasonable" }; yield return new object[] { new ListViewItem() { BackColor = Color.Yellow, ForeColor = Color.Yellow, Font = SystemFonts.StatusFont }, "reasonable", "reasonable" }; - ListView listView = new(); ListViewItem item = new(); Assert.Null(item.ListView); yield return new object[] { item, "reasonable", "reasonable" }; diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/PropertyManagerTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/PropertyManagerTests.cs index bbc02406d44..262a75e9c32 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/PropertyManagerTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/PropertyManagerTests.cs @@ -24,7 +24,6 @@ public void PropertyManager_Ctor_Default() public void PropertyManager_Position_Set_Nop(int value) { BindingContext context = []; - BindingSource source = []; PropertyManager manager = Assert.IsType(context[new DataSource()]); manager.Position = value; Assert.Equal(0, manager.Position); @@ -34,7 +33,6 @@ public void PropertyManager_Position_Set_Nop(int value) public void PropertyManager_GetListName_Invoke_ReturnsEmpty() { BindingContext context = []; - BindingSource source = []; PropertyManager manager = Assert.IsType(context[new DataSource()]); Assert.Equal("System.Windows.Forms.Tests.PropertyManagerTests+DataSource.", manager.GetListName()); Assert.Empty(manager.GetListName(null)); diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ScrollableControlTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ScrollableControlTests.cs index ad26ad877bf..e2afe514a2d 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ScrollableControlTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ScrollableControlTests.cs @@ -1385,7 +1385,7 @@ public void ScrollableControl_GetTopLevel_Invoke_ReturnsExpected() public static IEnumerable OnLayout_TestData() { // The control must be passed along as separate variable in order to be disposed properly. - Control affectedControl = null; + Control affectedControl; yield return new object[] { true, null, 1, null }; yield return new object[] { true, new LayoutEventArgs(null, null), 1, null }; diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ToolTipBufferTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ToolTipBufferTests.cs index e398d3fd20f..b56d1a2f9bb 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ToolTipBufferTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ToolTipBufferTests.cs @@ -49,7 +49,6 @@ public void ToolTipBuffer_SetTextLonger_Success(string longer) { ToolTipBuffer buffer = default; buffer.SetText("text"); - IntPtr memory1 = buffer.Buffer; Assert.Equal("text", Marshal.PtrToStringUni(buffer.Buffer)); // Set longer. diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/WebBrowserTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/WebBrowserTests.cs index cb101068b20..35f63a118ed 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/WebBrowserTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/WebBrowserTests.cs @@ -2300,7 +2300,7 @@ public void WebBrowser_WebBrowserShortcutsEnabled_SetWithInstance_GetReturnsExpe [WinFormsFact] public void WebBrowser_AttachInterfaces_Invoke_Success() { - object nativeActiveXObject = null; + object nativeActiveXObject; try { @@ -2334,7 +2334,7 @@ public void WebBrowser_AttachInterfaces_Invoke_Success() [WinFormsFact] public void WebBrowser_AttachInterfaces_InvokeWithInstance_Success() { - object nativeActiveXObject = null; + object nativeActiveXObject; try { From ac8b7609d7b4afb768db1bccf40cd0b3eb30f562 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 23 Nov 2024 13:36:07 +0000 Subject: [PATCH 046/106] [main] Update dependencies from dotnet/runtime (#12536) [main] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 58 ++++++------- global.json | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 74d5b62b7d4..44edd01264c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 - + https://github.com/dotnet/runtime - 4389f9c54d070ca5e0cf7c4931aff56fe36d667f + f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 diff --git a/eng/Versions.props b/eng/Versions.props index 4c4a3955ebe..1a0c86140d1 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 - 10.0.0-alpha.1.24572.1 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24572.8 diff --git a/global.json b/global.json index cb4aca86e5c..f39d6038d32 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24570.4", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24570.4", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24572.1" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24572.8" }, "native-tools": { "cmake": "latest" From e91e3bc158717736dc2c5d3ebfa8b6463ef88487 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 24 Nov 2024 13:36:36 +0000 Subject: [PATCH 047/106] [main] Update dependencies from dotnet/arcade (#12537) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 24 ++++++++++++------------ eng/Versions.props | 6 +++--- global.json | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 44edd01264c..516f269de50 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -191,29 +191,29 @@ Note: if the Uri is a new place, you will need to add a subscription from that p - + https://github.com/dotnet/arcade - 0c8f4989db0251f49a4f37d1b35bf4da1e9d6415 + 7d955f9f470465e144c76d47fd2596a0e4c02a21 - + https://github.com/dotnet/arcade - 0c8f4989db0251f49a4f37d1b35bf4da1e9d6415 + 7d955f9f470465e144c76d47fd2596a0e4c02a21 - + https://github.com/dotnet/arcade - 0c8f4989db0251f49a4f37d1b35bf4da1e9d6415 + 7d955f9f470465e144c76d47fd2596a0e4c02a21 - + https://github.com/dotnet/arcade - 0c8f4989db0251f49a4f37d1b35bf4da1e9d6415 + 7d955f9f470465e144c76d47fd2596a0e4c02a21 - + https://github.com/dotnet/arcade - 0c8f4989db0251f49a4f37d1b35bf4da1e9d6415 + 7d955f9f470465e144c76d47fd2596a0e4c02a21 - + https://github.com/dotnet/arcade - 0c8f4989db0251f49a4f37d1b35bf4da1e9d6415 + 7d955f9f470465e144c76d47fd2596a0e4c02a21 diff --git a/eng/Versions.props b/eng/Versions.props index 1a0c86140d1..fe5f76679b4 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -56,9 +56,9 @@ - 10.0.0-beta.24570.4 - 10.0.0-beta.24570.4 - 10.0.0-beta.24570.4 + 10.0.0-beta.24572.3 + 10.0.0-beta.24572.3 + 10.0.0-beta.24572.3 17.4.0-preview-20220707-01 diff --git a/global.json b/global.json index f39d6038d32..386875c92fa 100644 --- a/global.json +++ b/global.json @@ -14,9 +14,9 @@ "version": "9.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24570.4", - "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24570.4", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24570.4", + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24572.3", + "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24572.3", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24572.3", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24572.8" }, From a4893ffd1bc76871ef153d3725a633296dc4f95b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:36:11 +0000 Subject: [PATCH 048/106] [main] Update dependencies from dotnet/runtime (#12541) [main] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 58 ++++++------- global.json | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 516f269de50..328737e7467 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f - + https://github.com/dotnet/runtime - f1332ab0d82ee0e21ca387cbd1c8a87c5dfa4906 + 53cc1ddeec661d03d65d0e2949f3486e2162d80f diff --git a/eng/Versions.props b/eng/Versions.props index fe5f76679b4..9facb92aff2 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 - 10.0.0-alpha.1.24572.8 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24575.1 diff --git a/global.json b/global.json index 386875c92fa..e9acd42aebf 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24572.3", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24572.3", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24572.8" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24575.1" }, "native-tools": { "cmake": "latest" From 6031f36aaccd19faa4e53cd3c44984914d237e6b Mon Sep 17 00:00:00 2001 From: Paul M Cohen Date: Tue, 26 Nov 2024 05:51:08 +1200 Subject: [PATCH 049/106] Reennable test broken in Merge and fix developer usability issues (#12507) * Rennable test broken in Merge. Stop ProgressDialog and VBInputBox from opening in designer which will fail. Fix missing return in Interaction.vb * More cleanup of comments and formatting from Merge issues * More cleanup * Fix logic and comments around CreateTempDirectory Update tests --- ...FormsApplicationBase.WinFormsAppContext.vb | 17 +++-- .../WindowsFormsApplicationBase.vb | 64 ++++++++++++------- .../VisualBasic/Devices/Network.Ping.vb | 11 ++-- .../VisualBasic/Devices/Network.UploadFile.vb | 8 +-- .../VisualBasic/Devices/NetworkUtilities.vb | 4 +- .../VisualBasic/Helpers/VBInputBox.vb | 1 + .../src/Microsoft/VisualBasic/Interaction.vb | 2 +- .../MyServices/Internal/ProgressDialog.vb | 2 + .../MyServices/Internal/WebClientCopy.vb | 23 ++++--- .../ApplicationServicesExceptionsTests.vb | 4 +- .../Windows/Forms/UserTests.UserPrincipal.vb | 7 +- .../Forms/VbFileCleanupTestBaseTests.vb | 6 +- .../Forms/WindowsFormsApplicationBaseTests.vb | 1 + .../TestUtilities/VbFileCleanupTestBase.vb | 2 +- 14 files changed, 91 insertions(+), 61 deletions(-) diff --git a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBase.WinFormsAppContext.vb b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBase.WinFormsAppContext.vb index 33f2e9ef756..d395e93e04e 100644 --- a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBase.WinFormsAppContext.vb +++ b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBase.WinFormsAppContext.vb @@ -39,15 +39,20 @@ Namespace Microsoft.VisualBasic.ApplicationServices Protected Overrides Sub OnMainFormClosed(sender As Object, e As EventArgs) If _app.ShutdownStyle = ShutdownMode.AfterMainFormCloses Then MyBase.OnMainFormClosed(sender, e) - Else 'identify a new main form so we can keep running + Else ' identify a new main form so we can keep running Dim forms As FormCollection = Application.OpenForms If forms.Count > 0 Then - 'Note: Initially I used Process::MainWindowHandle to obtain an open form. But that is bad for two reasons: - '1 - It appears to be broken and returns NULL sometimes even when there is still a window around. WinForms people are looking at that issue. - '2 - It returns the first window it hits from enum thread windows, which is not necessarily a windows forms form, so that doesn't help us even if it did work - 'all the time. So I'll use one of our open forms. We may not necessarily get a visible form here but that's OK. Some apps may run on an invisible window - 'and we need to keep them going until all windows close. + ' Note: Initially I used Process::MainWindowHandle to obtain an open form. + ' But that is bad for two reasons: + ' 1 - It appears to be broken and returns NULL sometimes even when + ' there is still a window around WinForms people are looking at that issue. + ' 2 - It returns the first window it hits from enum thread windows, + ' which is not necessarily a windows forms form, so that doesn't help + ' us even if it did work all the time. So I'll use one of our open forms. + ' We may not necessarily get a visible form here but that's OK. + ' Some apps may run on an invisible window and we need to keep them going + ' until all windows close. MainForm = forms(0) Else MyBase.OnMainFormClosed(sender, e) diff --git a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBase.vb b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBase.vb index da8e9275442..9ee86a368fe 100644 --- a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBase.vb +++ b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBase.vb @@ -154,11 +154,13 @@ Namespace Microsoft.VisualBasic.ApplicationServices ' have our principal on the thread before that happens. If authenticationMode = AuthenticationMode.Windows Then Try - ' Consider: Sadly, a call to: System.Security.SecurityManager.IsGranted(New SecurityPermission(SecurityPermissionFlag.ControlPrincipal)) + ' Consider: Sadly, a call to: + ' Security.SecurityManager.IsGranted(New SecurityPermission(SecurityPermissionFlag.ControlPrincipal)) ' Will only check the THIS caller so you'll always get TRUE. ' What we need is a way to get to the value of this on a demand basis. ' So I try/catch instead for now but would rather be able to IF my way around this block. - Thread.CurrentPrincipal = New Principal.WindowsPrincipal(Principal.WindowsIdentity.GetCurrent) + Dim ntIdentity As Principal.WindowsIdentity = Principal.WindowsIdentity.GetCurrent + Thread.CurrentPrincipal = New Principal.WindowsPrincipal(ntIdentity) Catch ex As SecurityException End Try End If @@ -286,7 +288,8 @@ Namespace Microsoft.VisualBasic.ApplicationServices ' Allow for the case where they set splash screen = nothing and mainForm is currently nothing. If value IsNot Nothing AndAlso value Is _appContext.MainForm Then - Throw New ArgumentException(VbUtils.GetResourceString(SR.AppModel_SplashAndMainFormTheSame)) + Dim message As String = VbUtils.GetResourceString(SR.AppModel_SplashAndMainFormTheSame) + Throw New ArgumentException(message) End If _splashScreen = value @@ -382,7 +385,8 @@ Namespace Microsoft.VisualBasic.ApplicationServices _unhandledExceptionHandlers.Add(value) - ' Only add the listener once so we don't fire the UnHandledException event over and over for the same exception + ' Only add the listener once so we don't fire the + ' UnHandledException event over and over for the same exception If _unhandledExceptionHandlers.Count = 1 Then AddHandler Application.ThreadException, AddressOf OnUnhandledExceptionEventAdaptor End If @@ -583,7 +587,7 @@ Namespace Microsoft.VisualBasic.ApplicationServices _formLoadWaiter = New AutoResetEvent(False) Task.Run(Async Function() As Task - Await _splashScreenCompletionSource.Task.ConfigureAwait(False) + Await _splashScreenCompletionSource.Task.ConfigureAwait(continueOnCapturedContext:=False) _formLoadWaiter.Set() End Function) @@ -605,7 +609,7 @@ Namespace Microsoft.VisualBasic.ApplicationServices If _splashTimer IsNot Nothing Then - 'We only have a timer if there was a minimum timeout on the splash screen. + ' We only have a timer if there was a minimum timeout on the splash screen. _splashTimer.Dispose() _splashTimer = Nothing End If @@ -677,7 +681,7 @@ Namespace Microsoft.VisualBasic.ApplicationServices Protected Sub HideSplashScreen() - 'This ultimately wasn't necessary. I suppose we better keep it for backwards compatibility. + ' This ultimately wasn't necessary. I suppose we better keep it for backwards compatibility. SyncLock _splashLock ' .NET Framework 4.0 (Dev10 #590587) - we now activate the main form before calling @@ -718,7 +722,11 @@ Namespace Microsoft.VisualBasic.ApplicationServices ''' variants was passed in. ''' ''' - ''' Returning True indicates that we should continue on with the application Startup sequence. + ''' + ''' Returning + ''' Indicates that we should continue on with the application Startup sequence. + ''' + ''' ''' ''' This extensibility point is exposed for people who want to override ''' the Startup sequence at the earliest possible point to @@ -819,26 +827,29 @@ Namespace Microsoft.VisualBasic.ApplicationServices End If ' When we have a splash screen that hasn't timed out before the main form is ready to paint, we want to - ' block the main form from painting. To do that I let the form get past the Load() event and hold it until - ' the splash screen goes down. Then I let the main form continue it's startup sequence. The ordering of - ' Form startup events for reference is: Ctor(), Load Event, Layout event, Shown event, Activated event, Paint event. + ' block the main form from painting. To do that I let the form get past the Load() event and + ' hold it until the splash screen goes down. Then I let the main form continue it's startup sequence. + ' The ordering of Form startup events for reference is: + ' Ctor(), Load Event, Layout event, Shown event, Activated event, Paint event. AddHandler MainForm.Load, AddressOf MainFormLoadingDone End If ' Run() eats all exceptions (unless running under the debugger). If the user wrote an ' UnhandledException handler we will hook the System.Windows.Forms.Application.ThreadException event ' (see Public Custom Event UnhandledException) which will raise our UnhandledException Event. - ' If our user didn't write an UnhandledException event, then we land in the try/catch handler for Forms.Application.Run(). + ' If our user didn't write an UnhandledException event, then we land in the try/catch handler + ' for Forms.Application.Run(). Try Application.Run(_appContext) Finally - ' When Run() returns, the context we pushed in our ctor (which was a WindowsFormsSynchronizationContext) - ' is restored. But we are going to dispose it so we need to disconnect the network listener so that it + ' When Run() returns, the context we pushed in our ctor + ' (which was a WindowsFormsSynchronizationContext) is restored. + ' But we are going to dispose it so we need to disconnect the network listener so that it ' can't fire any events in response to changing network availability conditions through a dead context. If _networkObject IsNot Nothing Then _networkObject.DisconnectListener() - 'Restore the prior sync context. + ' Restore the prior sync context. AsyncOperationManager.SynchronizationContext = _appSynchronizationContext _appSynchronizationContext = Nothing End Try @@ -866,11 +877,12 @@ Namespace Microsoft.VisualBasic.ApplicationServices ' The timing is important because the network object has an AsyncOperationsManager in it that marshals ' the network changed event to the main thread. The asyncOperationsManager does a CreateOperation() ' which makes a copy of the executionContext. That execution context shows up on your thread during - ' the callback so I delay creating the network object (and consequently the capturing of the execution context) - ' until the principal has been set on the thread. This avoids the problem where My.User isn't set - ' during the NetworkAvailabilityChanged event. This problem would just extend itself to any future - ' callback that involved the asyncOperationsManager so this is where we need to create objects that - ' have a asyncOperationsContext in them. + ' the callback so I delay creating the network object + ' (and consequently the capturing of the execution context) until the principal has been set on the thread. + ' This avoids the problem where My.User isn't set during the NetworkAvailabilityChanged event. + ' This problem would just extend itself to any future callback that involved + ' the asyncOperationsManager so this is where we need to create objects that have + ' a asyncOperationsContext in them. If _turnOnNetworkListener And _networkObject Is Nothing Then ' The is-nothing-check is to avoid hooking the object more than once. @@ -908,7 +920,10 @@ Namespace Microsoft.VisualBasic.ApplicationServices ''' that execution shouldn't continue. ''' ''' - ''' indicates the exception event was raised / it was not. + ''' + ''' indicates the exception event was raised + ''' it was not. + ''' Protected Overridable Function OnUnhandledException(e As UnhandledExceptionEventArgs) As Boolean @@ -1050,7 +1065,10 @@ Namespace Microsoft.VisualBasic.ApplicationServices Using pipeServer Dim tokenSource As New CancellationTokenSource() #Disable Warning BC42358 ' Call is not awaited. - WaitForClientConnectionsAsync(pipeServer, AddressOf OnStartupNextInstanceMarshallingAdaptor, cancellationToken:=tokenSource.Token) + WaitForClientConnectionsAsync( + pipeServer, + AddressOf OnStartupNextInstanceMarshallingAdaptor, + cancellationToken:=tokenSource.Token) #Enable Warning BC42358 DoApplicationModel() tokenSource.Cancel() @@ -1072,7 +1090,7 @@ Namespace Microsoft.VisualBasic.ApplicationServices Throw New CantStartSingleInstanceException() End Try End If - End If 'Single-Instance application + End If ' Single-Instance application End Sub End Class diff --git a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Devices/Network.Ping.vb b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Devices/Network.Ping.vb index 2d149593d59..108fd13ee4e 100644 --- a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Devices/Network.Ping.vb +++ b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Devices/Network.Ping.vb @@ -8,13 +8,13 @@ Namespace Microsoft.VisualBasic.Devices Partial Public Class Network - 'Size of Ping.exe buffer + ' Size of Ping.exe buffer Private Const BUFFER_SIZE As Integer = 32 ' Default timeout for Ping Private Const DEFAULT_PING_TIMEOUT As Integer = 1000 - 'Holds the buffer for pinging. We lazy initialize on first use + ' Holds the buffer for pinging. We lazy initialize on first use Private _pingBuffer() As Byte ''' @@ -26,9 +26,10 @@ Namespace Microsoft.VisualBasic.Devices If _pingBuffer Is Nothing Then ReDim _pingBuffer(BUFFER_SIZE - 1) For i As Integer = 0 To BUFFER_SIZE - 1 - 'This is the same logic Ping.exe uses to fill it's buffer - Dim provider As Globalization.CultureInfo = Globalization.CultureInfo.InvariantCulture - _pingBuffer(i) = Convert.ToByte(Asc("a"c) + (i Mod 23), provider) + ' This is the same logic Ping.exe uses to fill it's buffer + _pingBuffer(i) = Convert.ToByte( + value:=Asc("a"c) + (i Mod 23), + provider:=Globalization.CultureInfo.InvariantCulture) Next End If diff --git a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Devices/Network.UploadFile.vb b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Devices/Network.UploadFile.vb index f012efecd59..40ea15623a6 100644 --- a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Devices/Network.UploadFile.vb +++ b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Devices/Network.UploadFile.vb @@ -264,7 +264,7 @@ Namespace Microsoft.VisualBasic.Devices sourceFileName = FileSystemUtils.NormalizeFilePath(sourceFileName, NameOf(sourceFileName)) - 'Make sure the file exists + ' Make sure the file exists If Not IO.File.Exists(sourceFileName) Then Dim message As String = GetResourceString(SR.IO_FileNotFound_Path, sourceFileName) Throw New IO.FileNotFoundException(message) @@ -299,13 +299,13 @@ Namespace Microsoft.VisualBasic.Devices } End If - 'Create the copier + ' Create the copier Dim copier As New WebClientCopy(client, dialog) - 'Download the file + ' Download the file copier.UploadFile(sourceFileName, address) - 'Handle a dialog cancel + ' Handle a dialog cancel If showUI AndAlso Environment.UserInteractive Then If onUserCancel = UICancelOption.ThrowException And dialog.UserCanceledTheDialog Then Throw New OperationCanceledException() diff --git a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Devices/NetworkUtilities.vb b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Devices/NetworkUtilities.vb index fec0451ee24..1458e5fcefe 100644 --- a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Devices/NetworkUtilities.vb +++ b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Devices/NetworkUtilities.vb @@ -83,7 +83,9 @@ Namespace Microsoft.VisualBasic.Devices ''' We also use this function to validate the UriString (remote file address). ''' ''' The remote file address. - ''' A if successful, otherwise it throws an . + ''' + ''' A if successful, otherwise it throws an . + ''' Friend Function GetUri(address As String) As Uri Try Return New Uri(address) diff --git a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Helpers/VBInputBox.vb b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Helpers/VBInputBox.vb index 7ab88198181..0f91f6a9029 100644 --- a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Helpers/VBInputBox.vb +++ b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Helpers/VBInputBox.vb @@ -8,6 +8,7 @@ Imports System.Windows.Forms Namespace Microsoft.VisualBasic.CompilerServices + Friend NotInheritable Class VBInputBox Inherits Form diff --git a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Interaction.vb b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Interaction.vb index 5493f2dd099..a0ba0ebffaf 100644 --- a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Interaction.vb +++ b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/Interaction.vb @@ -94,7 +94,7 @@ Namespace Microsoft.VisualBasic Private Function InternalInputBox(prompt As String, title As String, defaultResponse As String, xPos As Integer, yPos As Integer, parentWindow As IWin32Window) As String Using box As New VBInputBox(prompt, title, defaultResponse, xPos, yPos) box.ShowDialog(parentWindow) - InternalInputBox = box.Output + Return box.Output End Using End Function diff --git a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/MyServices/Internal/ProgressDialog.vb b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/MyServices/Internal/ProgressDialog.vb index ce44ba26c26..db667617d18 100644 --- a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/MyServices/Internal/ProgressDialog.vb +++ b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/MyServices/Internal/ProgressDialog.vb @@ -1,6 +1,7 @@ ' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. +Imports System.ComponentModel Imports System.Drawing Imports System.Globalization Imports System.Threading @@ -11,6 +12,7 @@ Namespace Microsoft.VisualBasic.MyServices.Internal ''' ''' A dialog that shows progress used for Network.Download and Network.Upload ''' + Friend NotInheritable Class ProgressDialog Inherits Form diff --git a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/MyServices/Internal/WebClientCopy.vb b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/MyServices/Internal/WebClientCopy.vb index 203d72a44d2..5ebced7ff68 100644 --- a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/MyServices/Internal/WebClientCopy.vb +++ b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/MyServices/Internal/WebClientCopy.vb @@ -17,7 +17,8 @@ Namespace Microsoft.VisualBasic.MyServices.Internal ' The WebClient performs the downloading or uploading operations for us Private WithEvents _webClient As WebClient - 'Keeps track of the error that happened during upload/download so we can throw it once we can guarantee we are back on the main thread + ' Keeps track of the error that happened during upload/download so we can throw it + ' once we can guarantee we are back on the main thread Private _exceptionEncounteredDuringFileTransfer As Exception ' The percentage of the operation completed @@ -47,8 +48,8 @@ Namespace Microsoft.VisualBasic.MyServices.Internal ''' the actual file transfer cancel event comes through and do it there. ''' Private Sub _progressDialog_UserHitCancel() Handles _progressDialog.UserHitCancel - 'cancel the upload/download transfer. We'll close the ProgressDialog - 'as soon as the WebClient cancels the xfer. + ' Cancel the upload/download transfer. We'll close the ProgressDialog + ' as soon as the WebClient cancels the xfer. _webClient.CancelAsync() End Sub @@ -95,8 +96,8 @@ Namespace Microsoft.VisualBasic.MyServices.Internal Private Sub _webClient_UploadFileCompleted(sender As Object, e As UploadFileCompletedEventArgs) _ Handles _webClient.UploadFileCompleted - ' If the upload was interrupted by an exception, keep track of the - ' exception, which we'll throw from the main thread + ' If the upload was interrupted by an exception, keep track of the exception, + ' which we'll throw from the main thread Try If e.Error IsNot Nothing Then _exceptionEncounteredDuringFileTransfer = e.Error @@ -105,8 +106,8 @@ Namespace Microsoft.VisualBasic.MyServices.Internal InvokeIncrement(100) End If Finally - 'We don't close the dialog until we receive the - 'WebClient.DownloadFileCompleted event + ' We don't close the dialog until we receive the + ' WebClient.DownloadFileCompleted event CloseProgressDialog(_progressDialog) End Try End Sub @@ -189,14 +190,16 @@ Namespace Microsoft.VisualBasic.MyServices.Internal ' If we have a dialog we need to set up an async download If _progressDialog IsNot Nothing Then _webClient.UploadFileAsync(address, sourceFileName) - 'returns when the download sequence is over, whether due to success, error, or being canceled + + ' Returns when the download sequence is over, + ' whether due to success, error, or being canceled _progressDialog.ShowProgressDialog() Else _webClient.UploadFile(address, sourceFileName) End If - 'Now that we are back on the main thread, throw the exception we - 'encountered if the user didn't cancel. + ' Now that we are back on the main thread, throw the exception we + ' encountered if the user didn't cancel. If _exceptionEncounteredDuringFileTransfer IsNot Nothing Then If _progressDialog Is Nothing OrElse Not _progressDialog.UserCanceledTheDialog Then Throw _exceptionEncounteredDuringFileTransfer diff --git a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/ApplicationServicesExceptionsTests.vb b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/ApplicationServicesExceptionsTests.vb index 22c08968981..8a299c6934a 100644 --- a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/ApplicationServicesExceptionsTests.vb +++ b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/ApplicationServicesExceptionsTests.vb @@ -18,7 +18,7 @@ Namespace Microsoft.VisualBasic.Forms.Tests Public Sub NewCantStartSingleInstanceException() - Dim ex As Exception = New CantStartSingleInstanceException() + Dim ex As New CantStartSingleInstanceException() Dim expected As String = VbUtils.GetResourceString(SR.AppModel_SingleInstanceCantConnect) ex.Message.Should.Be(expected) @@ -35,7 +35,7 @@ Namespace Microsoft.VisualBasic.Forms.Tests Public Sub NewNoStartupFormException() - Dim ex As Exception = New NoStartupFormException() + Dim ex As New NoStartupFormException() Dim expected As String = VbUtils.GetResourceString(SR.AppModel_NoStartupForm) ex.Message.Should.Be(expected) diff --git a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/UserTests.UserPrincipal.vb b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/UserTests.UserPrincipal.vb index 3ea9f2d844e..28dd79d6c35 100644 --- a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/UserTests.UserPrincipal.vb +++ b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/UserTests.UserPrincipal.vb @@ -11,18 +11,13 @@ Namespace Microsoft.VisualBasic.Forms.Tests Implements IPrincipal Private ReadOnly _role As String - Private ReadOnly _userIdentity As IIdentity Public Sub New(authenticationType As String, name As String, isAuthenticated As Boolean, role As String) - _userIdentity = New UserIdentity(authenticationType, name, isAuthenticated) + Identity = New UserIdentity(authenticationType, name, isAuthenticated) _role = role End Sub Public ReadOnly Property Identity As IIdentity Implements IPrincipal.Identity - Get - Return _userIdentity - End Get - End Property Public Function IsInRole(role As String) As Boolean Implements IPrincipal.IsInRole Return role = _role diff --git a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/VbFileCleanupTestBaseTests.vb b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/VbFileCleanupTestBaseTests.vb index ca3a32a4b36..c5b4f5c0e26 100644 --- a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/VbFileCleanupTestBaseTests.vb +++ b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/VbFileCleanupTestBaseTests.vb @@ -12,10 +12,12 @@ Namespace Microsoft.VisualBasic.Forms.Tests Public Sub CreateTempDirectoryTest() - Dim tempDirectory As String = CreateTempDirectory() - tempDirectory.Should.StartWith(Path.GetTempPath) + CreateTempDirectory().Should.StartWith(Path.GetTempPath) CreateTempDirectory() + ' Calling CreateTempDirectory() multiple times must + ' return the one already created _testDirectories.Count.Should.Be(1) + ' If multiple sub directories are need the line number needs to be provided CreateTempDirectory(lineNumber:=1) _testDirectories.Count.Should.Be(2) End Sub diff --git a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/WindowsFormsApplicationBaseTests.vb b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/WindowsFormsApplicationBaseTests.vb index 7e1008676a2..1fec35565cf 100644 --- a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/WindowsFormsApplicationBaseTests.vb +++ b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/WindowsFormsApplicationBaseTests.vb @@ -90,6 +90,7 @@ Namespace Microsoft.VisualBasic.Forms.Tests End Using End Sub + Public Sub DoEvents_DoesNotThrow() Dim testCode As Action = Sub() DoEvents() testCode.Should.NotThrow() diff --git a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/TestUtilities/VbFileCleanupTestBase.vb b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/TestUtilities/VbFileCleanupTestBase.vb index 76ffb5b0428..72ce4a6a912 100644 --- a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/TestUtilities/VbFileCleanupTestBase.vb +++ b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/TestUtilities/VbFileCleanupTestBase.vb @@ -41,7 +41,7 @@ Namespace Microsoft.VisualBasic.Forms.Tests ''' Even if directory exists this call will success and just return it. '''
''' - ''' If >1 use line number as part of name. + ''' If >0 use line number as part of name. ''' The name of a directory that is safe to write to and is verified to exist. Friend Function CreateTempDirectory( Optional memberName As String = Nothing, Optional lineNumber As Integer = -1) As String Dim folder As String From 4ca48606e57be244096ef2f195c035dea4c066fd Mon Sep 17 00:00:00 2001 From: Tanya Solyanik Date: Mon, 25 Nov 2024 10:19:57 -0800 Subject: [PATCH 050/106] removed casts to interfaces by changing methods visibility to public (#12535) --- ...ect.Composition.NativeToWinFormsAdapter.cs | 18 ++++---- ...ject.Composition.RuntimeToNativeAdapter.cs | 43 ++++++++++--------- ...ect.Composition.WinFormsToNativeAdapter.cs | 24 ++++++----- .../Forms/OLE/DataObject.Composition.cs | 38 ++++++++-------- .../System/Windows/Forms/OLE/DataObject.cs | 38 ++++++++-------- .../Forms/RichTextBoxTests.ClipboardTests.cs | 1 - 6 files changed, 82 insertions(+), 80 deletions(-) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs index 6cb0aff2209..b327cdb7a71 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs @@ -394,8 +394,7 @@ private static unsafe string ReadUtf8StringFromHGLOBAL(HGLOBAL hglobal) } #region IDataObject - - object? IDataObject.GetData(string format, bool autoConvert) + public object? GetData(string format, bool autoConvert) { using var nativeDataObject = _nativeDataObject.GetInterface(); object? data = GetObjectFromDataObject(nativeDataObject, format, out bool doNotContinue); @@ -431,11 +430,11 @@ private static unsafe string ReadUtf8StringFromHGLOBAL(HGLOBAL hglobal) return originalData ?? data; } - object? IDataObject.GetData(string format) => ((IDataObject)this).GetData(format, autoConvert: true); + public object? GetData(string format) => GetData(format, autoConvert: true); - object? IDataObject.GetData(Type format) => ((IDataObject)this).GetData(format.FullName!); + public object? GetData(Type format) => GetData(format.FullName!); - bool IDataObject.GetDataPresent(Type format) => GetDataPresent(format.FullName!); + public bool GetDataPresent(Type format) => GetDataPresent(format.FullName!); public bool GetDataPresent(string format, bool autoConvert) { @@ -503,11 +502,10 @@ public string[] GetFormats(bool autoConvert) public string[] GetFormats() => GetFormats(autoConvert: true); - void IDataObject.SetData(string format, bool autoConvert, object? data) { } - void IDataObject.SetData(string format, object? data) { } - void IDataObject.SetData(Type format, object? data) { } - void IDataObject.SetData(object? data) { } - + public void SetData(string format, bool autoConvert, object? data) { } + public void SetData(string format, object? data) { } + public void SetData(Type format, object? data) { } + public void SetData(object? data) { } #endregion private bool GetDataPresentInner(string format) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.RuntimeToNativeAdapter.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.RuntimeToNativeAdapter.cs index 9d276de24c4..a7b876145c2 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.RuntimeToNativeAdapter.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.RuntimeToNativeAdapter.cs @@ -20,27 +20,30 @@ private class RuntimeToNativeAdapter : Com.IDataObject.Interface, ComTypes.IData public RuntimeToNativeAdapter(ComTypes.IDataObject dataObject) => _runtimeDataObject = dataObject; - int ComTypes.IDataObject.DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection) => _runtimeDataObject.DAdvise(ref pFormatetc, advf, adviseSink, out connection); - void ComTypes.IDataObject.DUnadvise(int connection) => _runtimeDataObject.DUnadvise(connection); - int ComTypes.IDataObject.EnumDAdvise(out IEnumSTATDATA? enumAdvise) => _runtimeDataObject.EnumDAdvise(out enumAdvise); - IEnumFORMATETC ComTypes.IDataObject.EnumFormatEtc(DATADIR direction) => _runtimeDataObject.EnumFormatEtc(direction); - int ComTypes.IDataObject.GetCanonicalFormatEtc(ref FORMATETC formatIn, out FORMATETC formatOut) => _runtimeDataObject.GetCanonicalFormatEtc(ref formatIn, out formatOut); - void ComTypes.IDataObject.GetData(ref FORMATETC format, out STGMEDIUM medium) => _runtimeDataObject.GetData(ref format, out medium); - void ComTypes.IDataObject.GetDataHere(ref FORMATETC format, ref STGMEDIUM medium) => _runtimeDataObject.GetDataHere(ref format, ref medium); - int ComTypes.IDataObject.QueryGetData(ref FORMATETC format) => _runtimeDataObject.QueryGetData(ref format); - void ComTypes.IDataObject.SetData(ref FORMATETC formatIn, ref STGMEDIUM medium, bool release) => _runtimeDataObject.SetData(ref formatIn, ref medium, release); - + #region ComTypes.IDataObject + public int DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection) => _runtimeDataObject.DAdvise(ref pFormatetc, advf, adviseSink, out connection); + public void DUnadvise(int connection) => _runtimeDataObject.DUnadvise(connection); + public int EnumDAdvise(out IEnumSTATDATA? enumAdvise) => _runtimeDataObject.EnumDAdvise(out enumAdvise); + public IEnumFORMATETC EnumFormatEtc(DATADIR direction) => _runtimeDataObject.EnumFormatEtc(direction); + public int GetCanonicalFormatEtc(ref FORMATETC formatIn, out FORMATETC formatOut) => _runtimeDataObject.GetCanonicalFormatEtc(ref formatIn, out formatOut); + public void GetData(ref FORMATETC format, out STGMEDIUM medium) => _runtimeDataObject.GetData(ref format, out medium); + public void GetDataHere(ref FORMATETC format, ref STGMEDIUM medium) => _runtimeDataObject.GetDataHere(ref format, ref medium); + public int QueryGetData(ref FORMATETC format) => _runtimeDataObject.QueryGetData(ref format); + public void SetData(ref FORMATETC formatIn, ref STGMEDIUM medium, bool release) => _runtimeDataObject.SetData(ref formatIn, ref medium, release); + #endregion + + #region Com.IDataObject.Interface HRESULT Com.IDataObject.Interface.DAdvise(Com.FORMATETC* pformatetc, uint advf, Com.IAdviseSink* pAdvSink, uint* pdwConnection) { var adviseSink = (IAdviseSink)ComHelpers.GetObjectForIUnknown(pAdvSink); - return (HRESULT)((ComTypes.IDataObject)this).DAdvise(ref *(FORMATETC*)pformatetc, (ADVF)advf, adviseSink, out *(int*)pdwConnection); + return (HRESULT)DAdvise(ref *(FORMATETC*)pformatetc, (ADVF)advf, adviseSink, out *(int*)pdwConnection); } HRESULT Com.IDataObject.Interface.DUnadvise(uint dwConnection) { try { - ((ComTypes.IDataObject)this).DUnadvise((int)dwConnection); + DUnadvise((int)dwConnection); } catch (Exception e) { @@ -59,7 +62,7 @@ HRESULT Com.IDataObject.Interface.EnumDAdvise(Com.IEnumSTATDATA** ppenumAdvise) *ppenumAdvise = null; - HRESULT hr = (HRESULT)((ComTypes.IDataObject)this).EnumDAdvise(out var enumAdvice); + HRESULT hr = (HRESULT)EnumDAdvise(out var enumAdvice); if (hr.Failed) { return hr; @@ -76,13 +79,13 @@ HRESULT Com.IDataObject.Interface.EnumFormatEtc(uint dwDirection, Com.IEnumFORMA return HRESULT.E_POINTER; } - var comTypeFormatEtc = ((ComTypes.IDataObject)this).EnumFormatEtc((DATADIR)(int)dwDirection); + var comTypeFormatEtc = EnumFormatEtc((DATADIR)(int)dwDirection); *ppenumFormatEtc = ComHelpers.TryGetComPointer(comTypeFormatEtc, out HRESULT hr); return hr.Succeeded ? HRESULT.S_OK : HRESULT.E_NOINTERFACE; } HRESULT Com.IDataObject.Interface.GetCanonicalFormatEtc(Com.FORMATETC* pformatectIn, Com.FORMATETC* pformatetcOut) => - (HRESULT)((ComTypes.IDataObject)this).GetCanonicalFormatEtc(ref *(FORMATETC*)pformatectIn, out *(FORMATETC*)pformatetcOut); + (HRESULT)GetCanonicalFormatEtc(ref *(FORMATETC*)pformatectIn, out *(FORMATETC*)pformatetcOut); HRESULT Com.IDataObject.Interface.GetData(Com.FORMATETC* pformatetcIn, Com.STGMEDIUM* pmedium) { @@ -93,7 +96,7 @@ HRESULT Com.IDataObject.Interface.GetData(Com.FORMATETC* pformatetcIn, Com.STGME try { - ((ComTypes.IDataObject)this).GetData(ref *(FORMATETC*)pformatetcIn, out STGMEDIUM medium); + GetData(ref *(FORMATETC*)pformatetcIn, out STGMEDIUM medium); *pmedium = (Com.STGMEDIUM)medium; return HRESULT.S_OK; } @@ -113,7 +116,7 @@ HRESULT Com.IDataObject.Interface.GetDataHere(Com.FORMATETC* pformatetc, Com.STG STGMEDIUM medium = (STGMEDIUM)(*pmedium); try { - ((ComTypes.IDataObject)this).GetDataHere(ref *(FORMATETC*)pformatetc, ref medium); + GetDataHere(ref *(FORMATETC*)pformatetc, ref medium); } catch (Exception e) { @@ -124,8 +127,7 @@ HRESULT Com.IDataObject.Interface.GetDataHere(Com.FORMATETC* pformatetc, Com.STG return HRESULT.S_OK; } - HRESULT Com.IDataObject.Interface.QueryGetData(Com.FORMATETC* pformatetc) => - (HRESULT)((ComTypes.IDataObject)this).QueryGetData(ref *(FORMATETC*)pformatetc); + HRESULT Com.IDataObject.Interface.QueryGetData(Com.FORMATETC* pformatetc) => (HRESULT)QueryGetData(ref *(FORMATETC*)pformatetc); HRESULT Com.IDataObject.Interface.SetData(Com.FORMATETC* pformatetc, Com.STGMEDIUM* pmedium, BOOL fRelease) { @@ -137,7 +139,7 @@ HRESULT Com.IDataObject.Interface.SetData(Com.FORMATETC* pformatetc, Com.STGMEDI STGMEDIUM medium = (STGMEDIUM)(*pmedium); try { - ((ComTypes.IDataObject)this).SetData(ref *(FORMATETC*)pformatetc, ref medium, fRelease); + SetData(ref *(FORMATETC*)pformatetc, ref medium, fRelease); } catch (Exception e) { @@ -146,6 +148,7 @@ HRESULT Com.IDataObject.Interface.SetData(Com.FORMATETC* pformatetc, Com.STGMEDI return HRESULT.S_OK; } + #endregion } } } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.WinFormsToNativeAdapter.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.WinFormsToNativeAdapter.cs index ccaf607431b..77f9bbb2d93 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.WinFormsToNativeAdapter.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.WinFormsToNativeAdapter.cs @@ -33,7 +33,8 @@ public WinFormsToNativeAdapter(IDataObject dataObject) ///
private static bool GetTymedUsable(TYMED tymed) => (tymed & AllowedTymeds) != 0; - HRESULT Com.IDataObject.Interface.GetData(FORMATETC* pformatetcIn, STGMEDIUM* pmedium) + #region Com.IDataObject.Interface + public HRESULT GetData(FORMATETC* pformatetcIn, STGMEDIUM* pmedium) { if (pformatetcIn is null) { @@ -71,7 +72,7 @@ HRESULT Com.IDataObject.Interface.GetData(FORMATETC* pformatetcIn, STGMEDIUM* pm if (!((TYMED)pformatetcIn->tymed).HasFlag(TYMED.TYMED_HGLOBAL)) { pmedium->tymed = (TYMED)pformatetcIn->tymed; - return ((Com.IDataObject.Interface)this).GetDataHere(pformatetcIn, pmedium); + return GetDataHere(pformatetcIn, pmedium); } pmedium->tymed = TYMED.TYMED_HGLOBAL; @@ -82,7 +83,7 @@ HRESULT Com.IDataObject.Interface.GetData(FORMATETC* pformatetcIn, STGMEDIUM* pm return HRESULT.E_OUTOFMEMORY; } - HRESULT result = ((Com.IDataObject.Interface)this).GetDataHere(pformatetcIn, pmedium); + HRESULT result = GetDataHere(pformatetcIn, pmedium); if (result.Failed) { PInvokeCore.GlobalFree(pmedium->hGlobal); @@ -92,7 +93,7 @@ HRESULT Com.IDataObject.Interface.GetData(FORMATETC* pformatetcIn, STGMEDIUM* pm return result; } - HRESULT Com.IDataObject.Interface.GetDataHere(FORMATETC* pformatetc, STGMEDIUM* pmedium) + public HRESULT GetDataHere(FORMATETC* pformatetc, STGMEDIUM* pmedium) { if (pformatetc is null) { @@ -182,7 +183,7 @@ static HBITMAP GetCompatibleBitmap(Bitmap bitmap) } } - HRESULT Com.IDataObject.Interface.QueryGetData(FORMATETC* pformatetc) + public HRESULT QueryGetData(FORMATETC* pformatetc) { if (pformatetc is null) { @@ -212,7 +213,7 @@ HRESULT Com.IDataObject.Interface.QueryGetData(FORMATETC* pformatetc) return HRESULT.S_OK; } - HRESULT Com.IDataObject.Interface.GetCanonicalFormatEtc(FORMATETC* pformatectIn, FORMATETC* pformatetcOut) + public HRESULT GetCanonicalFormatEtc(FORMATETC* pformatectIn, FORMATETC* pformatetcOut) { if (pformatetcOut is null) { @@ -223,7 +224,7 @@ HRESULT Com.IDataObject.Interface.GetCanonicalFormatEtc(FORMATETC* pformatectIn, return (HRESULT)DATA_S_SAMEFORMATETC; } - HRESULT Com.IDataObject.Interface.SetData(FORMATETC* pformatetc, STGMEDIUM* pmedium, BOOL fRelease) + public HRESULT SetData(FORMATETC* pformatetc, STGMEDIUM* pmedium, BOOL fRelease) { if (pformatetc is null) { @@ -253,7 +254,7 @@ HRESULT Com.IDataObject.Interface.SetData(FORMATETC* pformatetc, STGMEDIUM* pmed return HRESULT.E_NOTIMPL; } - HRESULT Com.IDataObject.Interface.EnumFormatEtc(uint dwDirection, IEnumFORMATETC** ppenumFormatEtc) + public HRESULT EnumFormatEtc(uint dwDirection, IEnumFORMATETC** ppenumFormatEtc) { if (ppenumFormatEtc is null) { @@ -269,7 +270,7 @@ HRESULT Com.IDataObject.Interface.EnumFormatEtc(uint dwDirection, IEnumFORMATETC return HRESULT.E_NOTIMPL; } - HRESULT Com.IDataObject.Interface.DAdvise(FORMATETC* pformatetc, uint advf, IAdviseSink* pAdvSink, uint* pdwConnection) + public HRESULT DAdvise(FORMATETC* pformatetc, uint advf, IAdviseSink* pAdvSink, uint* pdwConnection) { if (pdwConnection is null) { @@ -280,9 +281,9 @@ HRESULT Com.IDataObject.Interface.DAdvise(FORMATETC* pformatetc, uint advf, IAdv return HRESULT.E_NOTIMPL; } - HRESULT Com.IDataObject.Interface.DUnadvise(uint dwConnection) => HRESULT.E_NOTIMPL; + public HRESULT DUnadvise(uint dwConnection) => HRESULT.E_NOTIMPL; - HRESULT Com.IDataObject.Interface.EnumDAdvise(IEnumSTATDATA** ppenumAdvise) + public HRESULT EnumDAdvise(IEnumSTATDATA** ppenumAdvise) { if (ppenumAdvise is null) { @@ -292,6 +293,7 @@ HRESULT Com.IDataObject.Interface.EnumDAdvise(IEnumSTATDATA** ppenumAdvise) *ppenumAdvise = null; return HRESULT.OLE_E_ADVISENOTSUPPORTED; } + #endregion private HRESULT SaveDataToHGLOBAL(object data, string format, ref STGMEDIUM medium) => format switch { diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.cs index 10f0869a1a0..2e292aba765 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.cs @@ -119,27 +119,27 @@ or DataFormats.PaletteConstant #endregion #region Com.IDataObject.Interface - HRESULT Com.IDataObject.Interface.DAdvise(Com.FORMATETC* pformatetc, uint advf, Com.IAdviseSink* pAdvSink, uint* pdwConnection) => _nativeDataObject.DAdvise(pformatetc, advf, pAdvSink, pdwConnection); - HRESULT Com.IDataObject.Interface.DUnadvise(uint dwConnection) => _nativeDataObject.DUnadvise(dwConnection); - HRESULT Com.IDataObject.Interface.EnumDAdvise(Com.IEnumSTATDATA** ppenumAdvise) => _nativeDataObject.EnumDAdvise(ppenumAdvise); - HRESULT Com.IDataObject.Interface.EnumFormatEtc(uint dwDirection, Com.IEnumFORMATETC** ppenumFormatEtc) => _nativeDataObject.EnumFormatEtc(dwDirection, ppenumFormatEtc); - HRESULT Com.IDataObject.Interface.GetCanonicalFormatEtc(Com.FORMATETC* pformatectIn, Com.FORMATETC* pformatetcOut) => _nativeDataObject.GetCanonicalFormatEtc(pformatectIn, pformatetcOut); - HRESULT Com.IDataObject.Interface.GetData(Com.FORMATETC* pformatetcIn, Com.STGMEDIUM* pmedium) => _nativeDataObject.GetData(pformatetcIn, pmedium); - HRESULT Com.IDataObject.Interface.GetDataHere(Com.FORMATETC* pformatetc, Com.STGMEDIUM* pmedium) => _nativeDataObject.GetDataHere(pformatetc, pmedium); - HRESULT Com.IDataObject.Interface.QueryGetData(Com.FORMATETC* pformatetc) => _nativeDataObject.QueryGetData(pformatetc); - HRESULT Com.IDataObject.Interface.SetData(Com.FORMATETC* pformatetc, Com.STGMEDIUM* pmedium, BOOL fRelease) => _nativeDataObject.SetData(pformatetc, pmedium, fRelease); + public HRESULT DAdvise(Com.FORMATETC* pformatetc, uint advf, Com.IAdviseSink* pAdvSink, uint* pdwConnection) => _nativeDataObject.DAdvise(pformatetc, advf, pAdvSink, pdwConnection); + public HRESULT DUnadvise(uint dwConnection) => _nativeDataObject.DUnadvise(dwConnection); + public HRESULT EnumDAdvise(Com.IEnumSTATDATA** ppenumAdvise) => _nativeDataObject.EnumDAdvise(ppenumAdvise); + public HRESULT EnumFormatEtc(uint dwDirection, Com.IEnumFORMATETC** ppenumFormatEtc) => _nativeDataObject.EnumFormatEtc(dwDirection, ppenumFormatEtc); + public HRESULT GetCanonicalFormatEtc(Com.FORMATETC* pformatectIn, Com.FORMATETC* pformatetcOut) => _nativeDataObject.GetCanonicalFormatEtc(pformatectIn, pformatetcOut); + public HRESULT GetData(Com.FORMATETC* pformatetcIn, Com.STGMEDIUM* pmedium) => _nativeDataObject.GetData(pformatetcIn, pmedium); + public HRESULT GetDataHere(Com.FORMATETC* pformatetc, Com.STGMEDIUM* pmedium) => _nativeDataObject.GetDataHere(pformatetc, pmedium); + public HRESULT QueryGetData(Com.FORMATETC* pformatetc) => _nativeDataObject.QueryGetData(pformatetc); + public HRESULT SetData(Com.FORMATETC* pformatetc, Com.STGMEDIUM* pmedium, BOOL fRelease) => _nativeDataObject.SetData(pformatetc, pmedium, fRelease); #endregion - #region ComTypes.IDataObject - int ComTypes.IDataObject.DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection) => _runtimeDataObject.DAdvise(ref pFormatetc, advf, adviseSink, out connection); - void ComTypes.IDataObject.DUnadvise(int connection) => _runtimeDataObject.DUnadvise(connection); - int ComTypes.IDataObject.EnumDAdvise(out IEnumSTATDATA? enumAdvise) => _runtimeDataObject.EnumDAdvise(out enumAdvise); - IEnumFORMATETC ComTypes.IDataObject.EnumFormatEtc(DATADIR direction) => _runtimeDataObject.EnumFormatEtc(direction); - int ComTypes.IDataObject.GetCanonicalFormatEtc(ref FORMATETC formatIn, out FORMATETC formatOut) => _runtimeDataObject.GetCanonicalFormatEtc(ref formatIn, out formatOut); - void ComTypes.IDataObject.GetData(ref FORMATETC format, out STGMEDIUM medium) => _runtimeDataObject.GetData(ref format, out medium); - void ComTypes.IDataObject.GetDataHere(ref FORMATETC format, ref STGMEDIUM medium) => _runtimeDataObject.GetDataHere(ref format, ref medium); - int ComTypes.IDataObject.QueryGetData(ref FORMATETC format) => _runtimeDataObject.QueryGetData(ref format); - void ComTypes.IDataObject.SetData(ref FORMATETC formatIn, ref STGMEDIUM medium, bool release) => _runtimeDataObject.SetData(ref formatIn, ref medium, release); + #region ComTypes.IDataObject.Interface + public int DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection) => _runtimeDataObject.DAdvise(ref pFormatetc, advf, adviseSink, out connection); + public void DUnadvise(int connection) => _runtimeDataObject.DUnadvise(connection); + public int EnumDAdvise(out IEnumSTATDATA? enumAdvise) => _runtimeDataObject.EnumDAdvise(out enumAdvise); + public IEnumFORMATETC EnumFormatEtc(DATADIR direction) => _runtimeDataObject.EnumFormatEtc(direction); + public int GetCanonicalFormatEtc(ref FORMATETC formatIn, out FORMATETC formatOut) => _runtimeDataObject.GetCanonicalFormatEtc(ref formatIn, out formatOut); + public void GetData(ref FORMATETC format, out STGMEDIUM medium) => _runtimeDataObject.GetData(ref format, out medium); + public void GetDataHere(ref FORMATETC format, ref STGMEDIUM medium) => _runtimeDataObject.GetDataHere(ref format, ref medium); + public int QueryGetData(ref FORMATETC format) => _runtimeDataObject.QueryGetData(ref format); + public void SetData(ref FORMATETC formatIn, ref STGMEDIUM medium, bool release) => _runtimeDataObject.SetData(ref formatIn, ref medium, release); #endregion } } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs index 8f23699bab7..f50e2a0329e 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs @@ -222,61 +222,61 @@ public virtual void SetText(string textData, TextDataFormat format) #region ComTypes.IDataObject int ComTypes.IDataObject.DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink pAdvSink, out int pdwConnection) => - ((ComTypes.IDataObject)_innerData).DAdvise(ref pFormatetc, advf, pAdvSink, out pdwConnection); + _innerData.DAdvise(ref pFormatetc, advf, pAdvSink, out pdwConnection); - void ComTypes.IDataObject.DUnadvise(int dwConnection) => ((ComTypes.IDataObject)_innerData).DUnadvise(dwConnection); + void ComTypes.IDataObject.DUnadvise(int dwConnection) => _innerData.DUnadvise(dwConnection); int ComTypes.IDataObject.EnumDAdvise(out IEnumSTATDATA? enumAdvise) => - ((ComTypes.IDataObject)_innerData).EnumDAdvise(out enumAdvise); + _innerData.EnumDAdvise(out enumAdvise); IEnumFORMATETC ComTypes.IDataObject.EnumFormatEtc(DATADIR dwDirection) => - ((ComTypes.IDataObject)_innerData).EnumFormatEtc(dwDirection); + _innerData.EnumFormatEtc(dwDirection); int ComTypes.IDataObject.GetCanonicalFormatEtc(ref FORMATETC pformatetcIn, out FORMATETC pformatetcOut) => - ((ComTypes.IDataObject)_innerData).GetCanonicalFormatEtc(ref pformatetcIn, out pformatetcOut); + _innerData.GetCanonicalFormatEtc(ref pformatetcIn, out pformatetcOut); void ComTypes.IDataObject.GetData(ref FORMATETC formatetc, out STGMEDIUM medium) => - ((ComTypes.IDataObject)_innerData).GetData(ref formatetc, out medium); + _innerData.GetData(ref formatetc, out medium); void ComTypes.IDataObject.GetDataHere(ref FORMATETC formatetc, ref STGMEDIUM medium) => - ((ComTypes.IDataObject)_innerData).GetDataHere(ref formatetc, ref medium); + _innerData.GetDataHere(ref formatetc, ref medium); int ComTypes.IDataObject.QueryGetData(ref FORMATETC formatetc) => - ((ComTypes.IDataObject)_innerData).QueryGetData(ref formatetc); + _innerData.QueryGetData(ref formatetc); void ComTypes.IDataObject.SetData(ref FORMATETC pFormatetcIn, ref STGMEDIUM pmedium, bool fRelease) => - ((ComTypes.IDataObject)_innerData).SetData(ref pFormatetcIn, ref pmedium, fRelease); + _innerData.SetData(ref pFormatetcIn, ref pmedium, fRelease); #endregion - #region Com.IDataObject + #region Com.IDataObject.Interface HRESULT Com.IDataObject.Interface.DAdvise(Com.FORMATETC* pformatetc, uint advf, Com.IAdviseSink* pAdvSink, uint* pdwConnection) => - ((Com.IDataObject.Interface)_innerData).DAdvise(pformatetc, advf, pAdvSink, pdwConnection); + _innerData.DAdvise(pformatetc, advf, pAdvSink, pdwConnection); HRESULT Com.IDataObject.Interface.DUnadvise(uint dwConnection) => - ((Com.IDataObject.Interface)_innerData).DUnadvise(dwConnection); + _innerData.DUnadvise(dwConnection); HRESULT Com.IDataObject.Interface.EnumDAdvise(Com.IEnumSTATDATA** ppenumAdvise) => - ((Com.IDataObject.Interface)_innerData).EnumDAdvise(ppenumAdvise); + _innerData.EnumDAdvise(ppenumAdvise); HRESULT Com.IDataObject.Interface.EnumFormatEtc(uint dwDirection, Com.IEnumFORMATETC** ppenumFormatEtc) => - ((Com.IDataObject.Interface)_innerData).EnumFormatEtc(dwDirection, ppenumFormatEtc); + _innerData.EnumFormatEtc(dwDirection, ppenumFormatEtc); HRESULT Com.IDataObject.Interface.GetData(Com.FORMATETC* pformatetcIn, Com.STGMEDIUM* pmedium) => - ((Com.IDataObject.Interface)_innerData).GetData(pformatetcIn, pmedium); + _innerData.GetData(pformatetcIn, pmedium); HRESULT Com.IDataObject.Interface.GetDataHere(Com.FORMATETC* pformatetc, Com.STGMEDIUM* pmedium) => - ((Com.IDataObject.Interface)_innerData).GetDataHere(pformatetc, pmedium); + _innerData.GetDataHere(pformatetc, pmedium); HRESULT Com.IDataObject.Interface.QueryGetData(Com.FORMATETC* pformatetc) => - ((Com.IDataObject.Interface)_innerData).QueryGetData(pformatetc); + _innerData.QueryGetData(pformatetc); HRESULT Com.IDataObject.Interface.GetCanonicalFormatEtc(Com.FORMATETC* pformatectIn, Com.FORMATETC* pformatetcOut) => - ((Com.IDataObject.Interface)_innerData).GetCanonicalFormatEtc(pformatectIn, pformatetcOut); + _innerData.GetCanonicalFormatEtc(pformatectIn, pformatetcOut); HRESULT Com.IDataObject.Interface.SetData(Com.FORMATETC* pformatetc, Com.STGMEDIUM* pmedium, BOOL fRelease) => - ((Com.IDataObject.Interface)_innerData).SetData(pformatetc, pmedium, fRelease); + _innerData.SetData(pformatetc, pmedium, fRelease); #endregion } diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/RichTextBoxTests.ClipboardTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/RichTextBoxTests.ClipboardTests.cs index bd1df35e346..3bc7c7d8b5f 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/RichTextBoxTests.ClipboardTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/RichTextBoxTests.ClipboardTests.cs @@ -52,7 +52,6 @@ public void RichTextBox_Paste_EmptyString_Data() { using RichTextBox richTextBox1 = new(); - Clipboard.SetText("non-empty"); Clipboard.Clear(); richTextBox1.Paste(DataFormats.GetFormat(DataFormats.Text)); From ee114a5573cb94826aa4ab2b6077ff277ad4f41b Mon Sep 17 00:00:00 2001 From: Melon Wang1 <94418985+MelonWang1@users.noreply.github.com> Date: Mon, 25 Nov 2024 22:11:34 +0000 Subject: [PATCH 051/106] Add unit tests for ToolStripActionList (#12525) * Add unit tests for ToolStripActionList * declare variables with specific types * simplified code --- .../Forms/Design/ToolStripActionListTests.cs | 171 ++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripActionListTests.cs diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripActionListTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripActionListTests.cs new file mode 100644 index 00000000000..be6bff83599 --- /dev/null +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripActionListTests.cs @@ -0,0 +1,171 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using Moq; +using System.ComponentModel.Design; +using System.ComponentModel; + +namespace System.Windows.Forms.Design.Tests; + +public sealed class ToolStripActionListTests : IDisposable +{ + private readonly Mock _mockDesignerHost; + private readonly Mock _mockSelectionService; + private readonly Mock _mockComponentChangeService; + private readonly ToolStrip _toolStrip; + private readonly ToolStripDesigner _designer; + private readonly ToolStripActionList _actionList; + + public ToolStripActionListTests() + { + _mockDesignerHost = new(); + _mockSelectionService = new(); + _mockComponentChangeService = new(); + _toolStrip = new(); + InitializeMocks(); + + _designer = new(); + _designer.Initialize(_toolStrip); + _actionList = new(_designer); + + void InitializeMocks() + { + Mock mockSite = new(); + mockSite.Setup(s => s.GetService(typeof(IDesignerHost))).Returns(_mockDesignerHost.Object); + mockSite.Setup(s => s.GetService(typeof(ISelectionService))).Returns(_mockSelectionService.Object); + mockSite.Setup(s => s.GetService(typeof(IComponentChangeService))).Returns(_mockComponentChangeService.Object); + + _toolStrip.Site = mockSite.Object; + + _mockDesignerHost.Setup(d => d.GetService(typeof(IComponentChangeService))).Returns(_mockComponentChangeService.Object); + } + } + + public void Dispose() + { + _toolStrip.Dispose(); + _designer.Dispose(); + } + + [Fact] + public void Constructor_InitializesFields() + { + _actionList.Should().NotBeNull(); + _actionList.Should().BeOfType(); + _actionList.Component.Should().Be(_toolStrip); + } + + [Theory] + [BoolData] + public void AutoShow_GetSet_ReturnsExpected(bool value) + { + _actionList.AutoShow.Should().BeFalse(); + + _actionList.AutoShow = value; + _actionList.AutoShow.Should().Be(value); + } + + [Theory] + [EnumData] + public void Dock_GetSet_ReturnsExpected(DockStyle dockStyle) + { + _actionList.Dock.Should().Be(DockStyle.Top); + + _actionList.Dock = dockStyle; + _actionList.Dock.Should().Be(dockStyle); + } + + [Theory] + [EnumData] + public void RenderMode_GetSet_ReturnsExpected(ToolStripRenderMode renderMode) + { + if (renderMode == ToolStripRenderMode.Custom) + { + _actionList.Invoking(a => a.RenderMode = renderMode) + .Should().Throw(); + } + else + { + _actionList.RenderMode = renderMode; + _actionList.RenderMode.Should().Be(renderMode); + } + } + + [Theory] + [EnumData] + public void GripStyle_GetSet_ReturnsExpected(ToolStripGripStyle gripStyle) + { + _actionList.GripStyle.Should().Be(ToolStripGripStyle.Visible); + + _actionList.GripStyle = gripStyle; + _actionList.GripStyle.Should().Be(gripStyle); + } + + [Fact] + public void GetSortedActionItems_ShouldIncludeExpectedItems_WhenConditionsAreMet() + { + var (methodItems, propertyItems) = GetSortedActionItems(); + + methodItems.Should().ContainSingle(action => action.MemberName == "InvokeEmbedVerb"); + methodItems.Should().ContainSingle(action => action.MemberName == "InvokeInsertStandardItemsVerb"); + propertyItems.Should().ContainSingle(property => property.MemberName == "RenderMode"); + propertyItems.Should().ContainSingle(property => property.MemberName == "Dock"); + propertyItems.Should().ContainSingle(property => property.MemberName == "GripStyle"); + } + + [Fact] + public void GetSortedActionItems_ShouldNotIncludeEmbedVerb_WhenIsReadOnly() + { + TypeDescriptor.AddAttributes(_toolStrip, new InheritanceAttribute(InheritanceLevel.InheritedReadOnly)); + TypeDescriptor.Refresh(_toolStrip); + + var (methodItems, _) = GetSortedActionItems(); + + methodItems.Should().NotContain(action => action.MemberName == "InvokeEmbedVerb"); + } + + [Fact] + public void GetSortedActionItems_ShouldIncludeRenderModeAndInsertStandardItemsVerb_WhenCanAddItems() + { + var (methodItems, propertyItems) = GetSortedActionItems(); + + methodItems.Should().ContainSingle(action => action.MemberName == "InvokeInsertStandardItemsVerb"); + propertyItems.Should().ContainSingle(property => property.MemberName == "RenderMode"); + } + + [Fact] + public void GetSortedActionItems_ShouldIncludeDock_WhenParentIsNotToolStripPanel() + { + _toolStrip.Parent = new Form(); + + var (_, propertyItems) = GetSortedActionItems(); + + propertyItems.Should().ContainSingle(property => property.MemberName == "Dock"); + } + + [Fact] + public void GetSortedActionItems_ShouldNotIncludeGripStyle_WhenToolStripIsStatusStrip() + { + var statusStrip = new StatusStrip + { + Site = _toolStrip.Site + }; + _designer.Initialize(statusStrip); + _actionList.TestAccessor().Dynamic._toolStrip = statusStrip; + + var (_, propertyItems) = GetSortedActionItems(); + + propertyItems.Should().NotContain(property => property.MemberName == "GripStyle"); + } + + private (List methodItems, List propertyItems) GetSortedActionItems() + { + DesignerActionItemCollection items = _actionList.GetSortedActionItems(); + List itemList = items.Cast().ToList(); + List methodItems = itemList.OfType().ToList(); + List propertyItems = itemList.OfType().ToList(); + return (methodItems, propertyItems); + } +} From 8a962d55fd04f9640a756be62ed948cc9c121e3a Mon Sep 17 00:00:00 2001 From: Nora Zhou <104609169+Nora-Zhou01@users.noreply.github.com> Date: Mon, 25 Nov 2024 22:13:03 +0000 Subject: [PATCH 052/106] Add unit tests for ListControlStringCollectionEditor (#12516) * Add unit tests for ListControlStringCollectionEditor * Update --- .../ListControlStringCollectionEditorTests.cs | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ListControlStringCollectionEditorTests.cs diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ListControlStringCollectionEditorTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ListControlStringCollectionEditorTests.cs new file mode 100644 index 00000000000..2ff07824491 --- /dev/null +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ListControlStringCollectionEditorTests.cs @@ -0,0 +1,70 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using Moq; +using System.ComponentModel; + +namespace System.Windows.Forms.Design.Tests; + +public class ListControlStringCollectionEditorTests +{ + [Fact] + public void EditValue_WithNullContext_ReturnsBaseEditValue() + { + ListControlStringCollectionEditor editor = new(typeof(string)); + IServiceProvider provider = new Mock().Object; + object? value = new(); + + object? result = editor.EditValue(null, provider, value); + + result.Should().Be(value); + } + + [Fact] + public void EditValue_WithContextInstanceNotListControl_ReturnsBaseEditValue() + { + ListControlStringCollectionEditor editor = new(typeof(string)); + Mock context = new(); + context.Setup(c => c.Instance).Returns(new object()); + IServiceProvider provider = new Mock().Object; + object? value = new(); + + object? result = editor.EditValue(context.Object, provider, value); + + result.Should().Be(value); + } + + [Fact] + public void EditValue_WithListControlAndNullDataSource_ReturnsBaseEditValue() + { + ListControlStringCollectionEditor editor = new(typeof(string)); + using ListBox listControl = new(); + Mock context = new(); + context.Setup(c => c.Instance).Returns(listControl); + IServiceProvider provider = new Mock().Object; + object? value = new(); + + object? result = editor.EditValue(context.Object, provider, value); + + result.Should().Be(value); + } + + [Fact] + public void EditValue_WithListControlAndNonNullDataSource_ThrowsArgumentException() + { + ListControlStringCollectionEditor editor = new(typeof(string)); + + using ListBox listControl = new() { DataSource = new List { "item1", "item2", "item3" } }; + + Mock context = new(); + context.Setup(c => c.Instance).Returns(listControl); + + IServiceProvider provider = new Mock().Object; + object? value = new(); + + ArgumentException exception = ((Action)(() => editor.EditValue(context.Object, provider, value))).Should().Throw().Which; + exception.Message.Should().Be(SR.DataSourceLocksItems); + } +} From b91747dfe9d2d9d9c1b87ecc77bd20d1b60b4ca9 Mon Sep 17 00:00:00 2001 From: Tanya Solyanik Date: Mon, 25 Nov 2024 14:23:37 -0800 Subject: [PATCH 053/106] Replaced string[] with Array as the T in TheoryData (#12544) Declared string[] as an Array in order to avoid confusion as to what the `object` is - a single string or an array of strings in IEnumerable VS tests fail intermittently with "The test method expected 1 parameter, but received 2" --- .../TestUtilities}/TheoryDataExtensions.cs | 8 ++------ .../FormattedObject/BinaryFormatWriterTests.cs | 18 +++++++++--------- 2 files changed, 11 insertions(+), 15 deletions(-) rename src/{System.Windows.Forms.Primitives/tests/TestUtilities/Extensions => Common/tests/TestUtilities}/TheoryDataExtensions.cs (83%) diff --git a/src/System.Windows.Forms.Primitives/tests/TestUtilities/Extensions/TheoryDataExtensions.cs b/src/Common/tests/TestUtilities/TheoryDataExtensions.cs similarity index 83% rename from src/System.Windows.Forms.Primitives/tests/TestUtilities/Extensions/TheoryDataExtensions.cs rename to src/Common/tests/TestUtilities/TheoryDataExtensions.cs index 41209d89abe..69f3bc17de7 100644 --- a/src/System.Windows.Forms.Primitives/tests/TestUtilities/Extensions/TheoryDataExtensions.cs +++ b/src/Common/tests/TestUtilities/TheoryDataExtensions.cs @@ -19,9 +19,7 @@ public static TheoryData ToTheoryData(this IEnumerable data) return theoryData; } - /// - /// Converts an IEnumerable into an Xunit theory compatible enumerable. - /// + /// public static TheoryData ToTheoryData(this IEnumerable<(T1, T2)> data) { TheoryData theoryData = []; @@ -33,9 +31,7 @@ public static TheoryData ToTheoryData(this IEnumerable<(T1, T2)> return theoryData; } - /// - /// Converts an IEnumerable into an Xunit theory compatible enumerable. - /// + /// public static TheoryData ToTheoryData(this IEnumerable<(T1, T2, T3)> data) { TheoryData theoryData = []; diff --git a/src/System.Private.Windows.Core/tests/BinaryFormatTests/FormatTests/FormattedObject/BinaryFormatWriterTests.cs b/src/System.Private.Windows.Core/tests/BinaryFormatTests/FormatTests/FormattedObject/BinaryFormatWriterTests.cs index 046c76e8e9e..6ca6ba0be66 100644 --- a/src/System.Private.Windows.Core/tests/BinaryFormatTests/FormatTests/FormattedObject/BinaryFormatWriterTests.cs +++ b/src/System.Private.Windows.Core/tests/BinaryFormatTests/FormatTests/FormattedObject/BinaryFormatWriterTests.cs @@ -206,26 +206,26 @@ public void BinaryFormatWriter_TryWriteDrawingPrimitivesObject_UnsupportedObject SystemColors.ButtonFace }; - public static TheoryData StringArray_Parse_Data => new() - { + public static TheoryData StringArray_Parse_Data => + [ new string?[] { "one", "two" }, new string?[] { "yes", "no", null }, new string?[] { "same", "same", "same" } - }; + ]; - public static TheoryData PrimitiveArray_Parse_Data => new() - { + public static TheoryData PrimitiveArray_Parse_Data => + [ new int[] { 1, 2, 3 }, new int[] { 1, 2, 1 }, new float[] { 1.0f, float.NaN, float.PositiveInfinity }, new DateTime[] { DateTime.MaxValue } - }; + ]; public static IEnumerable Array_TestData => ((IEnumerable)StringArray_Parse_Data).Concat(PrimitiveArray_Parse_Data); - public static TheoryData Array_UnsupportedTestData => new() - { + public static TheoryData Array_UnsupportedTestData => + [ new Point[] { default }, new object[] { new() }, - }; + ]; } From d19001f099093d3800ab302ec1cc45ab512dd04f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 26 Nov 2024 13:36:57 +0000 Subject: [PATCH 054/106] [main] Update dependencies from dotnet/arcade (#12548) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 24 ++++++++++++------------ eng/Versions.props | 6 +++--- global.json | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 328737e7467..aa7cf379ce8 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -191,29 +191,29 @@ Note: if the Uri is a new place, you will need to add a subscription from that p - + https://github.com/dotnet/arcade - 7d955f9f470465e144c76d47fd2596a0e4c02a21 + 2a3bf4e3a4c473135d058adcd7193a5a4bcd38a7 - + https://github.com/dotnet/arcade - 7d955f9f470465e144c76d47fd2596a0e4c02a21 + 2a3bf4e3a4c473135d058adcd7193a5a4bcd38a7 - + https://github.com/dotnet/arcade - 7d955f9f470465e144c76d47fd2596a0e4c02a21 + 2a3bf4e3a4c473135d058adcd7193a5a4bcd38a7 - + https://github.com/dotnet/arcade - 7d955f9f470465e144c76d47fd2596a0e4c02a21 + 2a3bf4e3a4c473135d058adcd7193a5a4bcd38a7 - + https://github.com/dotnet/arcade - 7d955f9f470465e144c76d47fd2596a0e4c02a21 + 2a3bf4e3a4c473135d058adcd7193a5a4bcd38a7 - + https://github.com/dotnet/arcade - 7d955f9f470465e144c76d47fd2596a0e4c02a21 + 2a3bf4e3a4c473135d058adcd7193a5a4bcd38a7 diff --git a/eng/Versions.props b/eng/Versions.props index 9facb92aff2..cd662b02d66 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -56,9 +56,9 @@ - 10.0.0-beta.24572.3 - 10.0.0-beta.24572.3 - 10.0.0-beta.24572.3 + 10.0.0-beta.24575.1 + 10.0.0-beta.24575.1 + 10.0.0-beta.24575.1 17.4.0-preview-20220707-01 diff --git a/global.json b/global.json index e9acd42aebf..cb0dfa1be9e 100644 --- a/global.json +++ b/global.json @@ -14,9 +14,9 @@ "version": "9.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24572.3", - "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24572.3", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24572.3", + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24575.1", + "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24575.1", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24575.1", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24575.1" }, From ebf4629befde9a9be0fc741e9748ef388de8b6de Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 26 Nov 2024 13:37:26 +0000 Subject: [PATCH 055/106] [main] Update dependencies from dotnet/runtime (#12549) [main] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 58 ++++++------- global.json | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index aa7cf379ce8..0ccbb2d6362 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 - + https://github.com/dotnet/runtime - 53cc1ddeec661d03d65d0e2949f3486e2162d80f + 354ec46a63440608bda18e2203bb5538e2f8eae6 diff --git a/eng/Versions.props b/eng/Versions.props index cd662b02d66..e8c0ebbc9b6 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 - 10.0.0-alpha.1.24575.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24576.1 diff --git a/global.json b/global.json index cb0dfa1be9e..543c5838016 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24575.1", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24575.1", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24575.1" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24576.1" }, "native-tools": { "cmake": "latest" From d629bcefc23b9294e68eb4871ed481057ac4c6aa Mon Sep 17 00:00:00 2001 From: v-zhgl <38325459+Zheng-Li01@users.noreply.github.com> Date: Wed, 27 Nov 2024 01:21:50 +0800 Subject: [PATCH 056/106] Add code coverage for DataGridViewLinkColumn (#12522) * Add code coverage for DataGridViewLinkColumn * Handle FeedBacks * Handle FeedBacks --- .../Forms/DataGridViewLinkColumnTests.cs | 369 ++++++++++++++++++ 1 file changed, 369 insertions(+) create mode 100644 src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewLinkColumnTests.cs diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewLinkColumnTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewLinkColumnTests.cs new file mode 100644 index 00000000000..6a5389a98ca --- /dev/null +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewLinkColumnTests.cs @@ -0,0 +1,369 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using System.Drawing; + +namespace System.Windows.Forms.Tests; + +public class DataGridViewLinkColumnTests : IDisposable +{ + private readonly DataGridViewLinkColumn _column; + private readonly DataGridView _dataGridView; + + public DataGridViewLinkColumnTests() + { + _column = new(); + _dataGridView = new(); + } + + public void Dispose() + { + _column.Dispose(); + _dataGridView.Dispose(); + } + + [WinFormsFact] + public void Ctor_Default() + { + _column.Should().NotBeNull(); + _column.LinkBehavior.Should().Be(LinkBehavior.SystemDefault); + _column.TrackVisitedState.Should().BeTrue(); + _column.UseColumnTextForLinkValue.Should().BeFalse(); + _column.Text.Should().BeNull(); + _column.ToString().Should().Be($"DataGridViewLinkColumn {{ Name=, Index=-1 }}"); + _column.ActiveLinkColor.Should().Be(LinkUtilities.IEActiveLinkColor); + + _column.CellTemplate = null; + _column.CellTemplate.Should().BeNull(); + } + + [WinFormsFact] + public void ActiveLinkColor_GetSet() + { + var color = Color.Red; + _column.ActiveLinkColor = color; + _column.ActiveLinkColor.Should().Be(color); + } + + [WinFormsFact] + public void ActiveLinkColor_SetWithDataGridView_GetReturnsExpected() + { + _dataGridView.Columns.Add(_column); + _dataGridView.Rows.Add(2); + + var color = Color.Red; + _column.ActiveLinkColor = color; + _column.ActiveLinkColor.Should().Be(color); + foreach (DataGridViewRow row in _dataGridView.Rows) + { + ((DataGridViewLinkCell)row.Cells[_column.Index]).ActiveLinkColor.Should().Be(color); + } + } + + [WinFormsFact] + public void ActiveLinkColor_SetSameValue_DoesNotInvalidate() + { + _dataGridView.Columns.Add(_column); + _dataGridView.Rows.Add(2); + + var color = _column.ActiveLinkColor; + int invalidatedCallCount = 0; + _dataGridView.Invalidated += (sender, e) => invalidatedCallCount++; + + _column.ActiveLinkColor = color; + _column.ActiveLinkColor.Should().Be(color); + invalidatedCallCount.Should().Be(0); + } + + [WinFormsFact] + public void CellTemplate_SetInvalidValue_ThrowsInvalidCastException() + { + using DataGridViewTextBoxCell cell = new(); + Action action = () => _column.CellTemplate = cell; + action.Should().Throw() + .WithMessage(string.Format(SR.DataGridViewTypeColumn_WrongCellTemplateType, "System.Windows.Forms.DataGridViewLinkCell")); + } + + [WinFormsFact] + public void CellTemplate_SetNullValue_GetReturnsExpected() + { + _column.CellTemplate = null; + _column.CellTemplate.Should().BeNull(); + } + + [WinFormsFact] + public void LinkBehavior_GetSet() + { + var behavior = LinkBehavior.AlwaysUnderline; + _column.LinkBehavior = behavior; + _column.LinkBehavior.Should().Be(behavior); + } + + [WinFormsFact] + public void LinkBehavior_SetWithDataGridView_GetReturnsExpected() + { + _dataGridView.Columns.Add(_column); + _dataGridView.Rows.Add(2); + + var behavior = LinkBehavior.NeverUnderline; + _column.LinkBehavior = behavior; + _column.LinkBehavior.Should().Be(behavior); + foreach (DataGridViewRow row in _dataGridView.Rows) + { + ((DataGridViewLinkCell)row.Cells[_column.Index]).LinkBehavior.Should().Be(behavior); + } + } + + [WinFormsFact] + public void LinkBehavior_SetSameValue_DoesNotInvalidate() + { + _dataGridView.Columns.Add(_column); + _dataGridView.Rows.Add(2); + + var behavior = _column.LinkBehavior; + int invalidatedCallCount = 0; + _dataGridView.Invalidated += (sender, e) => invalidatedCallCount++; + + _column.LinkBehavior = behavior; + _column.LinkBehavior.Should().Be(behavior); + invalidatedCallCount.Should().Be(0); + } + + [WinFormsFact] + public void LinkColor_GetSet() + { + var color = Color.Blue; + _column.LinkColor = color; + _column.LinkColor.Should().Be(color); + } + + [WinFormsFact] + public void LinkColor_SetWithDataGridView_GetReturnsExpected() + { + _dataGridView.Columns.Add(_column); + _dataGridView.Rows.Add(2); + + var color = Color.Blue; + _column.LinkColor = color; + _column.LinkColor.Should().Be(color); + foreach (DataGridViewRow row in _dataGridView.Rows) + { + ((DataGridViewLinkCell)row.Cells[_column.Index]).LinkColor.Should().Be(color); + } + } + + [WinFormsFact] + public void LinkColor_SetSameValue_DoesNotInvalidate() + { + _dataGridView.Columns.Add(_column); + _dataGridView.Rows.Add(2); + + var color = _column.LinkColor; + int invalidatedCallCount = 0; + _dataGridView.Invalidated += (sender, e) => invalidatedCallCount++; + + _column.LinkColor = color; + _column.LinkColor.Should().Be(color); + invalidatedCallCount.Should().Be(0); + } + + [WinFormsFact] + public void Text_GetSet() + { + var text = "Test"; + _column.Text = text; + _column.Text.Should().Be(text); + } + + [WinFormsFact] + public void Text_SetSameValue_DoesNotInvalidate() + { + _dataGridView.Columns.Add(_column); + _dataGridView.Rows.Add(2); + + var text = _column.Text; + int invalidatedCallCount = 0; + _dataGridView.Invalidated += (sender, e) => invalidatedCallCount++; + + _column.Text = text; + _column.Text.Should().Be(text); + invalidatedCallCount.Should().Be(0); + } + + [WinFormsFact] + public void TrackVisitedState_GetSet() + { + var trackVisitedState = false; + _column.TrackVisitedState = trackVisitedState; + _column.TrackVisitedState.Should().Be(trackVisitedState); + } + + [WinFormsFact] + public void TrackVisitedState_SetWithDataGridView_GetReturnsExpected() + { + _dataGridView.Columns.Add(_column); + _dataGridView.Rows.Add(2); + + var trackVisitedState = false; + _column.TrackVisitedState = trackVisitedState; + _column.TrackVisitedState.Should().Be(trackVisitedState); + foreach (DataGridViewRow row in _dataGridView.Rows) + { + ((DataGridViewLinkCell)row.Cells[_column.Index]).TrackVisitedState.Should().Be(trackVisitedState); + } + } + + [WinFormsFact] + public void TrackVisitedState_SetSameValue_DoesNotInvalidate() + { + _dataGridView.Columns.Add(_column); + _dataGridView.Rows.Add(2); + + var trackVisitedState = _column.TrackVisitedState; + int invalidatedCallCount = 0; + _dataGridView.Invalidated += (sender, e) => invalidatedCallCount++; + + _column.TrackVisitedState = trackVisitedState; + _column.TrackVisitedState.Should().Be(trackVisitedState); + invalidatedCallCount.Should().Be(0); + } + + [WinFormsFact] + public void UseColumnTextForLinkValue_GetSet() + { + var useColumnTextForLinkValue = true; + _column.UseColumnTextForLinkValue = useColumnTextForLinkValue; + _column.UseColumnTextForLinkValue.Should().Be(useColumnTextForLinkValue); + } + + [WinFormsFact] + public void UseColumnTextForLinkValue_SetWithDataGridView_GetReturnsExpected() + { + _dataGridView.Columns.Add(_column); + _dataGridView.Rows.Add(2); + + var useColumnTextForLinkValue = true; + _column.UseColumnTextForLinkValue = useColumnTextForLinkValue; + _column.UseColumnTextForLinkValue.Should().Be(useColumnTextForLinkValue); + foreach (DataGridViewRow row in _dataGridView.Rows) + { + ((DataGridViewLinkCell)row.Cells[_column.Index]).UseColumnTextForLinkValue.Should().Be(useColumnTextForLinkValue); + } + } + + [WinFormsFact] + public void UseColumnTextForLinkValue_SetSameValue_DoesNotInvalidate() + { + _dataGridView.Columns.Add(_column); + _dataGridView.Rows.Add(2); + + var useColumnTextForLinkValue = _column.UseColumnTextForLinkValue; + int invalidatedCallCount = 0; + _dataGridView.Invalidated += (sender, e) => invalidatedCallCount++; + + _column.UseColumnTextForLinkValue = useColumnTextForLinkValue; + _column.UseColumnTextForLinkValue.Should().Be(useColumnTextForLinkValue); + invalidatedCallCount.Should().Be(0); + } + + [WinFormsFact] + public void VisitedLinkColor_GetSet() + { + var color = Color.Green; + _column.VisitedLinkColor = color; + _column.VisitedLinkColor.Should().Be(color); + } + + [WinFormsFact] + public void VisitedLinkColor_SetWithDataGridView_GetReturnsExpected() + { + _dataGridView.Columns.Add(_column); + _dataGridView.Rows.Add(2); + + var color = Color.Green; + _column.VisitedLinkColor = color; + _column.VisitedLinkColor.Should().Be(color); + foreach (DataGridViewRow row in _dataGridView.Rows) + { + ((DataGridViewLinkCell)row.Cells[_column.Index]).VisitedLinkColor.Should().Be(color); + } + } + + [WinFormsFact] + public void VisitedLinkColor_SetSameValue_DoesNotInvalidate() + { + _dataGridView.Columns.Add(_column); + _dataGridView.Rows.Add(2); + + var color = _column.VisitedLinkColor; + int invalidatedCallCount = 0; + _dataGridView.Invalidated += (sender, e) => invalidatedCallCount++; + + _column.VisitedLinkColor = color; + _column.VisitedLinkColor.Should().Be(color); + invalidatedCallCount.Should().Be(0); + } + + [WinFormsFact] + public void Clone_CreatesCopy() + { + _column.ActiveLinkColor = Color.Red; + _column.LinkBehavior = LinkBehavior.AlwaysUnderline; + _column.LinkColor = Color.Blue; + _column.Text = "Test"; + _column.TrackVisitedState = false; + _column.UseColumnTextForLinkValue = true; + _column.VisitedLinkColor = Color.Green; + + using var clone = (DataGridViewLinkColumn)_column.Clone(); + clone.ActiveLinkColor.Should().Be(_column.ActiveLinkColor); + clone.LinkBehavior.Should().Be(_column.LinkBehavior); + clone.LinkColor.Should().Be(_column.LinkColor); + clone.Text.Should().Be(_column.Text); + clone.TrackVisitedState.Should().Be(_column.TrackVisitedState); + clone.UseColumnTextForLinkValue.Should().Be(_column.UseColumnTextForLinkValue); + clone.VisitedLinkColor.Should().Be(_column.VisitedLinkColor); + } + + [WinFormsFact] + public void Clone_CreatesCopyWithDifferentInstance() + { + _column.ActiveLinkColor = Color.Red; + _column.LinkBehavior = LinkBehavior.AlwaysUnderline; + _column.LinkColor = Color.Blue; + _column.Text = "Test"; + _column.TrackVisitedState = false; + _column.UseColumnTextForLinkValue = true; + _column.VisitedLinkColor = Color.Green; + + using var clone = (DataGridViewLinkColumn)_column.Clone(); + clone.Should().NotBeSameAs(_column); + clone.ActiveLinkColor.Should().Be(_column.ActiveLinkColor); + clone.LinkBehavior.Should().Be(_column.LinkBehavior); + clone.LinkColor.Should().Be(_column.LinkColor); + clone.Text.Should().Be(_column.Text); + clone.TrackVisitedState.Should().Be(_column.TrackVisitedState); + clone.UseColumnTextForLinkValue.Should().Be(_column.UseColumnTextForLinkValue); + clone.VisitedLinkColor.Should().Be(_column.VisitedLinkColor); + } + + [WinFormsTheory] + [InlineData("", -1, "DataGridViewLinkColumn { Name=, Index=-1 }")] + [InlineData("TestColumn", -1, "DataGridViewLinkColumn { Name=TestColumn, Index=-1 }")] + [InlineData("", 0, "DataGridViewLinkColumn { Name=, Index=0 }")] + [InlineData("TestColumn", 0, "DataGridViewLinkColumn { Name=TestColumn, Index=0 }")] + public void ToString_VariousScenarios(string name, int index, string expected) + { + _column.Name = name; + + if (index >= 0) + { + using DataGridView dataGridView = new(); + dataGridView.Columns.Add(_column); + } + + _column.ToString().Should().Be(expected); + } +} From c56379f4d359688a65975664aa4740ef88c7e4fd Mon Sep 17 00:00:00 2001 From: v-olzhan Date: Wed, 27 Nov 2024 00:14:44 +0000 Subject: [PATCH 057/106] Fix issue 12495: Infinite loop in ToolStripItemCollection.AddRange (#12513) Fixes #12495 and #4454 Proposed changes Early return for empty collection Converts the ToolStripItemCollection into a temporary array (using ToArray()) to avoid modifying the original collection during iteration. This ensures that items can be safely added to the new collection without causing exceptions or unintended behavior, especially when items are removed from the original collection if they have a different owner control. Add unit test for issue Infinite loop in ToolStripItemCollection.AddRange #12495 case Regression? Yes Test methodology Test fixing for GH issues: 12495 and 4454 manually Unit test --- .../ToolStrips/ToolStripItemCollection.cs | 17 +++++++++---- .../Forms/ToolStripItemCollectionTests.cs | 25 +++++++++++++++++++ 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripItemCollection.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripItemCollection.cs index 0d14ec7aea3..a27deb39a39 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripItemCollection.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripItemCollection.cs @@ -141,16 +141,23 @@ public void AddRange(ToolStripItemCollection toolStripItems) throw new NotSupportedException(SR.ToolStripItemCollectionIsReadOnly); } + // Return early if the collection is empty. + if (toolStripItems.Count == 0) + { + return; + } + // ToolStripDropDown will look for PropertyNames.Items to determine if it needs // to resize itself. using (new LayoutTransaction(_owner, _owner!, PropertyNames.Items)) { - for (int i = 0; i < toolStripItems.Count; i++) + // Create a temporary array to avoid modifying the original collection during iteration. + // Items will be removed from toolStripsItems collection when they are added to this collection + // if they had a different owner control. + var itemsToAdd = toolStripItems.InnerList.ToArray(); + foreach (ToolStripItem item in itemsToAdd) { - // Items are removed from their origin when added to a different owner. - // Decrement the index to always add the items from index 0 which will preserve - // the original order and avoid a pesky ArgumentOutOfRangeException. - Add(toolStripItems[i--]); + Add(item); } } } diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ToolStripItemCollectionTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ToolStripItemCollectionTests.cs index ad73851a15b..c587541231f 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ToolStripItemCollectionTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ToolStripItemCollectionTests.cs @@ -117,6 +117,8 @@ public void ToolStripItemCollection_AddRange_ToolStripItemCollection_Success() toolStripDropDownButton.DropDownItems.Add("b"); toolStripDropDownButton.DropDownItems.Add("c"); contextMenuStrip.Items.AddRange(toolStripDropDownButton.DropDownItems); + + Assert.Empty(toolStripDropDownButton.DropDownItems); Assert.Equal(3, contextMenuStrip.Items.Count); // Validate order. @@ -125,6 +127,29 @@ public void ToolStripItemCollection_AddRange_ToolStripItemCollection_Success() Assert.Equal("c", contextMenuStrip.Items[2].Text); } + [WinFormsFact] + public void ToolStripItemCollection_AddRange_ToolStripItemCollection_SameOwner_Success() + { + using ToolStrip toolStrip = new(); + + // Create a ToolStripItemCollection with 2 items + ToolStripItemCollection itemCollection = new(toolStrip, + [ + new ToolStripButton("Button 1"), + new ToolStripButton("Button 2") + ]); + + toolStrip.Items.Count.Should().Be(0); + + toolStrip.Items.AddRange(itemCollection); + + itemCollection.Count.Should().Be(2); + toolStrip.Items.Count.Should().Be(2); + + toolStrip.Items[0].Text.Should().Be("Button 1"); + toolStrip.Items[1].Text.Should().Be("Button 2"); + } + private ToolStripItem[] CreateToolStripItems(params (string Key, string Name)[] items) => items.Select(item => new ToolStripButton(item.Name) { Name = item.Key }).ToArray(); From 15ad0c1c6c9211af46f10f5f28501957e95c0bb3 Mon Sep 17 00:00:00 2001 From: v-olzhan Date: Wed, 27 Nov 2024 00:20:25 +0000 Subject: [PATCH 058/106] Fix issue 12538: Infinite loop in System.Drawing.Graphics between IsVisible(Point) and IsVisible(int, int) (#12540) Fixes #12538 Proposed changes Remove the recursive call between IsVisible(int, int) and IsVisible(Point). Directly convert int to float in IsVisible(int x, int y) and call IsVisible(float x, float y) API. Add unit test to verify that all overloads of the IsVisible method return the same result for both points and rectangles. --- .../src/System/Drawing/Graphics.cs | 2 +- .../tests/System/Drawing/GraphicsTests.cs | 39 +++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/System.Drawing.Common/src/System/Drawing/Graphics.cs b/src/System.Drawing.Common/src/System/Drawing/Graphics.cs index 69d47c5f467..2867cfb6002 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Graphics.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Graphics.cs @@ -580,7 +580,7 @@ public void ExcludeClip(Region region) public void TranslateClip(int dx, int dy) => CheckStatus(PInvoke.GdipTranslateClip(NativeGraphics, dx, dy)); - public bool IsVisible(int x, int y) => IsVisible(new Point(x, y)); + public bool IsVisible(int x, int y) => IsVisible((float)x, y); public bool IsVisible(Point point) => IsVisible(point.X, point.Y); diff --git a/src/System.Drawing.Common/tests/System/Drawing/GraphicsTests.cs b/src/System.Drawing.Common/tests/System/Drawing/GraphicsTests.cs index 0b9e3b744a8..42a0fd1c63a 100644 --- a/src/System.Drawing.Common/tests/System/Drawing/GraphicsTests.cs +++ b/src/System.Drawing.Common/tests/System/Drawing/GraphicsTests.cs @@ -2818,6 +2818,45 @@ private static void VerifyGraphics(Graphics graphics, RectangleF expectedVisible Assert.Equal(expectedVisibleClipBounds, graphics.VisibleClipBounds); } + [Fact] + public void IsVisible_AllOverloads_ReturnSameResult() + { + using Bitmap bitmap = new(100, 100); + using Graphics graphics = Graphics.FromImage(bitmap); + + // Test points + Point point = new(10, 10); + PointF pointF = new(10.5f, 10.5f); + int x = 10, y = 10; + float fx = 10.5f, fy = 10.5f; + + // Test rectangles + Rectangle rect = new(10, 10, 50, 50); + RectangleF rectF = new(10.5f, 10.5f, 50.5f, 50.5f); + int width = 50, height = 50; + float fwidth = 50.5f, fheight = 50.5f; + + // Verify that all overloads return the same result for points + bool result1 = graphics.IsVisible(x, y); + bool result2 = graphics.IsVisible(point); + bool result3 = graphics.IsVisible(fx, fy); + bool result4 = graphics.IsVisible(pointF); + + result1.Should().Be(result2); + result1.Should().Be(result3); + result1.Should().Be(result4); + + // Verify that all overloads return the same result for rectangles + bool result5 = graphics.IsVisible(x, y, width, height); + bool result6 = graphics.IsVisible(rect); + bool result7 = graphics.IsVisible(fx, fy, fwidth, fheight); + bool result8 = graphics.IsVisible(rectF); + + result5.Should().Be(result6); + result5.Should().Be(result7); + result5.Should().Be(result8); + } + #if NET8_0_OR_GREATER [Fact] public void DrawCachedBitmap_ThrowsArgumentNullException() From 11d71dfff4ca56f49bfa81ef3eb81706ed4f1ac8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 27 Nov 2024 13:36:57 +0000 Subject: [PATCH 059/106] [main] Update dependencies from dotnet/arcade (#12554) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 24 ++++++++++++------------ eng/Versions.props | 6 +++--- global.json | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0ccbb2d6362..6422661546e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -191,29 +191,29 @@ Note: if the Uri is a new place, you will need to add a subscription from that p - + https://github.com/dotnet/arcade - 2a3bf4e3a4c473135d058adcd7193a5a4bcd38a7 + 9ad0880a9f8450f4ac4e097cfe830e401ea3e22c - + https://github.com/dotnet/arcade - 2a3bf4e3a4c473135d058adcd7193a5a4bcd38a7 + 9ad0880a9f8450f4ac4e097cfe830e401ea3e22c - + https://github.com/dotnet/arcade - 2a3bf4e3a4c473135d058adcd7193a5a4bcd38a7 + 9ad0880a9f8450f4ac4e097cfe830e401ea3e22c - + https://github.com/dotnet/arcade - 2a3bf4e3a4c473135d058adcd7193a5a4bcd38a7 + 9ad0880a9f8450f4ac4e097cfe830e401ea3e22c - + https://github.com/dotnet/arcade - 2a3bf4e3a4c473135d058adcd7193a5a4bcd38a7 + 9ad0880a9f8450f4ac4e097cfe830e401ea3e22c - + https://github.com/dotnet/arcade - 2a3bf4e3a4c473135d058adcd7193a5a4bcd38a7 + 9ad0880a9f8450f4ac4e097cfe830e401ea3e22c diff --git a/eng/Versions.props b/eng/Versions.props index e8c0ebbc9b6..f50ce075b51 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -56,9 +56,9 @@ - 10.0.0-beta.24575.1 - 10.0.0-beta.24575.1 - 10.0.0-beta.24575.1 + 10.0.0-beta.24576.1 + 10.0.0-beta.24576.1 + 10.0.0-beta.24576.1 17.4.0-preview-20220707-01 diff --git a/global.json b/global.json index 543c5838016..1094e19a77f 100644 --- a/global.json +++ b/global.json @@ -14,9 +14,9 @@ "version": "9.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24575.1", - "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24575.1", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24575.1", + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24576.1", + "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24576.1", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24576.1", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24576.1" }, From 3c5c7fb0b00e4a3aa6917756375d6cc09435a264 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 27 Nov 2024 13:37:26 +0000 Subject: [PATCH 060/106] [main] Update dependencies from dotnet/runtime (#12555) [main] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 58 ++++++------- global.json | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6422661546e..e51cc64031d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d - + https://github.com/dotnet/runtime - 354ec46a63440608bda18e2203bb5538e2f8eae6 + fe3d5b5f7039e9f38f022dac77aeb6f01025b19d diff --git a/eng/Versions.props b/eng/Versions.props index f50ce075b51..299b6fbcd6f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 - 10.0.0-alpha.1.24576.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24577.1 diff --git a/global.json b/global.json index 1094e19a77f..a444c73e7a3 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24576.1", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24576.1", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24576.1" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24577.1" }, "native-tools": { "cmake": "latest" From 61266db80759ebee98206566a920d55bc6df3806 Mon Sep 17 00:00:00 2001 From: "Ricardo Bossan (BEYONDSOFT CONSULTING INC) (from Dev Box)" Date: Wed, 27 Nov 2024 19:24:42 -0300 Subject: [PATCH 061/106] Handles positioning of the ToolTip when it is too close to the left border of the screen Fixes #12556 ## Proposed changes - Updates the `Reposition()` method in the `ToolTip` class to correctly handle cases where the tooltip extends beyond the left boundary of the screen, ensuring it is fully visible and not truncated. ## Customer Impact The tooltip will be fully visible regardless of how close it is to the left border of the screen. ## Regression? - No ## Risk - Minimal ## Screenshots ### Before ### After ## Test methodology - Manual ## Test environment(s) sdk: 9.0.100 Microsoft.NET.Sdk.IL: 10.0.0-alpha.1.24577.1 --- .../src/System/Windows/Forms/ToolTip/ToolTip.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ToolTip/ToolTip.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ToolTip/ToolTip.cs index 6fad5f45a92..ff4e6c0c220 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/ToolTip/ToolTip.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/ToolTip/ToolTip.cs @@ -1935,6 +1935,11 @@ private void Reposition(Point tipPosition, Size tipSize) moveToLocation.X = screen.WorkingArea.Right - tipSize.Width; } + if (moveToLocation.X < screen.WorkingArea.Left) + { + moveToLocation.X = screen.WorkingArea.Left; + } + // re-adjust the Y position of the tool tip if it bleeds off the screen working area. if (moveToLocation.Y + tipSize.Height > screen.WorkingArea.Bottom) { From d02c89d400d27ac493ed78d1e307c3d4aaaab5d5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 28 Nov 2024 13:37:02 +0000 Subject: [PATCH 062/106] [main] Update dependencies from dotnet/arcade (#12561) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 24 ++++++++++++------------ eng/Versions.props | 6 +++--- global.json | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e51cc64031d..33c457b8aa8 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -191,29 +191,29 @@ Note: if the Uri is a new place, you will need to add a subscription from that p - + https://github.com/dotnet/arcade - 9ad0880a9f8450f4ac4e097cfe830e401ea3e22c + d0f89c635d780e183a97ad86af4f3c8d7e95977f - + https://github.com/dotnet/arcade - 9ad0880a9f8450f4ac4e097cfe830e401ea3e22c + d0f89c635d780e183a97ad86af4f3c8d7e95977f - + https://github.com/dotnet/arcade - 9ad0880a9f8450f4ac4e097cfe830e401ea3e22c + d0f89c635d780e183a97ad86af4f3c8d7e95977f - + https://github.com/dotnet/arcade - 9ad0880a9f8450f4ac4e097cfe830e401ea3e22c + d0f89c635d780e183a97ad86af4f3c8d7e95977f - + https://github.com/dotnet/arcade - 9ad0880a9f8450f4ac4e097cfe830e401ea3e22c + d0f89c635d780e183a97ad86af4f3c8d7e95977f - + https://github.com/dotnet/arcade - 9ad0880a9f8450f4ac4e097cfe830e401ea3e22c + d0f89c635d780e183a97ad86af4f3c8d7e95977f diff --git a/eng/Versions.props b/eng/Versions.props index 299b6fbcd6f..cba392c44e5 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -56,9 +56,9 @@ - 10.0.0-beta.24576.1 - 10.0.0-beta.24576.1 - 10.0.0-beta.24576.1 + 10.0.0-beta.24577.1 + 10.0.0-beta.24577.1 + 10.0.0-beta.24577.1 17.4.0-preview-20220707-01 diff --git a/global.json b/global.json index a444c73e7a3..ad6e9c43b77 100644 --- a/global.json +++ b/global.json @@ -14,9 +14,9 @@ "version": "9.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24576.1", - "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24576.1", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24576.1", + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24577.1", + "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24577.1", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24577.1", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24577.1" }, From 01a373e2a573cafe38f20e3e84862fbc5b066b55 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 10:14:49 -0800 Subject: [PATCH 063/106] [main] Update dependencies from dotnet/arcade (#12567) Update dependencies from https://github.com/dotnet/arcade build 20241128.2 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.CMake.Sdk , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.XUnitExtensions From Version 10.0.0-beta.24577.1 -> To Version 10.0.0-beta.24578.2 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 24 +++++++++++------------ eng/Versions.props | 6 +++--- eng/common/native/install-dependencies.sh | 6 +----- global.json | 6 +++--- 4 files changed, 19 insertions(+), 23 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 33c457b8aa8..fc7284c55de 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -191,29 +191,29 @@ Note: if the Uri is a new place, you will need to add a subscription from that p - + https://github.com/dotnet/arcade - d0f89c635d780e183a97ad86af4f3c8d7e95977f + e8de3415124309210e4cbd0105e4a9da8dc01696 - + https://github.com/dotnet/arcade - d0f89c635d780e183a97ad86af4f3c8d7e95977f + e8de3415124309210e4cbd0105e4a9da8dc01696 - + https://github.com/dotnet/arcade - d0f89c635d780e183a97ad86af4f3c8d7e95977f + e8de3415124309210e4cbd0105e4a9da8dc01696 - + https://github.com/dotnet/arcade - d0f89c635d780e183a97ad86af4f3c8d7e95977f + e8de3415124309210e4cbd0105e4a9da8dc01696 - + https://github.com/dotnet/arcade - d0f89c635d780e183a97ad86af4f3c8d7e95977f + e8de3415124309210e4cbd0105e4a9da8dc01696 - + https://github.com/dotnet/arcade - d0f89c635d780e183a97ad86af4f3c8d7e95977f + e8de3415124309210e4cbd0105e4a9da8dc01696 diff --git a/eng/Versions.props b/eng/Versions.props index cba392c44e5..a08f3503605 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -56,9 +56,9 @@ - 10.0.0-beta.24577.1 - 10.0.0-beta.24577.1 - 10.0.0-beta.24577.1 + 10.0.0-beta.24578.2 + 10.0.0-beta.24578.2 + 10.0.0-beta.24578.2 17.4.0-preview-20220707-01 diff --git a/eng/common/native/install-dependencies.sh b/eng/common/native/install-dependencies.sh index dc396a95560..3eef7409f72 100644 --- a/eng/common/native/install-dependencies.sh +++ b/eng/common/native/install-dependencies.sh @@ -44,15 +44,11 @@ case "$os" in export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 # Skip brew update for now, see https://github.com/actions/setup-python/issues/577 # brew update --preinstall - - # Temporarily uninstall pkg-config@0.29.2 to work around https://github.com/actions/runner-images/issues/10984 - brew uninstall --ignore-dependencies --force pkg-config@0.29.2 - brew bundle --no-upgrade --no-lock --file=- < Date: Mon, 2 Dec 2024 21:30:57 +0000 Subject: [PATCH 064/106] Add unit tests for DesignerVerbToolStripMenuItem (#12566) Related #10773 Add unit test DesignerVerbToolStripMenuItemTests.cs for public properties and method of the DesignerVerbToolStripMenuItem. --- .../DesignerVerbToolStripMenuItemTests.cs | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DesignerVerbToolStripMenuItemTests.cs diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DesignerVerbToolStripMenuItemTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DesignerVerbToolStripMenuItemTests.cs new file mode 100644 index 00000000000..1a7c1e60c8f --- /dev/null +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DesignerVerbToolStripMenuItemTests.cs @@ -0,0 +1,49 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using System.ComponentModel.Design; + +namespace System.Windows.Forms.Design.Tests; + +public class DesignerVerbToolStripMenuItemTests +{ + [Fact] + public void Constructor_InitializesTextProperty() + { + DesignerVerb verb = new("TestVerb", (sender, e) => { }); + DesignerVerbToolStripMenuItem item = new(verb); + + item.Text.Should().Be("TestVerb"); + item.Enabled.Should().BeTrue(); + item.Checked.Should().BeFalse(); + } + + [Fact] + public void RefreshItem_UpdatesProperties() + { + DesignerVerb verb = new("TestVerb", (sender, e) => { }) + { + Enabled = false, + Checked = true + }; + + DesignerVerbToolStripMenuItem item = new(verb); + item.RefreshItem(); + + item.Enabled.Should().BeFalse(); + item.Checked.Should().BeTrue(); + } + + [Fact] + public void OnClick_InvokesDesignerVerb() + { + bool invoked = false; + DesignerVerb verb = new("TestVerb", (sender, e) => invoked = true); + DesignerVerbToolStripMenuItem item = new(verb); + item.PerformClick(); + + invoked.Should().BeTrue(); + } +} From 237b29888235654edd4b4e1fac9b693d834c3985 Mon Sep 17 00:00:00 2001 From: Sachin Sahara <156845706+Sachin-NI@users.noreply.github.com> Date: Tue, 3 Dec 2024 03:04:36 +0530 Subject: [PATCH 065/106] Resolved issue in sending WM_DESTROY msg to ActiveX controls (#12564) --- .../src/System/Windows/Forms/ActiveX/AxHost.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.cs index 2450217f899..741b948bbae 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.cs @@ -3203,8 +3203,9 @@ protected override unsafe void WndProc(ref Message m) private unsafe void DetachAndForward(ref Message m) { + bool isHandleCreated = IsHandleCreated; DetachWindow(); - if (IsHandleCreated) + if (isHandleCreated) { void* wndProc = (void*)PInvokeCore.GetWindowLong(this, WINDOW_LONG_PTR_INDEX.GWL_WNDPROC); m.ResultInternal = PInvokeCore.CallWindowProc( From 4a158f623266cc7efaf16d248dfd5f2d844687db Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 15:40:35 -0800 Subject: [PATCH 066/106] [main] Update dependencies from dotnet/runtime (#12562) * Update dependencies from https://github.com/dotnet/runtime build 20241127.7 Microsoft.Internal.Runtime.WindowsDesktop.Transport , Microsoft.NET.Sdk.IL , Microsoft.NETCore.App.Ref , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.ILAsm , Microsoft.NETCore.ILDAsm , Microsoft.NETCore.Platforms , Microsoft.Win32.Registry.AccessControl , Microsoft.Win32.SystemEvents , runtime.win-x64.Microsoft.NETCore.ILAsm , runtime.win-x86.Microsoft.NETCore.ILAsm , System.CodeDom , System.ComponentModel.Composition , System.ComponentModel.Composition.Registration , System.Configuration.ConfigurationManager , System.Data.Odbc , System.Data.OleDb , System.Diagnostics.EventLog , System.Diagnostics.PerformanceCounter , System.DirectoryServices , System.DirectoryServices.AccountManagement , System.DirectoryServices.Protocols , System.Formats.Nrbf , System.IO.Hashing , System.IO.Packaging , System.IO.Ports , System.Management , System.Reflection.Context , System.Reflection.MetadataLoadContext , System.Resources.Extensions , System.Runtime.Caching , System.Runtime.Serialization.Formatters , System.Security.Cryptography.Pkcs , System.Security.Cryptography.ProtectedData , System.Security.Cryptography.Xml , System.Security.Permissions , System.ServiceModel.Syndication , System.ServiceProcess.ServiceController , System.Speech , System.Text.Encoding.CodePages , System.Text.Encodings.Web , System.Text.Json , System.Threading.AccessControl , System.Windows.Extensions , VS.Redist.Common.NetCore.SharedFramework.x64.10.0 From Version 10.0.0-alpha.1.24577.1 -> To Version 10.0.0-alpha.1.24577.7 * Update dependencies from https://github.com/dotnet/runtime build 20241128.5 Microsoft.Internal.Runtime.WindowsDesktop.Transport , Microsoft.NET.Sdk.IL , Microsoft.NETCore.App.Ref , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.ILAsm , Microsoft.NETCore.ILDAsm , Microsoft.NETCore.Platforms , Microsoft.Win32.Registry.AccessControl , Microsoft.Win32.SystemEvents , runtime.win-x64.Microsoft.NETCore.ILAsm , runtime.win-x86.Microsoft.NETCore.ILAsm , System.CodeDom , System.ComponentModel.Composition , System.ComponentModel.Composition.Registration , System.Configuration.ConfigurationManager , System.Data.Odbc , System.Data.OleDb , System.Diagnostics.EventLog , System.Diagnostics.PerformanceCounter , System.DirectoryServices , System.DirectoryServices.AccountManagement , System.DirectoryServices.Protocols , System.Formats.Nrbf , System.IO.Hashing , System.IO.Packaging , System.IO.Ports , System.Management , System.Reflection.Context , System.Reflection.MetadataLoadContext , System.Resources.Extensions , System.Runtime.Caching , System.Runtime.Serialization.Formatters , System.Security.Cryptography.Pkcs , System.Security.Cryptography.ProtectedData , System.Security.Cryptography.Xml , System.Security.Permissions , System.ServiceModel.Syndication , System.ServiceProcess.ServiceController , System.Speech , System.Text.Encoding.CodePages , System.Text.Encodings.Web , System.Text.Json , System.Threading.AccessControl , System.Windows.Extensions , VS.Redist.Common.NetCore.SharedFramework.x64.10.0 From Version 10.0.0-alpha.1.24577.1 -> To Version 10.0.0-alpha.1.24578.5 * Update dependencies from https://github.com/dotnet/runtime build 20241129.2 Microsoft.Internal.Runtime.WindowsDesktop.Transport , Microsoft.NET.Sdk.IL , Microsoft.NETCore.App.Ref , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.ILAsm , Microsoft.NETCore.ILDAsm , Microsoft.NETCore.Platforms , Microsoft.Win32.Registry.AccessControl , Microsoft.Win32.SystemEvents , runtime.win-x64.Microsoft.NETCore.ILAsm , runtime.win-x86.Microsoft.NETCore.ILAsm , System.CodeDom , System.ComponentModel.Composition , System.ComponentModel.Composition.Registration , System.Configuration.ConfigurationManager , System.Data.Odbc , System.Data.OleDb , System.Diagnostics.EventLog , System.Diagnostics.PerformanceCounter , System.DirectoryServices , System.DirectoryServices.AccountManagement , System.DirectoryServices.Protocols , System.Formats.Nrbf , System.IO.Hashing , System.IO.Packaging , System.IO.Ports , System.Management , System.Reflection.Context , System.Reflection.MetadataLoadContext , System.Resources.Extensions , System.Runtime.Caching , System.Runtime.Serialization.Formatters , System.Security.Cryptography.Pkcs , System.Security.Cryptography.ProtectedData , System.Security.Cryptography.Xml , System.Security.Permissions , System.ServiceModel.Syndication , System.ServiceProcess.ServiceController , System.Speech , System.Text.Encoding.CodePages , System.Text.Encodings.Web , System.Text.Json , System.Threading.AccessControl , System.Windows.Extensions , VS.Redist.Common.NetCore.SharedFramework.x64.10.0 From Version 10.0.0-alpha.1.24577.1 -> To Version 10.0.0-alpha.1.24579.2 * Update dependencies from https://github.com/dotnet/runtime build 20241130.2 Microsoft.Internal.Runtime.WindowsDesktop.Transport , Microsoft.NET.Sdk.IL , Microsoft.NETCore.App.Ref , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.ILAsm , Microsoft.NETCore.ILDAsm , Microsoft.NETCore.Platforms , Microsoft.Win32.Registry.AccessControl , Microsoft.Win32.SystemEvents , runtime.win-x64.Microsoft.NETCore.ILAsm , runtime.win-x86.Microsoft.NETCore.ILAsm , System.CodeDom , System.ComponentModel.Composition , System.ComponentModel.Composition.Registration , System.Configuration.ConfigurationManager , System.Data.Odbc , System.Data.OleDb , System.Diagnostics.EventLog , System.Diagnostics.PerformanceCounter , System.DirectoryServices , System.DirectoryServices.AccountManagement , System.DirectoryServices.Protocols , System.Formats.Nrbf , System.IO.Hashing , System.IO.Packaging , System.IO.Ports , System.Management , System.Reflection.Context , System.Reflection.MetadataLoadContext , System.Resources.Extensions , System.Runtime.Caching , System.Runtime.Serialization.Formatters , System.Security.Cryptography.Pkcs , System.Security.Cryptography.ProtectedData , System.Security.Cryptography.Xml , System.Security.Permissions , System.ServiceModel.Syndication , System.ServiceProcess.ServiceController , System.Speech , System.Text.Encoding.CodePages , System.Text.Encodings.Web , System.Text.Json , System.Threading.AccessControl , System.Windows.Extensions , VS.Redist.Common.NetCore.SharedFramework.x64.10.0 From Version 10.0.0-alpha.1.24577.1 -> To Version 10.0.0-alpha.1.24580.2 * Update dependencies from https://github.com/dotnet/runtime build 20241201.1 Microsoft.Internal.Runtime.WindowsDesktop.Transport , Microsoft.NET.Sdk.IL , Microsoft.NETCore.App.Ref , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.ILAsm , Microsoft.NETCore.ILDAsm , Microsoft.NETCore.Platforms , Microsoft.Win32.Registry.AccessControl , Microsoft.Win32.SystemEvents , runtime.win-x64.Microsoft.NETCore.ILAsm , runtime.win-x86.Microsoft.NETCore.ILAsm , System.CodeDom , System.ComponentModel.Composition , System.ComponentModel.Composition.Registration , System.Configuration.ConfigurationManager , System.Data.Odbc , System.Data.OleDb , System.Diagnostics.EventLog , System.Diagnostics.PerformanceCounter , System.DirectoryServices , System.DirectoryServices.AccountManagement , System.DirectoryServices.Protocols , System.Formats.Nrbf , System.IO.Hashing , System.IO.Packaging , System.IO.Ports , System.Management , System.Reflection.Context , System.Reflection.MetadataLoadContext , System.Resources.Extensions , System.Runtime.Caching , System.Runtime.Serialization.Formatters , System.Security.Cryptography.Pkcs , System.Security.Cryptography.ProtectedData , System.Security.Cryptography.Xml , System.Security.Permissions , System.ServiceModel.Syndication , System.ServiceProcess.ServiceController , System.Speech , System.Text.Encoding.CodePages , System.Text.Encodings.Web , System.Text.Json , System.Threading.AccessControl , System.Windows.Extensions , VS.Redist.Common.NetCore.SharedFramework.x64.10.0 From Version 10.0.0-alpha.1.24577.1 -> To Version 10.0.0-alpha.1.24601.1 * react to nrbf changes for simplified array handling --------- Co-authored-by: dotnet-maestro[bot] Co-authored-by: Loni Tra --- eng/Version.Details.xml | 180 +++++++++--------- eng/Versions.props | 58 +++--- global.json | 2 +- .../Nrbf/SerializationRecordExtensions.cs | 46 +++-- 4 files changed, 153 insertions(+), 133 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index fc7284c55de..4115b650647 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 - + https://github.com/dotnet/runtime - fe3d5b5f7039e9f38f022dac77aeb6f01025b19d + 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 diff --git a/eng/Versions.props b/eng/Versions.props index a08f3503605..ebacf895b6f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 - 10.0.0-alpha.1.24577.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24601.1 diff --git a/global.json b/global.json index 6ffe946338a..20c45ab0cbd 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24578.2", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24578.2", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24577.1" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24601.1" }, "native-tools": { "cmake": "latest" diff --git a/src/System.Private.Windows.Core/src/System/Private/Windows/Core/Nrbf/SerializationRecordExtensions.cs b/src/System.Private.Windows.Core/src/System/Private/Windows/Core/Nrbf/SerializationRecordExtensions.cs index b01463fafa0..80f0f584c81 100644 --- a/src/System.Private.Windows.Core/src/System/Private/Windows/Core/Nrbf/SerializationRecordExtensions.cs +++ b/src/System.Private.Windows.Core/src/System/Private/Windows/Core/Nrbf/SerializationRecordExtensions.cs @@ -356,22 +356,30 @@ static bool Get(SerializationRecord record, [NotNullWhen(true)] out object? valu || !classInfo.HasMember("_items") || !classInfo.HasMember("_size") || classInfo.GetRawValue("_size") is not int size - || classInfo.GetRawValue("_items") is not SZArrayRecord arrayRecord + || classInfo.GetRawValue("_items") is not SZArrayRecord arrayRecord || size > arrayRecord.Length) { return false; } ArrayList arrayList = new(size); - object?[] array = arrayRecord.GetArray(); + SerializationRecord?[] array = arrayRecord.GetArray(); for (int i = 0; i < size; i++) { - if (array[i] is SerializationRecord) + SerializationRecord? elementRecord = array[i]; + if (elementRecord is null) { + arrayList.Add(null); + } + else if (elementRecord is PrimitiveTypeRecord primitiveTypeRecord) + { + arrayList.Add(primitiveTypeRecord.Value); + } + else + { + // It was a complex type (represented as a ClassRecord or an ArrayRecord) return false; } - - arrayList.Add(array[i]); } value = arrayList; @@ -447,27 +455,39 @@ static bool Get(SerializationRecord record, [NotNullWhen(true)] out object? hash || !classInfo.HasMember("Values") // Note that hashtables with custom comparers and/or hash code providers will have non null Comparer || classInfo.GetSerializationRecord("Comparer") is not null - || classInfo.GetSerializationRecord("Keys") is not SZArrayRecord keysRecord - || classInfo.GetSerializationRecord("Values") is not SZArrayRecord valuesRecord + || classInfo.GetSerializationRecord("Keys") is not SZArrayRecord keysRecord + || classInfo.GetSerializationRecord("Values") is not SZArrayRecord valuesRecord || keysRecord.Length != valuesRecord.Length) { return false; } Hashtable temp = new(keysRecord.Length); - object?[] keys = keysRecord.GetArray(); - object?[] values = valuesRecord.GetArray(); + SerializationRecord?[] keys = keysRecord.GetArray(); + SerializationRecord?[] values = valuesRecord.GetArray(); for (int i = 0; i < keys.Length; i++) { - object? key = keys[i]; - object? value = values[i]; + SerializationRecord? key = keys[i]; + SerializationRecord? value = values[i]; - if (key is null or SerializationRecord || value is SerializationRecord) + if (key is null || key is not PrimitiveTypeRecord primitiveKey) { return false; } - temp[key] = value; + if (value is null) + { + temp[primitiveKey.Value] = null; // null values are allowed + } + else if (value is PrimitiveTypeRecord primitiveValue) + { + temp[primitiveKey.Value] = primitiveValue.Value; + } + else + { + // It was a complex type (represented as a ClassRecord or an ArrayRecord) + return false; + } } hashtable = temp; From 123c18d48eeb7943a9e0a1958b91128809c55532 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2024 13:41:14 +0000 Subject: [PATCH 067/106] [main] Update dependencies from dotnet/runtime (#12576) [main] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 58 ++++++------- global.json | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4115b650647..e009cd41910 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 - + https://github.com/dotnet/runtime - 5b9b8d3ae6aaf2a0eb23ff9e2b32ddd64556d442 + 12afdedd8050847aa90473e254fa782f54360990 diff --git a/eng/Versions.props b/eng/Versions.props index ebacf895b6f..416117ae9e8 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 - 10.0.0-alpha.1.24601.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.1 diff --git a/global.json b/global.json index 20c45ab0cbd..d173e9a299a 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24578.2", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24578.2", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24601.1" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24603.1" }, "native-tools": { "cmake": "latest" From 85c1d8b0821ec52c9b2b7c3d367e7cc6f664f6d9 Mon Sep 17 00:00:00 2001 From: v-zhgl <38325459+Zheng-Li01@users.noreply.github.com> Date: Tue, 3 Dec 2024 17:47:39 +0000 Subject: [PATCH 068/106] Add code coverage for DataGridViewColumnDesignTimeVisibleAttribute (#12553) * Add code coverage for DataGridViewColumnDesignTimeVisibleAttribute * Handle FeedBacks * Handle FeedBacks --- ...ewColumnDesignTimeVisibleAttributeTests.cs | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewColumnDesignTimeVisibleAttributeTests.cs diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewColumnDesignTimeVisibleAttributeTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewColumnDesignTimeVisibleAttributeTests.cs new file mode 100644 index 00000000000..0c4aff628db --- /dev/null +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewColumnDesignTimeVisibleAttributeTests.cs @@ -0,0 +1,74 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +namespace System.Windows.Forms.Tests; + +public class DataGridViewColumnDesignTimeVisibleAttributeTests +{ + private readonly DataGridViewColumnDesignTimeVisibleAttribute _defaultAttribute = new(); + + [WinFormsTheory] + [BoolData] + public void Ctor_Bool_SetsVisible(bool visible) + { + DataGridViewColumnDesignTimeVisibleAttribute attribute = new(visible); + attribute.Visible.Should().Be(visible); + } + + [WinFormsFact] + public void Ctor_Default_VisibleIsFalse() + { + _defaultAttribute.Visible.Should().BeFalse(); + } + + [WinFormsTheory] + [BoolData] + public void YesNo_ReturnsExpectedAttributeWithVisible(bool visible) + { + DataGridViewColumnDesignTimeVisibleAttribute attribute = visible ? DataGridViewColumnDesignTimeVisibleAttribute.Yes : DataGridViewColumnDesignTimeVisibleAttribute.No; + attribute.Visible.Should().Be(visible); + } + + [WinFormsFact] + public void Default_ReturnsYes() + { + DataGridViewColumnDesignTimeVisibleAttribute.Default.Should().BeSameAs(DataGridViewColumnDesignTimeVisibleAttribute.Yes); + } + + [WinFormsFact] + public void Equals_SameInstance_ReturnsTrue() + { + _defaultAttribute.Equals(_defaultAttribute).Should().BeTrue(); + } + + [WinFormsTheory] + [InlineData(true, true, true)] + [InlineData(true, false, false)] + [InlineData(false, false, true)] + public void Equals_DifferentInstances_ReturnsExpected(bool value1, bool value2, bool equals) + { + DataGridViewColumnDesignTimeVisibleAttribute attribute1 = new(value1); + DataGridViewColumnDesignTimeVisibleAttribute attribute2 = new(value2); + attribute1.Equals(attribute2).Should().Be(equals); + } + + [WinFormsTheory] + [BoolData] + public void GetHashCode_ReturnsExpected(bool visible) + { + DataGridViewColumnDesignTimeVisibleAttribute attribute = new(visible); + int expectedHashCode = HashCode.Combine(typeof(DataGridViewColumnDesignTimeVisibleAttribute), visible); + attribute.GetHashCode().Should().Be(expectedHashCode); + } + + [WinFormsTheory] + [BoolData] + public void IsDefaultAttribute_ReturnsExpected(bool visible) + { + DataGridViewColumnDesignTimeVisibleAttribute attribute = new(visible); + bool expected = visible; + attribute.IsDefaultAttribute().Should().Be(expected); + } +} From 00c0b46306c27ef75b0ee35c16c21cee96d926fc Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Tue, 3 Dec 2024 11:07:39 -0800 Subject: [PATCH 069/106] Localized file check-in by OneLocBuild Task: Build definition ID 164: Build ID 2594265 (#12533) * Localized file check-in by OneLocBuild Task: Build definition ID 164: Build ID 2587332 * Localized file check-in by OneLocBuild Task: Build definition ID 164: Build ID 2587332 * Localized file check-in by OneLocBuild Task: Build definition ID 164: Build ID 2587398 * Localized file check-in by OneLocBuild Task: Build definition ID 164: Build ID 2587398 * Localized file check-in by OneLocBuild Task: Build definition ID 164: Build ID 2593375 * Localized file check-in by OneLocBuild Task: Build definition ID 164: Build ID 2593375 * Localized file check-in by OneLocBuild Task: Build definition ID 164: Build ID 2594265 * Localized file check-in by OneLocBuild Task: Build definition ID 164: Build ID 2594265 --- .../.template.config/localize/templatestrings.cs.json | 2 +- .../.template.config/localize/templatestrings.de.json | 2 +- .../.template.config/localize/templatestrings.es.json | 2 +- .../.template.config/localize/templatestrings.fr.json | 4 ++-- .../.template.config/localize/templatestrings.it.json | 2 +- .../.template.config/localize/templatestrings.ja.json | 2 +- .../.template.config/localize/templatestrings.ko.json | 2 +- .../.template.config/localize/templatestrings.pl.json | 2 +- .../.template.config/localize/templatestrings.pt-BR.json | 2 +- .../.template.config/localize/templatestrings.ru.json | 2 +- .../.template.config/localize/templatestrings.tr.json | 2 +- .../.template.config/localize/templatestrings.zh-Hans.json | 2 +- .../.template.config/localize/templatestrings.zh-Hant.json | 2 +- .../.template.config/localize/templatestrings.cs.json | 4 ++-- .../.template.config/localize/templatestrings.de.json | 4 ++-- .../.template.config/localize/templatestrings.es.json | 4 ++-- .../.template.config/localize/templatestrings.fr.json | 4 ++-- .../.template.config/localize/templatestrings.it.json | 4 ++-- .../.template.config/localize/templatestrings.ja.json | 4 ++-- .../.template.config/localize/templatestrings.ko.json | 4 ++-- .../.template.config/localize/templatestrings.pl.json | 4 ++-- .../.template.config/localize/templatestrings.pt-BR.json | 4 ++-- .../.template.config/localize/templatestrings.ru.json | 4 ++-- .../.template.config/localize/templatestrings.tr.json | 4 ++-- .../.template.config/localize/templatestrings.zh-Hans.json | 4 ++-- .../.template.config/localize/templatestrings.zh-Hant.json | 4 ++-- .../.template.config/localize/templatestrings.cs.json | 4 ++-- .../.template.config/localize/templatestrings.de.json | 4 ++-- .../.template.config/localize/templatestrings.es.json | 4 ++-- .../.template.config/localize/templatestrings.fr.json | 6 +++--- .../.template.config/localize/templatestrings.it.json | 4 ++-- .../.template.config/localize/templatestrings.ja.json | 4 ++-- .../.template.config/localize/templatestrings.ko.json | 4 ++-- .../.template.config/localize/templatestrings.pl.json | 4 ++-- .../.template.config/localize/templatestrings.pt-BR.json | 4 ++-- .../.template.config/localize/templatestrings.ru.json | 4 ++-- .../.template.config/localize/templatestrings.tr.json | 4 ++-- .../.template.config/localize/templatestrings.zh-Hans.json | 4 ++-- .../.template.config/localize/templatestrings.zh-Hant.json | 4 ++-- .../.template.config/localize/templatestrings.cs.json | 4 ++-- .../.template.config/localize/templatestrings.de.json | 4 ++-- .../.template.config/localize/templatestrings.es.json | 4 ++-- .../.template.config/localize/templatestrings.fr.json | 6 +++--- .../.template.config/localize/templatestrings.it.json | 4 ++-- .../.template.config/localize/templatestrings.ja.json | 4 ++-- .../.template.config/localize/templatestrings.ko.json | 4 ++-- .../.template.config/localize/templatestrings.pl.json | 4 ++-- .../.template.config/localize/templatestrings.pt-BR.json | 4 ++-- .../.template.config/localize/templatestrings.ru.json | 4 ++-- .../.template.config/localize/templatestrings.tr.json | 4 ++-- .../.template.config/localize/templatestrings.zh-Hans.json | 4 ++-- .../.template.config/localize/templatestrings.zh-Hant.json | 4 ++-- .../.template.config/localize/templatestrings.cs.json | 4 ++-- .../.template.config/localize/templatestrings.de.json | 4 ++-- .../.template.config/localize/templatestrings.es.json | 4 ++-- .../.template.config/localize/templatestrings.fr.json | 6 +++--- .../.template.config/localize/templatestrings.it.json | 4 ++-- .../.template.config/localize/templatestrings.ja.json | 4 ++-- .../.template.config/localize/templatestrings.ko.json | 4 ++-- .../.template.config/localize/templatestrings.pl.json | 4 ++-- .../.template.config/localize/templatestrings.pt-BR.json | 4 ++-- .../.template.config/localize/templatestrings.ru.json | 4 ++-- .../.template.config/localize/templatestrings.tr.json | 4 ++-- .../.template.config/localize/templatestrings.zh-Hans.json | 4 ++-- .../.template.config/localize/templatestrings.zh-Hant.json | 4 ++-- .../.template.config/localize/templatestrings.cs.json | 4 ++-- .../.template.config/localize/templatestrings.de.json | 4 ++-- .../.template.config/localize/templatestrings.es.json | 4 ++-- .../.template.config/localize/templatestrings.fr.json | 6 +++--- .../.template.config/localize/templatestrings.it.json | 4 ++-- .../.template.config/localize/templatestrings.ja.json | 4 ++-- .../.template.config/localize/templatestrings.ko.json | 4 ++-- .../.template.config/localize/templatestrings.pl.json | 4 ++-- .../.template.config/localize/templatestrings.pt-BR.json | 4 ++-- .../.template.config/localize/templatestrings.ru.json | 4 ++-- .../.template.config/localize/templatestrings.tr.json | 4 ++-- .../.template.config/localize/templatestrings.zh-Hans.json | 4 ++-- .../.template.config/localize/templatestrings.zh-Hant.json | 4 ++-- 78 files changed, 148 insertions(+), 148 deletions(-) diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.cs.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.cs.json index 044730cb13b..f325b4e449b 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.cs.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.cs.json @@ -11,7 +11,7 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Cíl net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "Framework", "symbols/langVersion/description": "Nastaví langVersion ve vytvořeném souboru projektu.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.de.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.de.json index 1a10b7e5577..f9704644a3c 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.de.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.de.json @@ -11,7 +11,7 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Ziel net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Ziel.-NET10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "Framework", "symbols/langVersion/description": "Legt „langVersion“ in der erstellten Projektdatei fest", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.es.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.es.json index f9ad3f888dd..3357097ba58 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.es.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.es.json @@ -11,7 +11,7 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 de destino", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Destino net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "Plataforma", "symbols/langVersion/description": "Establece langVersion en el archivo de proyecto creado.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.fr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.fr.json index ff47217a3cc..aea4afa6d0f 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.fr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.fr.json @@ -11,8 +11,8 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 cible", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", - "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", + "symbols/Framework/choices/net10.0/description": "Net10.0 cible", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "Framework", "symbols/langVersion/description": "Définit langVersion dans le fichier projet créé", "symbols/langVersion/displayName": "Version du Langage", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.it.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.it.json index 0b96754ce1d..3688757a98a 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.it.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.it.json @@ -11,7 +11,7 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 di destinazione", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Destinazione net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "Framework", "symbols/langVersion/description": "Imposta langVersion nel file di progetto creato", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ja.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ja.json index c441683f6f6..9f6d1aaac12 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ja.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ja.json @@ -11,7 +11,7 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "ターゲット net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "ターゲット net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "フレームワーク", "symbols/langVersion/description": "作成されたプロジェクト ファイルで langVersion を設定します", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ko.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ko.json index 09f34aaa47b..be5848b1d6d 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ko.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ko.json @@ -11,7 +11,7 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "대상 net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "프레임워크", "symbols/langVersion/description": "만든 프로젝트 파일의 langVersion를 설정합니다", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.pl.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.pl.json index 2ef61c2776f..7a43aa1d047 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.pl.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.pl.json @@ -11,7 +11,7 @@ "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Docelowa platforma net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Docelowa platforma net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "Platforma", "symbols/langVersion/description": "Ustawia langVersion w utworzonym pliku projektu", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.pt-BR.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.pt-BR.json index dc93b5b3bd0..39c088cb88a 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.pt-BR.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.pt-BR.json @@ -11,7 +11,7 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Net10.0 de destino", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "Framework", "symbols/langVersion/description": "Define a langVersion no arquivo do projeto criado", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ru.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ru.json index 7d8a11f8579..4bfe815ffaf 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ru.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.ru.json @@ -11,7 +11,7 @@ "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Целевая среда net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Целевая платформа .NET 10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "Платформа", "symbols/langVersion/description": "Задает свойство langVersion в созданном файле проекта", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.tr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.tr.json index 762ca92c7f3..ce39708bd77 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.tr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.tr.json @@ -11,7 +11,7 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Hedef net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Hedef net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "Çerçeve", "symbols/langVersion/description": "Oluşturulan proje dosyasında langVersion'ı ayarlar", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.zh-Hans.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.zh-Hans.json index 70b910e1967..b79ab959268 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.zh-Hans.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.zh-Hans.json @@ -11,7 +11,7 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目标 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "目标 net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "框架", "symbols/langVersion/description": "在创建的项目文件中设置 langVersion", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.zh-Hant.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.zh-Hant.json index 24261d312d8..8953084528d 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.zh-Hant.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.zh-Hant.json @@ -11,7 +11,7 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目標 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "目標 net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", "symbols/Framework/displayName": "架構", "symbols/langVersion/description": "在建立的專案檔中設定 langVersion", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.cs.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.cs.json index 1f140f3a323..0b9cfe9786f 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.cs.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.cs.json @@ -12,9 +12,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Cíl net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Nastaví langVersion ve vytvořeném souboru projektu.", "symbols/langVersion/displayName": "Verze jazyka", "symbols/skipRestore/description": "Pokud se tato možnost zadá, přeskočí automatické obnovení projektu při vytvoření.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.de.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.de.json index 04f3735649e..5c0bb5b2bae 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.de.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.de.json @@ -12,9 +12,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Ziel net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Ziel.-NET10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Legt „langVersion“ in der erstellten Projektdatei fest", "symbols/langVersion/displayName": "Sprachversion", "symbols/skipRestore/description": "Wenn angegeben, wird die automatische Wiederherstellung des Projekts beim Erstellen übersprungen.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.es.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.es.json index cf4529c40f7..371ca03c7a4 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.es.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.es.json @@ -12,9 +12,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 de destino", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Destino net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Establece langVersion en el archivo de proyecto creado.", "symbols/langVersion/displayName": "Versión de lenguaje", "symbols/skipRestore/description": "Si se especifica, se omite la restauración automática del proyecto durante la creación.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.fr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.fr.json index d78a6115e18..0ed692b4def 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.fr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.fr.json @@ -12,9 +12,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 cible", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Net10.0 cible", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Définit langVersion dans le fichier projet créé", "symbols/langVersion/displayName": "Version du Langage", "symbols/skipRestore/description": "S’il est spécifié, ignore la restauration automatique du projet lors de la création.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.it.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.it.json index 843914325d6..099d398268d 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.it.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.it.json @@ -12,9 +12,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 di destinazione", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Destinazione net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Imposta langVersion nel file di progetto creato", "symbols/langVersion/displayName": "Versione linguaggio", "symbols/skipRestore/description": "Se specificato, ignora il ripristino automatico del progetto durante la creazione.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ja.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ja.json index b1107380863..898722795e4 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ja.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ja.json @@ -12,9 +12,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "ターゲット net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "ターゲット net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "作成されたプロジェクト ファイルで langVersion を設定します", "symbols/langVersion/displayName": "言語バージョン", "symbols/skipRestore/description": "指定した場合、作成時にプロジェクトの自動復元がスキップされます。", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ko.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ko.json index e6f3b5d3417..911fa5d5ab7 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ko.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ko.json @@ -12,9 +12,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "대상 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "대상 net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "만든 프로젝트 파일의 langVersion를 설정합니다", "symbols/langVersion/displayName": "언어 버전", "symbols/skipRestore/description": "지정된 경우, 프로젝트 생성 시 자동 복원을 건너뜁니다.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.pl.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.pl.json index 043ac2ab6a5..306ca801e4b 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.pl.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.pl.json @@ -12,9 +12,9 @@ "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Docelowa platforma net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Docelowa platforma net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Ustawia langVersion w utworzonym pliku projektu", "symbols/langVersion/displayName": "Wersja języka", "symbols/skipRestore/description": "Jeśli ta opcja jest określona, pomija automatyczne przywracanie projektu podczas tworzenia.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.pt-BR.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.pt-BR.json index bea421370bc..64284422b9e 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.pt-BR.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.pt-BR.json @@ -12,9 +12,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Net10.0 de destino", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Define a langVersion no arquivo do projeto criado", "symbols/langVersion/displayName": "Versão da Linguagem", "symbols/skipRestore/description": "Se especificado, ignora a restauração automática do projeto sendo criado.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ru.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ru.json index 9d9b7b165da..066e4695e1a 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ru.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.ru.json @@ -12,9 +12,9 @@ "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Целевая среда net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Целевая платформа .NET 10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Задает свойство langVersion в созданном файле проекта", "symbols/langVersion/displayName": "Версия языка", "symbols/skipRestore/description": "Если установлено, автоматическое восстановление проекта при создании пропускается.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.tr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.tr.json index 12fa834440a..af7fcac041b 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.tr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.tr.json @@ -12,9 +12,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Hedef net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Hedef net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Oluşturulan proje dosyasında langVersion'ı ayarlar", "symbols/langVersion/displayName": "Dil Sürümü", "symbols/skipRestore/description": "Belirtilmişse, oluşturulmakta olan projenin otomatik geri yüklenmesini atlar.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json index 5375f589a48..11b8deb8743 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json @@ -12,9 +12,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目标 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "目标 net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "在创建的项目文件中设置 langVersion", "symbols/langVersion/displayName": "语言版本", "symbols/skipRestore/description": "如果指定,则在创建时跳过项目的自动还原。", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json index 0a87d2f1d6d..598ffed2df7 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json @@ -12,9 +12,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目標 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "目標 net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "在建立的專案檔中設定 langVersion", "symbols/langVersion/displayName": "語言版本", "symbols/skipRestore/description": "若指定,會在建立時跳過專案的自動還原。", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.cs.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.cs.json index e416a7c87f6..07c66848b3f 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.cs.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.cs.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Cíl net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Nastaví langVersion ve vytvořeném souboru projektu.", "symbols/langVersion/displayName": "Verze jazyka", "symbols/skipRestore/description": "Pokud se tato možnost zadá, přeskočí automatické obnovení projektu při vytvoření.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.de.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.de.json index d495109b6f0..0fae4bb0919 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.de.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.de.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Ziel net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Ziel.-NET10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Legt „langVersion“ in der erstellten Projektdatei fest", "symbols/langVersion/displayName": "Sprachversion", "symbols/skipRestore/description": "Wenn angegeben, wird die automatische Wiederherstellung des Projekts beim Erstellen übersprungen.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.es.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.es.json index cb2e95aad7d..84890381b41 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.es.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.es.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 de destino", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Destino net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Establece langVersion en el archivo de proyecto creado.", "symbols/langVersion/displayName": "Versión de lenguaje", "symbols/skipRestore/description": "Si se especifica, se omite la restauración automática del proyecto durante la creación.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.fr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.fr.json index 28df94cf08a..10fdafbb3cd 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.fr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.fr.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 cible", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", - "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Net10.0 cible", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Définit langVersion dans le fichier projet créé", "symbols/langVersion/displayName": "Version du Langage", "symbols/skipRestore/description": "S’il est spécifié, ignore la restauration automatique du projet lors de la création.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.it.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.it.json index b41072959dc..74c0eff80c1 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.it.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.it.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 di destinazione", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Destinazione net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Imposta langVersion nel file di progetto creato", "symbols/langVersion/displayName": "Versione linguaggio", "symbols/skipRestore/description": "Se specificato, ignora il ripristino automatico del progetto durante la creazione.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ja.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ja.json index c2fc5096d3b..22189cb3729 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ja.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ja.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "ターゲット net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "ターゲット net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "作成されたプロジェクト ファイルで langVersion を設定します", "symbols/langVersion/displayName": "言語バージョン", "symbols/skipRestore/description": "指定した場合、作成時にプロジェクトの自動復元がスキップされます。", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ko.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ko.json index c20a10867ad..f9ac2af381a 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ko.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ko.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "대상 net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "만든 프로젝트 파일의 langVersion를 설정합니다", "symbols/langVersion/displayName": "언어 버전", "symbols/skipRestore/description": "지정된 경우, 프로젝트 생성 시 자동 복원을 건너뜁니다.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.pl.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.pl.json index 753b29a8fe9..8f572228925 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.pl.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.pl.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Docelowa platforma net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Docelowa platforma net 10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Ustawia langVersion w utworzonym pliku projektu", "symbols/langVersion/displayName": "Wersja języka", "symbols/skipRestore/description": "Jeśli ta opcja jest określona, pomija automatyczne przywracanie projektu podczas tworzenia.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.pt-BR.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.pt-BR.json index 6522693f762..e379a10acbc 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.pt-BR.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.pt-BR.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Net10.0 de destino", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Define a langVersion no arquivo do projeto criado", "symbols/langVersion/displayName": "Versão da Linguagem", "symbols/skipRestore/description": "Se especificado, ignora a restauração automática do projeto sendo criado.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ru.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ru.json index bb10305737f..a283d96c6cb 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ru.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.ru.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Целевая среда net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Целевая платформа .NET 10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Задает свойство langVersion в созданном файле проекта", "symbols/langVersion/displayName": "Версия языка", "symbols/skipRestore/description": "Если установлено, автоматическое восстановление проекта при создании пропускается.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.tr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.tr.json index 60b79a5440f..30d50288755 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.tr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.tr.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Hedef net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Hedef net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Oluşturulan proje dosyasında langVersion'ı ayarlar", "symbols/langVersion/displayName": "Dil Sürümü", "symbols/skipRestore/description": "Belirtilmişse, oluşturulmakta olan projenin otomatik geri yüklenmesini atlar.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.zh-Hans.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.zh-Hans.json index 0542a7f1c55..0b17368a870 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.zh-Hans.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.zh-Hans.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目标 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "目标 net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "在创建的项目文件中设置 langVersion", "symbols/langVersion/displayName": "语言版本", "symbols/skipRestore/description": "如果指定,则在创建时跳过项目的自动还原。", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.zh-Hant.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.zh-Hant.json index c182d9d4bd9..1b199b462a9 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.zh-Hant.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/localize/templatestrings.zh-Hant.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目標 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "目標 net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "在建立的專案檔中設定 langVersion", "symbols/langVersion/displayName": "語言版本", "symbols/skipRestore/description": "若指定,會在建立時跳過專案的自動還原。", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.cs.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.cs.json index f97e4192151..1d6c44ffd61 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.cs.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.cs.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Cíl net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Nastaví langVersion ve vytvořeném souboru projektu.", "symbols/langVersion/displayName": "Verze jazyka", "symbols/skipRestore/description": "Pokud se tato možnost zadá, přeskočí automatické obnovení projektu při vytvoření.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.de.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.de.json index 805c4655ba6..3762d8643bd 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.de.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.de.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Ziel net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Ziel.-NET10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Legt „langVersion“ in der erstellten Projektdatei fest", "symbols/langVersion/displayName": "Sprachversion", "symbols/skipRestore/description": "Wenn angegeben, wird die automatische Wiederherstellung des Projekts beim Erstellen übersprungen.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.es.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.es.json index c73e4d1e9d4..06cf50b75f7 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.es.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.es.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 de destino", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Destino net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Establece langVersion en el archivo de proyecto creado.", "symbols/langVersion/displayName": "Versión de lenguaje", "symbols/skipRestore/description": "Si se especifica, se omite la restauración automática del proyecto durante la creación.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.fr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.fr.json index 481c575c558..5136fbae663 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.fr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.fr.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 cible", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", - "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Net10.0 cible", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Définit langVersion dans le fichier projet créé", "symbols/langVersion/displayName": "Version du Langage", "symbols/skipRestore/description": "S’il est spécifié, ignore la restauration automatique du projet lors de la création.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.it.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.it.json index 87d3565bbe3..08435858b4c 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.it.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.it.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 di destinazione", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Destinazione net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Imposta langVersion nel file di progetto creato", "symbols/langVersion/displayName": "Versione linguaggio", "symbols/skipRestore/description": "Se specificato, ignora il ripristino automatico del progetto durante la creazione.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ja.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ja.json index 732dfa35aef..9f23d6803f2 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ja.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ja.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "ターゲット net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "ターゲット net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "作成されたプロジェクト ファイルで langVersion を設定します", "symbols/langVersion/displayName": "言語バージョン", "symbols/skipRestore/description": "指定した場合、作成時にプロジェクトの自動復元がスキップされます。", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ko.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ko.json index e0c9bcab908..9b500ccbdc2 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ko.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ko.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "대상 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "대상 net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "만든 프로젝트 파일의 langVersion를 설정합니다", "symbols/langVersion/displayName": "언어 버전", "symbols/skipRestore/description": "지정된 경우, 프로젝트 생성 시 자동 복원을 건너뜁니다.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.pl.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.pl.json index 80a990b5582..455ad6a5447 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.pl.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.pl.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Docelowa platforma net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Docelowa platforma net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Ustawia langVersion w utworzonym pliku projektu", "symbols/langVersion/displayName": "Wersja języka", "symbols/skipRestore/description": "Jeśli ta opcja jest określona, pomija automatyczne przywracanie projektu podczas tworzenia.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.pt-BR.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.pt-BR.json index 622e9ff6f8d..ca5f210fa65 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.pt-BR.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.pt-BR.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Net10.0 de destino", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Define a langVersion no arquivo do projeto criado", "symbols/langVersion/displayName": "Versão da Linguagem", "symbols/skipRestore/description": "Se especificado, ignora a restauração automática do projeto sendo criado.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ru.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ru.json index c39735dee98..cbbe33eee57 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ru.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.ru.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Целевая среда net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Целевая платформа .NET 10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Задает свойство langVersion в созданном файле проекта", "symbols/langVersion/displayName": "Версия языка", "symbols/skipRestore/description": "Если установлено, автоматическое восстановление проекта при создании пропускается.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.tr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.tr.json index 21dc672fd5b..cb59b4cc8fb 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.tr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.tr.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Hedef net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Hedef net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Oluşturulan proje dosyasında langVersion'ı ayarlar", "symbols/langVersion/displayName": "Dil Sürümü", "symbols/skipRestore/description": "Belirtilmişse, oluşturulmakta olan projenin otomatik geri yüklenmesini atlar.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json index c4129527166..90dcb9874d1 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目标 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "目标 net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "在创建的项目文件中设置 langVersion", "symbols/langVersion/displayName": "语言版本", "symbols/skipRestore/description": "如果指定,则在创建时跳过项目的自动还原。", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json index 8945552e94f..e7d3919ed6c 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目標 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "目標 net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "在建立的專案檔中設定 langVersion", "symbols/langVersion/displayName": "語言版本", "symbols/skipRestore/description": "若指定,會在建立時跳過專案的自動還原。", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.cs.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.cs.json index d468697d3a6..c7e5d2033bf 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.cs.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.cs.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Cíl net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Nastaví langVersion ve vytvořeném souboru projektu.", "symbols/langVersion/displayName": "Verze jazyka", "symbols/skipRestore/description": "Pokud se tato možnost zadá, přeskočí automatické obnovení projektu při vytvoření.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.de.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.de.json index 158a2103d94..dcb1e190534 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.de.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.de.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Ziel net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Ziel.-NET10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Legt „langVersion“ in der erstellten Projektdatei fest", "symbols/langVersion/displayName": "Sprachversion", "symbols/skipRestore/description": "Wenn angegeben, wird die automatische Wiederherstellung des Projekts beim Erstellen übersprungen.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.es.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.es.json index 901ec6a1821..f4891722abb 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.es.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.es.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 de destino", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Destino net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Establece langVersion en el archivo de proyecto creado.", "symbols/langVersion/displayName": "Versión de lenguaje", "symbols/skipRestore/description": "Si se especifica, se omite la restauración automática del proyecto durante la creación.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.fr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.fr.json index 162c2d7bdf4..6cc3f55a5e7 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.fr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.fr.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 cible", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", - "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Net10.0 cible", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Définit langVersion dans le fichier projet créé", "symbols/langVersion/displayName": "Version du Langage", "symbols/skipRestore/description": "S’il est spécifié, ignore la restauration automatique du projet lors de la création.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.it.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.it.json index 876523e2d06..7e0a837ef08 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.it.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.it.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 di destinazione", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Destinazione net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Imposta langVersion nel file di progetto creato", "symbols/langVersion/displayName": "Versione linguaggio", "symbols/skipRestore/description": "Se specificato, ignora il ripristino automatico del progetto durante la creazione.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ja.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ja.json index a754950edc8..a60a8e7177b 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ja.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ja.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "ターゲット net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "ターゲット net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "作成されたプロジェクト ファイルで langVersion を設定します", "symbols/langVersion/displayName": "言語バージョン", "symbols/skipRestore/description": "指定した場合、作成時にプロジェクトの自動復元がスキップされます。", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ko.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ko.json index 179a12388da..c4357d61214 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ko.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ko.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "대상 net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "만든 프로젝트 파일의 langVersion를 설정합니다", "symbols/langVersion/displayName": "언어 버전", "symbols/skipRestore/description": "지정된 경우, 프로젝트 생성 시 자동 복원을 건너뜁니다.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.pl.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.pl.json index fd873b11bcf..09d5b0f09b8 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.pl.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.pl.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Docelowa platforma net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Docelowa platforma net 10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Ustawia langVersion w utworzonym pliku projektu", "symbols/langVersion/displayName": "Wersja języka", "symbols/skipRestore/description": "Jeśli ta opcja jest określona, pomija automatyczne przywracanie projektu podczas tworzenia.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.pt-BR.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.pt-BR.json index 79b88fa3f2a..82a0159ade5 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.pt-BR.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.pt-BR.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Net10.0 de destino", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Define a langVersion no arquivo do projeto criado", "symbols/langVersion/displayName": "Versão da Linguagem", "symbols/skipRestore/description": "Se especificado, ignora a restauração automática do projeto sendo criado.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ru.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ru.json index 8357dfb3f04..8a89d7c47fe 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ru.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.ru.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Целевая среда net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Целевая платформа .NET 10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Задает свойство langVersion в созданном файле проекта", "symbols/langVersion/displayName": "Версия языка", "symbols/skipRestore/description": "Если установлено, автоматическое восстановление проекта при создании пропускается.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.tr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.tr.json index 80a5bb9b001..75447295c5e 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.tr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.tr.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Hedef net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Hedef net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Oluşturulan proje dosyasında langVersion'ı ayarlar", "symbols/langVersion/displayName": "Dil Sürümü", "symbols/skipRestore/description": "Belirtilmişse, oluşturulmakta olan projenin otomatik geri yüklenmesini atlar.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.zh-Hans.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.zh-Hans.json index 0835ca6281a..012a91ca619 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.zh-Hans.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.zh-Hans.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目标 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "目标 net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "在创建的项目文件中设置 langVersion", "symbols/langVersion/displayName": "语言版本", "symbols/skipRestore/description": "如果指定,则在创建时跳过项目的自动还原。", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.zh-Hant.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.zh-Hant.json index 9ffa17d0943..65824d08b5b 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.zh-Hant.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/localize/templatestrings.zh-Hant.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目標 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "目標 net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "在建立的專案檔中設定 langVersion", "symbols/langVersion/displayName": "語言版本", "symbols/skipRestore/description": "若指定,會在建立時跳過專案的自動還原。", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.cs.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.cs.json index f5b7a026b8d..ba49167cd6c 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.cs.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.cs.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Cíl net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Nastaví langVersion ve vytvořeném souboru projektu.", "symbols/langVersion/displayName": "Verze jazyka", "symbols/skipRestore/description": "Pokud se tato možnost zadá, přeskočí automatické obnovení projektu při vytvoření.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.de.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.de.json index b0046074833..757127bb3b9 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.de.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.de.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Ziel net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Ziel.-NET10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Legt „langVersion“ in der erstellten Projektdatei fest", "symbols/langVersion/displayName": "Sprachversion", "symbols/skipRestore/description": "Wenn angegeben, wird die automatische Wiederherstellung des Projekts beim Erstellen übersprungen.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.es.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.es.json index 1e4d982d5ad..b3ea513ea3d 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.es.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.es.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 de destino", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Destino net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Establece langVersion en el archivo de proyecto creado.", "symbols/langVersion/displayName": "Versión de lenguaje", "symbols/skipRestore/description": "Si se especifica, se omite la restauración automática del proyecto durante la creación.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.fr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.fr.json index bc124f6a53e..972a99dd64c 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.fr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.fr.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 cible", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", - "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/choices/net10.0/description": "Net10.0 cible", + "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Définit langVersion dans le fichier projet créé", "symbols/langVersion/displayName": "Version du Langage", "symbols/skipRestore/description": "S’il est spécifié, ignore la restauration automatique du projet lors de la création.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.it.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.it.json index cb6f76c0b7f..d70464dff41 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.it.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.it.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Net9.0 di destinazione", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Destinazione net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Imposta langVersion nel file di progetto creato", "symbols/langVersion/displayName": "Versione linguaggio", "symbols/skipRestore/description": "Se specificato, ignora il ripristino automatico del progetto durante la creazione.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ja.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ja.json index 6f6fb6cadf4..49dbc71e073 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ja.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ja.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "ターゲット net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "ターゲット net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "作成されたプロジェクト ファイルで langVersion を設定します", "symbols/langVersion/displayName": "言語バージョン", "symbols/skipRestore/description": "指定した場合、作成時にプロジェクトの自動復元がスキップされます。", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ko.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ko.json index fe446fb6065..267ac906562 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ko.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ko.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "대상 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "대상 net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "만든 프로젝트 파일의 langVersion를 설정합니다", "symbols/langVersion/displayName": "언어 버전", "symbols/skipRestore/description": "지정된 경우, 프로젝트 생성 시 자동 복원을 건너뜁니다.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.pl.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.pl.json index 92cb533e798..9c75681ad56 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.pl.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.pl.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Docelowa platforma net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Docelowa platforma net 10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Ustawia langVersion w utworzonym pliku projektu", "symbols/langVersion/displayName": "Wersja języka", "symbols/skipRestore/description": "Jeśli ta opcja jest określona, pomija automatyczne przywracanie projektu podczas tworzenia.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.pt-BR.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.pt-BR.json index 2f69491e49d..45f827daf28 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.pt-BR.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.pt-BR.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Target net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Net10.0 de destino", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Define a langVersion no arquivo do projeto criado", "symbols/langVersion/displayName": "Versão da Linguagem", "symbols/skipRestore/description": "Se especificado, ignora a restauração automática do projeto sendo criado.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ru.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ru.json index 625003ab5a7..4c6ab264342 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ru.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.ru.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": "NET 8.0", "symbols/Framework/choices/net9.0/description": "Целевая среда net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Целевая платформа .NET 10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Задает свойство langVersion в созданном файле проекта", "symbols/langVersion/displayName": "Версия языка", "symbols/skipRestore/description": "Если установлено, автоматическое восстановление проекта при создании пропускается.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.tr.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.tr.json index e3566507e47..7b942438988 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.tr.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.tr.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "Hedef net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "Hedef net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "Oluşturulan proje dosyasında langVersion'ı ayarlar", "symbols/langVersion/displayName": "Dil Sürümü", "symbols/skipRestore/description": "Belirtilmişse, oluşturulmakta olan projenin otomatik geri yüklenmesini atlar.", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json index eecf4960a36..133a8ce779d 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hans.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目标 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "目标 net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "在创建的项目文件中设置 langVersion", "symbols/langVersion/displayName": "语言版本", "symbols/skipRestore/description": "如果指定,则在创建时跳过项目的自动还原。", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json index 64260319a8b..1446d5b3c0f 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-VisualBasic/.template.config/localize/templatestrings.zh-Hant.json @@ -11,9 +11,9 @@ "symbols/Framework/choices/net8.0/displayName": ".NET 8.0", "symbols/Framework/choices/net9.0/description": "目標 net9.0", "symbols/Framework/choices/net9.0/displayName": ".NET 9.0", - "symbols/Framework/choices/net10.0/description": "Target net10.0", + "symbols/Framework/choices/net10.0/description": "目標 net10.0", "symbols/Framework/choices/net10.0/displayName": ".NET 10.0", - "symbols/Framework/displayName": ".NET 9.0", + "symbols/Framework/displayName": ".NET 10.0", "symbols/langVersion/description": "在建立的專案檔中設定 langVersion", "symbols/langVersion/displayName": "語言版本", "symbols/skipRestore/description": "若指定,會在建立時跳過專案的自動還原。", From 6a90a3853421f0b34ff5599bea7bd5c58c650415 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Tue, 3 Dec 2024 20:23:51 +0100 Subject: [PATCH 070/106] Annotate test utility projects so that they don't get built inside the VMR (#12577) * Annotate test utility projects so that they don't get built inside the VMR product build * another one --- .../System.Private.Windows.Core.TestUtilities.csproj | 2 ++ .../VisualBasicRuntimeTest/VisualBasicRuntimeTest.csproj | 1 + .../System.Windows.Forms.Primitives.TestUtilities.csproj | 1 + .../tests/AccessibilityTests/Accessibility_Core_App.csproj | 1 + src/System.Windows.Forms/tests/AxHosts/AxHosts.csproj | 1 + .../DesignSurface/DemoConsole/DemoConsole.csproj | 1 + .../DesignSurface/DesignSurfaceExt/DesignSurfaceExt.csproj | 1 + .../NativeHost.ManagedControl/NativeHost.ManagedControl.csproj | 1 + .../tests/IntegrationTests/ScratchProject/ScratchProject.csproj | 1 + .../ScratchProjectWithInternals.csproj | 1 + .../System.Windows.Forms.IntegrationTests.Common.csproj | 1 + .../tests/IntegrationTests/TrimTest/TrimTest.csproj | 1 + .../TrimTestBinaryDeserialization.csproj | 1 + .../IntegrationTests/VisualBasicTemplate/VbWinForms.vbproj | 1 + .../WinformsControlsTest/WinformsControlsTest.csproj | 1 + .../TestUtilities/System.Windows.Forms.TestUtilities.csproj | 2 ++ 16 files changed, 18 insertions(+) diff --git a/src/Common/tests/TestUtilities/System.Private.Windows.Core.TestUtilities.csproj b/src/Common/tests/TestUtilities/System.Private.Windows.Core.TestUtilities.csproj index 2585fb96851..75fa34a2ea6 100644 --- a/src/Common/tests/TestUtilities/System.Private.Windows.Core.TestUtilities.csproj +++ b/src/Common/tests/TestUtilities/System.Private.Windows.Core.TestUtilities.csproj @@ -1,4 +1,5 @@  + System.Private.Windows.Core.TestUtilities true @@ -6,6 +7,7 @@ enable true false + true diff --git a/src/Microsoft.VisualBasic/tests/IntegrationTests/VisualBasicRuntimeTest/VisualBasicRuntimeTest.csproj b/src/Microsoft.VisualBasic/tests/IntegrationTests/VisualBasicRuntimeTest/VisualBasicRuntimeTest.csproj index 8f3ddde355d..b918ce7450b 100644 --- a/src/Microsoft.VisualBasic/tests/IntegrationTests/VisualBasicRuntimeTest/VisualBasicRuntimeTest.csproj +++ b/src/Microsoft.VisualBasic/tests/IntegrationTests/VisualBasicRuntimeTest/VisualBasicRuntimeTest.csproj @@ -2,6 +2,7 @@ Exe + true diff --git a/src/System.Windows.Forms.Primitives/tests/TestUtilities/System.Windows.Forms.Primitives.TestUtilities.csproj b/src/System.Windows.Forms.Primitives/tests/TestUtilities/System.Windows.Forms.Primitives.TestUtilities.csproj index 5d0859b2ba8..171f7ff4961 100644 --- a/src/System.Windows.Forms.Primitives/tests/TestUtilities/System.Windows.Forms.Primitives.TestUtilities.csproj +++ b/src/System.Windows.Forms.Primitives/tests/TestUtilities/System.Windows.Forms.Primitives.TestUtilities.csproj @@ -7,6 +7,7 @@ SYSLIB5005: System.Formats.Nrbf is experimental --> $(NoWarn);SYSLIB5005 + true diff --git a/src/System.Windows.Forms/tests/AccessibilityTests/Accessibility_Core_App.csproj b/src/System.Windows.Forms/tests/AccessibilityTests/Accessibility_Core_App.csproj index 22fd7e26574..9d1a43e501e 100644 --- a/src/System.Windows.Forms/tests/AccessibilityTests/Accessibility_Core_App.csproj +++ b/src/System.Windows.Forms/tests/AccessibilityTests/Accessibility_Core_App.csproj @@ -7,6 +7,7 @@ app.manifest false false + true diff --git a/src/System.Windows.Forms/tests/AxHosts/AxHosts.csproj b/src/System.Windows.Forms/tests/AxHosts/AxHosts.csproj index 46255e17dd4..25be013979a 100644 --- a/src/System.Windows.Forms/tests/AxHosts/AxHosts.csproj +++ b/src/System.Windows.Forms/tests/AxHosts/AxHosts.csproj @@ -15,6 +15,7 @@ false true true + true diff --git a/src/System.Windows.Forms/tests/IntegrationTests/DesignSurface/DemoConsole/DemoConsole.csproj b/src/System.Windows.Forms/tests/IntegrationTests/DesignSurface/DemoConsole/DemoConsole.csproj index a32e902efc8..00c6f5543cf 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/DesignSurface/DemoConsole/DemoConsole.csproj +++ b/src/System.Windows.Forms/tests/IntegrationTests/DesignSurface/DemoConsole/DemoConsole.csproj @@ -20,6 +20,7 @@ true + true diff --git a/src/System.Windows.Forms/tests/IntegrationTests/DesignSurface/DesignSurfaceExt/DesignSurfaceExt.csproj b/src/System.Windows.Forms/tests/IntegrationTests/DesignSurface/DesignSurfaceExt/DesignSurfaceExt.csproj index 861a3782936..9bd31da0816 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/DesignSurface/DesignSurfaceExt/DesignSurfaceExt.csproj +++ b/src/System.Windows.Forms/tests/IntegrationTests/DesignSurface/DesignSurfaceExt/DesignSurfaceExt.csproj @@ -20,6 +20,7 @@ true + true diff --git a/src/System.Windows.Forms/tests/IntegrationTests/NativeHost.ManagedControl/NativeHost.ManagedControl.csproj b/src/System.Windows.Forms/tests/IntegrationTests/NativeHost.ManagedControl/NativeHost.ManagedControl.csproj index 2cea3f9e2a2..7c1298e9eeb 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/NativeHost.ManagedControl/NativeHost.ManagedControl.csproj +++ b/src/System.Windows.Forms/tests/IntegrationTests/NativeHost.ManagedControl/NativeHost.ManagedControl.csproj @@ -6,6 +6,7 @@ true false false + true diff --git a/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject/ScratchProject.csproj b/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject/ScratchProject.csproj index 773f754997e..a9c8b393905 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject/ScratchProject.csproj +++ b/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject/ScratchProject.csproj @@ -10,6 +10,7 @@ false false + true false false + true diff --git a/src/System.Windows.Forms/tests/IntegrationTests/System.Windows.Forms.IntegrationTests.Common/System.Windows.Forms.IntegrationTests.Common.csproj b/src/System.Windows.Forms/tests/IntegrationTests/System.Windows.Forms.IntegrationTests.Common/System.Windows.Forms.IntegrationTests.Common.csproj index 82b1b5f9352..db1140ddaf1 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/System.Windows.Forms.IntegrationTests.Common/System.Windows.Forms.IntegrationTests.Common.csproj +++ b/src/System.Windows.Forms/tests/IntegrationTests/System.Windows.Forms.IntegrationTests.Common/System.Windows.Forms.IntegrationTests.Common.csproj @@ -2,6 +2,7 @@ false + true diff --git a/src/System.Windows.Forms/tests/IntegrationTests/TrimTest/TrimTest.csproj b/src/System.Windows.Forms/tests/IntegrationTests/TrimTest/TrimTest.csproj index f71fe3efc27..4189f23d366 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/TrimTest/TrimTest.csproj +++ b/src/System.Windows.Forms/tests/IntegrationTests/TrimTest/TrimTest.csproj @@ -9,6 +9,7 @@ false false + true diff --git a/src/System.Windows.Forms/tests/IntegrationTests/TrimTestBinaryDeserialization/TrimTestBinaryDeserialization.csproj b/src/System.Windows.Forms/tests/IntegrationTests/TrimTestBinaryDeserialization/TrimTestBinaryDeserialization.csproj index ac78f8dcb95..5ec925c07bf 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/TrimTestBinaryDeserialization/TrimTestBinaryDeserialization.csproj +++ b/src/System.Windows.Forms/tests/IntegrationTests/TrimTestBinaryDeserialization/TrimTestBinaryDeserialization.csproj @@ -10,6 +10,7 @@ false false false + true diff --git a/src/System.Windows.Forms/tests/TestUtilities/System.Windows.Forms.TestUtilities.csproj b/src/System.Windows.Forms/tests/TestUtilities/System.Windows.Forms.TestUtilities.csproj index 1061873c919..9bc787568b9 100644 --- a/src/System.Windows.Forms/tests/TestUtilities/System.Windows.Forms.TestUtilities.csproj +++ b/src/System.Windows.Forms/tests/TestUtilities/System.Windows.Forms.TestUtilities.csproj @@ -1,8 +1,10 @@  + System.Windows.Forms.TestUtilities true System + true From f432c76433d916d7c9762e50e6abf59d9ec41f2c Mon Sep 17 00:00:00 2001 From: Jeremy Kuhne Date: Tue, 3 Dec 2024 15:06:47 -0800 Subject: [PATCH 071/106] Define WIC HRESULTs (#12579) Needed for WPF scenarios currently and likely for our own usages as well eventualy. --- src/System.Private.Windows.Core/src/NativeMethods.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/System.Private.Windows.Core/src/NativeMethods.txt b/src/System.Private.Windows.Core/src/NativeMethods.txt index 806f9fd414d..c61bef77b73 100644 --- a/src/System.Private.Windows.Core/src/NativeMethods.txt +++ b/src/System.Private.Windows.Core/src/NativeMethods.txt @@ -235,6 +235,7 @@ TYPE_E_BADMODULEKIND UNICODE_STRING_MAX_CHARS VIEW_E_DRAW WIN32_ERROR +WINCODEC_ERR_* WINDOW_LONG_PTR_INDEX WindowFromDC WM_* From f5ef4b1375842ce719a28ecf16c46962ef777e7e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 13:41:36 +0000 Subject: [PATCH 072/106] [main] Update dependencies from dotnet/runtime (#12583) [main] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 58 ++++++------- global.json | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e009cd41910..e1a425787ca 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 - + https://github.com/dotnet/runtime - 12afdedd8050847aa90473e254fa782f54360990 + 7dbe407ee8f709e7d37e81e185605d328208bc72 diff --git a/eng/Versions.props b/eng/Versions.props index 416117ae9e8..5d4fe5ae7b5 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 - 10.0.0-alpha.1.24603.1 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24603.18 diff --git a/global.json b/global.json index d173e9a299a..969208f2627 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24578.2", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24578.2", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24603.1" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24603.18" }, "native-tools": { "cmake": "latest" From a1405f6bb31ec035a60ddaebb85c287fcbee07ba Mon Sep 17 00:00:00 2001 From: v-olzhan Date: Wed, 4 Dec 2024 17:57:54 +0000 Subject: [PATCH 073/106] Add unit tests for LinkLabel (#12572) * Add unit tests for LinkLabel * handle feedback * handle feedback2 --- .../tests/UnitTests/LinkLabelTests.cs | 246 +++++++++++++++++- 1 file changed, 240 insertions(+), 6 deletions(-) diff --git a/src/System.Windows.Forms/tests/UnitTests/LinkLabelTests.cs b/src/System.Windows.Forms/tests/UnitTests/LinkLabelTests.cs index c265fcee79f..f4174deb37e 100644 --- a/src/System.Windows.Forms/tests/UnitTests/LinkLabelTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/LinkLabelTests.cs @@ -1,18 +1,252 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +#nullable enable + +using System.Drawing; + namespace System.Windows.Forms.Tests; -public class LinkLabelTests +public class LinkLabelTests : IDisposable { + private readonly LinkLabel _linkLabel = new(); + + public void Dispose() => _linkLabel.Dispose(); + [WinFormsFact] public void LinkLabel_Constructor() { - using LinkLabel label = new(); + _linkLabel.Should().NotBeNull(); + _linkLabel.LinkArea.IsEmpty.Should().BeTrue(); + _linkLabel.LinkArea.Start.Should().Be(0); + _linkLabel.LinkArea.Length.Should().Be(0); + } + + [WinFormsFact] + public void LinkLabel_FlatStyle_Get_ReturnsExpected() + { + _linkLabel.FlatStyle.Should().Be(FlatStyle.Standard); + } + + [WinFormsTheory] + [InlineData(FlatStyle.Flat)] + [InlineData(FlatStyle.Popup)] + [InlineData(FlatStyle.System)] + public void LinkLabel_FlatStyle_Set_ReturnsExpected(FlatStyle flatStyle) + { + _linkLabel.FlatStyle = flatStyle; + + _linkLabel.FlatStyle.Should().Be(flatStyle); + } + + [WinFormsFact] + public void LinkLabel_LinkArea_Get_ReturnsExpected() + { + _linkLabel.LinkArea.Should().Be(new LinkArea(0, 0)); + } + + [WinFormsFact] + public void LinkLabel_LinkArea_Set_ReturnsExpected() + { + LinkArea linkArea1 = new LinkArea(1, 2); + LinkArea linkArea2 = new LinkArea(3, 4); + + _linkLabel.LinkArea = linkArea1; + _linkLabel.LinkArea.Should().Be(linkArea1); + + _linkLabel.LinkArea = linkArea2; + _linkLabel.LinkArea.Should().Be(linkArea2); + } + + [WinFormsTheory] + [InlineData(-1, 2)] // Test with negative Start + [InlineData(1, -2)] // Test with negative Length + public void LinkLabel_LinkArea_Set_InvalidValues_ThrowsArgumentOutOfRangeException(int start, int length) + { + Action act = () => _linkLabel.LinkArea = new LinkArea(start, length); + act.Should().Throw().WithMessage("*LinkArea*"); + } + + [WinFormsFact] + public void LinkLabel_LinkArea_Set_UpdatesSelectability() + { + _linkLabel.Text = "Text"; + _linkLabel.LinkArea = new LinkArea(1, 2); + _linkLabel.TabStop.Should().BeTrue(); + + _linkLabel.LinkArea = new LinkArea(0, 0); + _linkLabel.TabStop.Should().BeFalse(); + } + + [WinFormsFact] + public void LinkLabel_LinkBehavior_Get_ReturnsExpected() + { + _linkLabel.LinkBehavior.Should().Be(LinkBehavior.SystemDefault); + } + + [WinFormsTheory] + [InlineData(LinkBehavior.AlwaysUnderline)] + [InlineData(LinkBehavior.HoverUnderline)] + [InlineData(LinkBehavior.NeverUnderline)] + public void LinkLabel_LinkBehavior_Set_ReturnsExpected(LinkBehavior linkBehavior) + { + _linkLabel.LinkBehavior = linkBehavior; + _linkLabel.LinkBehavior.Should().Be(linkBehavior); + } + + [WinFormsFact] + public void LinkLabel_LinkVisited_Get_ReturnsExpected() + { + _linkLabel.LinkVisited.Should().BeFalse(); + } + + [WinFormsTheory] + [InlineData(true)] + [InlineData(false)] + public void LinkLabel_LinkVisited_Set_ReturnsExpected(bool expectedVisited) + { + _linkLabel.LinkVisited = expectedVisited; + _linkLabel.LinkVisited.Should().Be(expectedVisited); + } + + [WinFormsFact] + public void LinkLabel_LinkVisited_Set_AddsLinkIfNoneExists() + { + _linkLabel.LinkVisited = true; + _linkLabel.Links.Count.Should().Be(1); + _linkLabel.Links[0].Visited.Should().BeTrue(); + } + + [WinFormsFact] + public void LinkLabel_LinkVisited_Set_UpdatesExistingLink() + { + _linkLabel.Links.Add(new LinkLabel.Link(_linkLabel) { Visited = false }); + _linkLabel.LinkVisited = true; + _linkLabel.Links[0].Visited.Should().BeTrue(); + + _linkLabel.LinkVisited = false; + _linkLabel.Links[0].Visited.Should().BeFalse(); + } + + [WinFormsFact] + public void LinkLabel_TabStop_Get_ReturnsExpected() + { + _linkLabel.TabStop.Should().BeFalse(); + } + + [WinFormsTheory] + [InlineData(true)] + [InlineData(false)] + public void LinkLabel_TabStop_Set_ReturnsExpected(bool expectedTabStop) + { + _linkLabel.TabStop = expectedTabStop; + _linkLabel.TabStop.Should().Be(expectedTabStop); + } + + [WinFormsFact] + public void LinkLabel_TabStop_Set_RaisesTabStopChangedEvent() + { + bool eventRaised = false; + _linkLabel.TabStopChanged += (sender, e) => eventRaised = true; + + _linkLabel.TabStop = true; + eventRaised.Should().BeTrue(); + + eventRaised = false; + _linkLabel.TabStop = false; + eventRaised.Should().BeTrue(); + } + + [WinFormsFact] + public void LinkLabel_Padding_Get_ReturnsExpected() + { + _linkLabel.Padding.Should().Be(new Padding(0)); + } + + [WinFormsFact] + public void LinkLabel_Padding_Set_ReturnsExpected() + { + Padding padding1 = new(1, 2, 3, 4); + Padding padding2 = new(5); + + _linkLabel.Padding = padding1; + _linkLabel.Padding.Should().Be(padding1); + + _linkLabel.Padding = padding2; + _linkLabel.Padding.Should().Be(padding2); + } + + [WinFormsFact] + public void LinkLabel_VisitedLinkColor_Get_ReturnsExpected() + { + _linkLabel.VisitedLinkColor.Should().Be(LinkUtilities.GetVisitedLinkColor()); + } - Assert.NotNull(label); - Assert.True(label.LinkArea.IsEmpty); - Assert.Equal(0, label.LinkArea.Start); - Assert.Equal(0, label.LinkArea.Length); + [WinFormsFact] + public void LinkLabel_VisitedLinkColor_Set_ReturnsExpected() + { + _linkLabel.VisitedLinkColor = Color.Red; + _linkLabel.VisitedLinkColor.Should().Be(Color.Red); + + _linkLabel.VisitedLinkColor = Color.Blue; + _linkLabel.VisitedLinkColor.Should().Be(Color.Blue); + } + + [WinFormsFact] + public void LinkLabel_VisitedLinkColor_Set_UpdatesLink() + { + _linkLabel.Links.Add(new LinkLabel.Link(_linkLabel) { Visited = true }); + _linkLabel.VisitedLinkColor = Color.Red; + _linkLabel.VisitedLinkColor.Should().Be(Color.Red); + } + + [WinFormsFact] + public void LinkLabel_LinkClicked_RaisesEvent() + { + using TestLinkLabel label = new(); + bool eventRaised = false; + label.LinkClicked += (sender, e) => eventRaised = true; + + var link = new LinkLabel.Link(label); + label.Links.Add(link); + label.OnLinkClicked(new LinkLabelLinkClickedEventArgs(link)); + + eventRaised.Should().BeTrue(); + } + + [WinFormsFact] + public void LinkLabel_UseCompatibleTextRendering_Get_ReturnsExpected() + { + _linkLabel.UseCompatibleTextRendering.Should().BeTrue(); + } + + [WinFormsTheory] + [InlineData(true)] + [InlineData(false)] + public void LinkLabel_UseCompatibleTextRendering_Set_ReturnsExpected(bool expectedValue) + { + _linkLabel.UseCompatibleTextRendering = expectedValue; + _linkLabel.UseCompatibleTextRendering.Should().Be(expectedValue); + } + + [WinFormsFact] + public void LinkLabel_UseCompatibleTextRendering_Set_TriggersLayout() + { + bool layoutCalled = false; + _linkLabel.Layout += (sender, e) => layoutCalled = true; + + _linkLabel.UseCompatibleTextRendering = true; + _linkLabel.PerformLayout(); + layoutCalled.Should().BeTrue(); + + layoutCalled = false; + _linkLabel.UseCompatibleTextRendering = false; + _linkLabel.PerformLayout(); + layoutCalled.Should().BeTrue(); + } + + private class TestLinkLabel : LinkLabel + { + public new void OnLinkClicked(LinkLabelLinkClickedEventArgs e) => base.OnLinkClicked(e); } } From 4673159e5daec8a4161711f106c47923a4a96e38 Mon Sep 17 00:00:00 2001 From: Tanya Solyanik Date: Wed, 4 Dec 2024 10:53:28 -0800 Subject: [PATCH 074/106] removed unnecessary casts that I had missed before (#12585) removed unnecessary casts added a baseline test for the future changes --- .../System/Windows/Forms/OLE/DataObject.cs | 24 +++--- .../Forms/BinaryFormatUtilitiesTests.cs | 80 ++++++++++++++----- 2 files changed, 70 insertions(+), 34 deletions(-) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs index f50e2a0329e..fad22a38131 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs @@ -92,32 +92,30 @@ internal IDataObject TryUnwrapInnerIDataObject() internal IDataObject? OriginalIDataObject => _innerData.OriginalIDataObject; #region IDataObject - public virtual object? GetData(string format, bool autoConvert) => - ((IDataObject)_innerData).GetData(format, autoConvert); + public virtual object? GetData(string format, bool autoConvert) => _innerData.GetData(format, autoConvert); public virtual object? GetData(string format) => GetData(format, autoConvert: true); public virtual object? GetData(Type format) => format is null ? null : GetData(format.FullName!); - public virtual bool GetDataPresent(string format, bool autoConvert) => - ((IDataObject)_innerData).GetDataPresent(format, autoConvert); + public virtual bool GetDataPresent(string format, bool autoConvert) => _innerData.GetDataPresent(format, autoConvert); public virtual bool GetDataPresent(string format) => GetDataPresent(format, autoConvert: true); public virtual bool GetDataPresent(Type format) => format is not null && GetDataPresent(format.FullName!); - public virtual string[] GetFormats(bool autoConvert) => ((IDataObject)_innerData).GetFormats(autoConvert); + public virtual string[] GetFormats(bool autoConvert) => _innerData.GetFormats(autoConvert); public virtual string[] GetFormats() => GetFormats(autoConvert: true); - public virtual void SetData(string format, bool autoConvert, object? data) - => ((IDataObject)_innerData).SetData(format, autoConvert, data); + public virtual void SetData(string format, bool autoConvert, object? data) => + _innerData.SetData(format, autoConvert, data); - public virtual void SetData(string format, object? data) => ((IDataObject)_innerData).SetData(format, data); + public virtual void SetData(string format, object? data) => _innerData.SetData(format, data); - public virtual void SetData(Type format, object? data) => ((IDataObject)_innerData).SetData(format, data); + public virtual void SetData(Type format, object? data) => _innerData.SetData(format, data); - public virtual void SetData(object? data) => ((IDataObject)_innerData).SetData(data); + public virtual void SetData(object? data) => _innerData.SetData(data); #endregion public virtual bool ContainsAudio() => GetDataPresent(DataFormats.WaveAudioConstant, autoConvert: false); @@ -150,15 +148,15 @@ public virtual StringCollection GetFileDropList() public virtual Image? GetImage() => GetData(DataFormats.Bitmap, autoConvert: true) as Image; - public virtual string GetText() => GetText(TextDataFormat.UnicodeText); - public virtual string GetText(TextDataFormat format) { // Valid values are 0x0 to 0x4 SourceGenerated.EnumValidator.Validate(format, nameof(format)); - return GetData(ConvertToDataFormats(format), false) is string text ? text : string.Empty; + return GetData(ConvertToDataFormats(format), autoConvert: false) is string text ? text : string.Empty; } + public virtual string GetText() => GetText(TextDataFormat.UnicodeText); + public virtual void SetAudio(byte[] audioBytes) => SetAudio(new MemoryStream(audioBytes.OrThrowIfNull())); public virtual void SetAudio(Stream audioStream) => diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.cs index aa2ad96651c..6b392d74422 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.cs @@ -18,27 +18,31 @@ public partial class BinaryFormatUtilitiesTests : IDisposable public void Dispose() => _stream.Dispose(); + private void WriteObjectToStream(object value, bool restrictSerialization = false) => + Utilities.WriteObjectToStream(_stream, value, restrictSerialization); + + private object? ReadObjectFromStream(bool restrictDeserialization = false) + { + _stream.Position = 0; + return Utilities.ReadObjectFromStream(_stream, restrictDeserialization); + } + private object? RoundTripObject(object value) { - Utilities.WriteObjectToStream(_stream, value, restrictSerialization: false); + // This is equivalent to SetData/GetData methods with unbounded formats, + // and works with the BinaryFormat AppContext switches. + WriteObjectToStream(value); return ReadObjectFromStream(); } private object? RoundTripObject_RestrictedFormat(object value) { - Utilities.WriteObjectToStream(_stream, value, restrictSerialization: true); + // This is equivalent to SetData/GetData methods using registered OLE formats and thus the BitmapBinder, + // and works with the BF AppCompat switches. + WriteObjectToStream(value, restrictSerialization: true); return ReadObjectFromStream(restrictDeserialization: true); } - private void WriteObjectToStream(object value, bool restrictSerialization = false) => - Utilities.WriteObjectToStream(_stream, value, restrictSerialization); - - private object? ReadObjectFromStream(bool restrictDeserialization = false) - { - _stream.Position = 0; - return Utilities.ReadObjectFromStream(_stream, restrictDeserialization); - } - // Primitive types as defined by the NRBF spec. // https://learn.microsoft.com/dotnet/api/system.formats.nrbf.primitivetyperecord public static TheoryData PrimitiveObjects_TheoryData => @@ -54,17 +58,17 @@ private void WriteObjectToStream(object value, bool restrictSerialization = fals (float)9.0, 10.0, 'a', - true + true, + "string", + DateTime.Now, + TimeSpan.FromHours(1), + decimal.MaxValue ]; public static TheoryData KnownObjects_TheoryData => [ - "string", - DateTime.Now, - TimeSpan.FromHours(1), -(nint)11, (nuint)12, - decimal.MaxValue, new PointF(1, 2), new RectangleF(1, 2, 3, 4), new Point(-1, int.MaxValue), @@ -167,7 +171,9 @@ private void WriteObjectToStream(object value, bool restrictSerialization = fals [ new List(), new List(), - new List<(int, int)>() + new List<(int, int)>(), + new List { nint.MinValue, nint.MaxValue }, + new List { nuint.MinValue, nuint.MaxValue } ]; [Theory] @@ -289,7 +295,10 @@ public void RoundTrip_RestrictedFormat_Bitmap() [MemberData(nameof(Lists_UnsupportedTestData))] public void RoundTrip_Unsupported(IList value) { - ((Action)(() => WriteObjectToStream(value))).Should().Throw(); + Action writer = () => WriteObjectToStream(value); + Action reader = () => ReadObjectFromStream(); + + writer.Should().Throw(); using (BinaryFormatterScope scope = new(enable: true)) { @@ -297,16 +306,45 @@ public void RoundTrip_Unsupported(IList value) ReadObjectFromStream().Should().BeEquivalentTo(value); } - ((Action)(() => ReadObjectFromStream())).Should().Throw(); + reader.Should().Throw(); } [Theory] [MemberData(nameof(Lists_UnsupportedTestData))] public void RoundTrip_RestrictedFormat_Unsupported(IList value) { - ((Action)(() => WriteObjectToStream(value, restrictSerialization: true))).Should().Throw(); + Action writer = () => WriteObjectToStream(value, restrictSerialization: true); + writer.Should().Throw(); using BinaryFormatterScope scope = new(enable: true); - ((Action)(() => WriteObjectToStream(value, restrictSerialization: true))).Should().Throw(); + writer.Should().Throw(); + } + + [Fact] + public void RoundTrip_OffsetArray() + { + Array value = Array.CreateInstance(typeof(uint), lengths: [2, 3], lowerBounds: [1, 2]); + value.SetValue(101u, 1, 2); + value.SetValue(102u, 1, 3); + value.SetValue(103u, 1, 4); + value.SetValue(201u, 2, 2); + value.SetValue(202u, 2, 3); + value.SetValue(203u, 2, 4); + + // Can read offset array with the BinaryFormatter. + using BinaryFormatterScope scope = new(enable: true); + var result = RoundTripObject(value).Should().BeOfType().Subject; + + result.Rank.Should().Be(2); + result.GetLength(0).Should().Be(2); + result.GetLength(1).Should().Be(3); + result.GetLowerBound(0).Should().Be(1); + result.GetLowerBound(1).Should().Be(2); + result.GetValue(1, 2).Should().Be(101u); + result.GetValue(1, 3).Should().Be(102u); + result.GetValue(1, 4).Should().Be(103u); + result.GetValue(2, 2).Should().Be(201u); + result.GetValue(2, 3).Should().Be(202u); + result.GetValue(2, 4).Should().Be(203u); } } From e2ee69675beaabe89ea0fe4820d03364c67a8acd Mon Sep 17 00:00:00 2001 From: Syareel Aiman <156630333+Syareel-Sukeri@users.noreply.github.com> Date: Wed, 4 Dec 2024 19:31:03 +0000 Subject: [PATCH 075/106] Add unit test for MaskedTextBoxDesignerActionList (#12491) Related #10773 Proposed changes Add unit test MaskedTextBoxDesignerActionListTests.cs for public properties and method of the MaskedTextBoxDesignerActionList. Enable nullability in MaskedTextBoxDesignerActionListTests.cs. --- .../MaskedTextBoxDesignerActionListTests.cs | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/MaskedTextBoxDesignerActionListTests.cs diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/MaskedTextBoxDesignerActionListTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/MaskedTextBoxDesignerActionListTests.cs new file mode 100644 index 00000000000..cba87a62cf1 --- /dev/null +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/MaskedTextBoxDesignerActionListTests.cs @@ -0,0 +1,62 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using Moq; +using System.ComponentModel; +using System.ComponentModel.Design; + +namespace System.Windows.Forms.Design.Tests; + +public class MaskedTextBoxDesignerActionListTests : IDisposable +{ + private readonly Mock _mockTypeDiscoveryService; + private readonly Mock _mockUIService; + private readonly MaskedTextBox _maskedTextBox; + private readonly MaskedTextBoxDesigner _designer; + private readonly MaskedTextBoxDesignerActionList _actionList; + + public MaskedTextBoxDesignerActionListTests() + { + _mockTypeDiscoveryService = new(); + _mockUIService = new(); + _maskedTextBox = new(); + + InitializeMocks(); + + _designer = new(); + _designer.Initialize(_maskedTextBox); + _actionList = new(_designer); + + void InitializeMocks() + { + Mock mockSite = new Mock(); + mockSite.Setup(s => s.GetService(typeof(ITypeDiscoveryService))).Returns(_mockTypeDiscoveryService.Object); + mockSite.Setup(s => s.GetService(typeof(IUIService))).Returns(_mockUIService.Object); + _maskedTextBox.Site = mockSite.Object; + } + } + + public void Dispose() + { + _designer.Dispose(); + _maskedTextBox.Dispose(); + } + + [Fact] + public void Constructor_InitializesServices() + { + _actionList.Should().NotBeNull(); + _actionList.Component.Should().Be(_maskedTextBox); + } + + [Fact] + public void GetSortedActionItems_ReturnsCorrectItems() + { + DesignerActionItemCollection items = _actionList.GetSortedActionItems(); + + items.Count.Should().Be(1); + items[0].DisplayName.Should().Be(SR.MaskedTextBoxDesignerVerbsSetMaskDesc); + } +} From 8de5e39a1faaf4d6782f291f1b4ed666d8f81781 Mon Sep 17 00:00:00 2001 From: Loni Tra Date: Wed, 4 Dec 2024 13:20:39 -0800 Subject: [PATCH 076/106] Add File Classification for runtime pack (#12578) * Add file classification for runtime pack * update UpdateFileClassification.ps1 --- pkg/Microsoft.Private.Winforms/README.md | 2 +- ...tem.Windows.Forms.FileClassification.props | 25 +++++++--- .../UpdateFileClassification.ps1 | 47 +++++++++++++++---- 3 files changed, 59 insertions(+), 15 deletions(-) diff --git a/pkg/Microsoft.Private.Winforms/README.md b/pkg/Microsoft.Private.Winforms/README.md index 7328ea5c1ad..d170b583b4c 100644 --- a/pkg/Microsoft.Private.Winforms/README.md +++ b/pkg/Microsoft.Private.Winforms/README.md @@ -5,7 +5,7 @@ This is a transport package consumed by [WPF](https://github.com/dotnet/wpf/) an ## `sdk\dotnet-windowsdesktop` folder -This folder contains props and targets used to ingest our assemblies into the [Windows Desktop SDK](https://github.com/dotnet/windowsdesktop/) for purpose of bundling of our analyzers into Microsoft.WindowsDesktop.App.Ref pack. +This folder contains props and targets used to ingest our assemblies into the [Windows Desktop SDK](https://github.com/dotnet/windowsdesktop/), bundling the correct set of assemblies into either the Microsoft.WindowsDesktop.App.Ref pack or Microsoft.WindowsDesktop.App.Runtime pack. * [`System.Windows.Forms.FileClassification.props`](sdk\dotnet-windowsdesktop\System.Windows.Forms.FileClassification.props) contains a manifest for the "WindowsForms" SDK[¹](#ref1), i.e. a list of our assemblies that form it. The file is imported by [Microsoft.WindowsDesktop.App.Ref project](https://github.com/dotnet/windowsdesktop/blob/main/src/windowsdesktop/src/sfx/Microsoft.WindowsDesktop.App.Ref.sfxproj).
diff --git a/pkg/Microsoft.Private.Winforms/sdk/dotnet-windowsdesktop/System.Windows.Forms.FileClassification.props b/pkg/Microsoft.Private.Winforms/sdk/dotnet-windowsdesktop/System.Windows.Forms.FileClassification.props index 68e0713ce68..3089298e670 100644 --- a/pkg/Microsoft.Private.Winforms/sdk/dotnet-windowsdesktop/System.Windows.Forms.FileClassification.props +++ b/pkg/Microsoft.Private.Winforms/sdk/dotnet-windowsdesktop/System.Windows.Forms.FileClassification.props @@ -1,9 +1,10 @@  - + + @@ -12,14 +13,26 @@ + + + + + + + + - - - - + + + + + + + + diff --git a/pkg/Microsoft.Private.Winforms/sdk/dotnet-windowsdesktop/UpdateFileClassification.ps1 b/pkg/Microsoft.Private.Winforms/sdk/dotnet-windowsdesktop/UpdateFileClassification.ps1 index 7f3c9b783ce..a0da3da39c9 100644 --- a/pkg/Microsoft.Private.Winforms/sdk/dotnet-windowsdesktop/UpdateFileClassification.ps1 +++ b/pkg/Microsoft.Private.Winforms/sdk/dotnet-windowsdesktop/UpdateFileClassification.ps1 @@ -18,12 +18,11 @@ Param( $assemblies = $xmlDoc.package.files.file | ` Where-Object { - # take only assemblies placed in \lib\netcoreappX.Y, and that are not resources - # also exclude Accessibility.dll as it is explicitly added to WindowsDesktop bundle + # take assemblies that are not analyzer resources. Also exclude Accessibility.dll as it is explicitly added to WindowsDesktop bundle. ($_.target.StartsWith('lib\') -or $_.target.StartsWith('ref\') -or $_.target.StartsWith('sdk\analyzers\'))` -and $_.target.EndsWith('.dll', [System.StringComparison]::OrdinalIgnoreCase) ` - -and !$_.target.EndsWith('resources.dll', [System.StringComparison]::OrdinalIgnoreCase) ` - -and !$_.target.EndsWith('\Accessibility.dll', [System.StringComparison]::OrdinalIgnoreCase) + -and !$_.target.EndsWith('\Accessibility.dll', [System.StringComparison]::OrdinalIgnoreCase) ` + -and $_.target -notmatch "..*Analyzers..*.resources.dll" } | ` Select-Object -Unique @{Name="Path";Expression={Split-Path $_.target -Leaf}} | ` Select-Object -ExpandProperty Path; @@ -61,17 +60,49 @@ else { #> Write-Host "Regenerating the manifest" -ForegroundColor Green + $sorted = $assemblies | Sort-Object; + $output = " + + `r`n"; + $sorted | ` + ForEach-Object { + $assembly = $_; + if (!$assembly.Contains("Analyzers") ` + -and !$assembly.EndsWith("resources.dll")) { + if ($assembly.Equals("System.Private.Windows.Core.dll")) { + $output += " `r`n `r`n" + } + else { + $output += " `r`n" + } + } + } + $output += " + + `r`n"; - $assemblies | ` - Sort-Object | ` + $sorted | ` + ForEach-Object { + $assembly = $_; + if ($assembly.Contains("Analyzers")) { + $output += " `r`n" + } + } + $output += " + + + `r`n"; + $sorted | ` ForEach-Object { $assembly = $_; - $output += " `r`n" + if ($assembly.EndsWith("resources.dll")) { + $output += " `r`n" + } } $output += " "; From f61432fec2bd7fb66e5f26418a89cd4314ad4311 Mon Sep 17 00:00:00 2001 From: Jeremy Kuhne Date: Wed, 4 Dec 2024 14:33:31 -0800 Subject: [PATCH 077/106] Add WPF test visibility to System.Private.Windows.Core (#12581) Add an entry for every test assembly. Not all of these projects exist yet, but they will soon. I'll be forcing all of the WPF test projects to the Open key. --- .../src/Properties/AssemblyInfo.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/System.Private.Windows.Core/src/Properties/AssemblyInfo.cs b/src/System.Private.Windows.Core/src/Properties/AssemblyInfo.cs index 1bcae297989..e07ee692c6b 100644 --- a/src/System.Private.Windows.Core/src/Properties/AssemblyInfo.cs +++ b/src/System.Private.Windows.Core/src/Properties/AssemblyInfo.cs @@ -47,3 +47,20 @@ [assembly: InternalsVisibleTo($"UIAutomationTypes, PublicKey={PublicKeys.MicrosoftShared}")] [assembly: InternalsVisibleTo($"WindowsBase, PublicKey={PublicKeys.MicrosoftShared}")] [assembly: InternalsVisibleTo($"WindowsFormsIntegration, PublicKey={PublicKeys.MicrosoftShared}")] + +[assembly: InternalsVisibleTo($"PresentationBuildTasks.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"PresentationCore.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"PresentationFramework.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"PresentationUI.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"ReachFramework.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"System.Windows.Controls.Ribbon.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"System.Windows.Input.Manipulations.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"System.Windows.Presentation.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"System.Windows.Primitives.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"System.Xaml.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"UIAutomationClient.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"UIAutomationClientSideProviders.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"UIAutomationProvider.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"UIAutomationTypes.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"WindowsBase.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"WindowsFormsIntegration.Tests, PublicKey={PublicKeys.Open}")] From c0feda12cd2ebebeb678457ca8f8f877397b1d10 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:42:16 +0000 Subject: [PATCH 078/106] [main] Update dependencies from dotnet/arcade (#12593) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 24 ++++++++++++------------ eng/Versions.props | 6 +++--- global.json | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e1a425787ca..9d54a6d0125 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -191,29 +191,29 @@ Note: if the Uri is a new place, you will need to add a subscription from that p - + https://github.com/dotnet/arcade - e8de3415124309210e4cbd0105e4a9da8dc01696 + 45d845e04c05fbe5da9838c454bbc3af1df6be81 - + https://github.com/dotnet/arcade - e8de3415124309210e4cbd0105e4a9da8dc01696 + 45d845e04c05fbe5da9838c454bbc3af1df6be81 - + https://github.com/dotnet/arcade - e8de3415124309210e4cbd0105e4a9da8dc01696 + 45d845e04c05fbe5da9838c454bbc3af1df6be81 - + https://github.com/dotnet/arcade - e8de3415124309210e4cbd0105e4a9da8dc01696 + 45d845e04c05fbe5da9838c454bbc3af1df6be81 - + https://github.com/dotnet/arcade - e8de3415124309210e4cbd0105e4a9da8dc01696 + 45d845e04c05fbe5da9838c454bbc3af1df6be81 - + https://github.com/dotnet/arcade - e8de3415124309210e4cbd0105e4a9da8dc01696 + 45d845e04c05fbe5da9838c454bbc3af1df6be81 diff --git a/eng/Versions.props b/eng/Versions.props index 5d4fe5ae7b5..815019a2f4e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -56,9 +56,9 @@ - 10.0.0-beta.24578.2 - 10.0.0-beta.24578.2 - 10.0.0-beta.24578.2 + 10.0.0-beta.24604.4 + 10.0.0-beta.24604.4 + 10.0.0-beta.24604.4 17.4.0-preview-20220707-01 diff --git a/global.json b/global.json index 969208f2627..da20f4cb7aa 100644 --- a/global.json +++ b/global.json @@ -14,9 +14,9 @@ "version": "9.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24578.2", - "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24578.2", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24578.2", + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24604.4", + "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24604.4", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24604.4", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24603.18" }, From 67e39e3f22a992a6d8adc8b914003d7b3902ffa0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:42:50 +0000 Subject: [PATCH 079/106] [main] Update dependencies from dotnet/runtime (#12594) [main] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 58 ++++++------- global.json | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9d54a6d0125..342c5124bbb 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f - + https://github.com/dotnet/runtime - 7dbe407ee8f709e7d37e81e185605d328208bc72 + e99557baffbe864d624cc1c95c9cbf2eefae684f diff --git a/eng/Versions.props b/eng/Versions.props index 815019a2f4e..24a4efb11a4 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 - 10.0.0-alpha.1.24603.18 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.1 diff --git a/global.json b/global.json index da20f4cb7aa..93f9a7361af 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24604.4", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24604.4", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24603.18" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24605.1" }, "native-tools": { "cmake": "latest" From 6ecb29a0b34c73048062257c1cab74b219759260 Mon Sep 17 00:00:00 2001 From: Liv-Goh Date: Thu, 5 Dec 2024 17:47:26 +0000 Subject: [PATCH 080/106] Add unit test for MaskDesignerDialog (#12575) * Add unit test for MaskDesignerDialog * Update unit test * update unit test * update unit test --- .../Forms/Design/MaskDesignerDialogTests.cs | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/MaskDesignerDialogTests.cs diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/MaskDesignerDialogTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/MaskDesignerDialogTests.cs new file mode 100644 index 00000000000..d0e446b5a8e --- /dev/null +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/MaskDesignerDialogTests.cs @@ -0,0 +1,118 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using System.ComponentModel.Design; +using Moq; + +namespace System.Windows.Forms.Design.Tests; + +public sealed class MaskDesignerDialogTests : IDisposable +{ + private readonly MaskedTextBox _maskedTextBox = new(); + private readonly MaskDesignerDialog _dialog; + + public MaskDesignerDialogTests() + { + _dialog = new(_maskedTextBox, null); + } + + public void Dispose() + { + _maskedTextBox.Dispose(); + _dialog.Dispose(); + } + + [Fact] + public void Constructor_ValidMaskedTextBox_UsesProvidedMaskedTextBox() + { + using TextBox txtBoxMask = _dialog.TestAccessor().Dynamic._txtBoxMask; + + _dialog.Mask.Should().Be(_maskedTextBox.Mask); + txtBoxMask.Text.Should().Be(_maskedTextBox.Mask); + } + + [Fact] + public void ValidatingTypeProperty_ShouldBeSetCorrectly() + { + _dialog.TestAccessor().Dynamic._maskedTextBox.ValidatingType = typeof(DateTime); + _dialog.TestAccessor().Dynamic.btnOK_Click(null, EventArgs.Empty); + + _dialog.ValidatingType.Should().Be(typeof(DateTime)); + } + + [Fact] + public void MaskDescriptorsEnumerator_ShouldReturnCorrectDescriptors() + { + Collections.IEnumerator enumerator = _dialog.MaskDescriptors; + + List descriptors = new(); + while (enumerator.MoveNext()) + { + descriptors.Add((MaskDescriptor)enumerator.Current); + } + + descriptors.Should().NotBeEmpty(); + } + + [Fact] + public void DiscoverMaskDescriptors_ShouldHandleNullTypeDiscoveryService() + { + List initialDescriptors = _dialog.TestAccessor().Dynamic._maskDescriptors; + + _dialog.DiscoverMaskDescriptors(null); + + List maskDescriptors = _dialog.TestAccessor().Dynamic._maskDescriptors; + + maskDescriptors.Should().Equal(initialDescriptors); + } + + [WinFormsTheory] + [InlineData(typeof(ValidMaskDescriptor), true)] + [InlineData(typeof(AbstractMaskDescriptor), false)] + [InlineData(typeof(NonPublicMaskDescriptor), false)] + public void DiscoverMaskDescriptors_ShouldHandleVariousDescriptorTypes(Type descriptorType, bool shouldBeAdded) + { + Mock mockDiscoveryService = new(); + List types = new(){ descriptorType }; + + mockDiscoveryService.Setup(ds => ds.GetTypes(typeof(MaskDescriptor), false)).Returns(types); + + _dialog.DiscoverMaskDescriptors(mockDiscoveryService.Object); + List maskDescriptors = _dialog.TestAccessor().Dynamic._maskDescriptors; + + if (shouldBeAdded) + { + maskDescriptors.Should().ContainSingle(descriptor => descriptor.GetType() == descriptorType); + } + else + { + maskDescriptors.Should().NotContain(descriptor => descriptor.GetType() == descriptorType); + } + } + + private abstract class AbstractMaskDescriptor : MaskDescriptor + { + public override string? Mask => null; + public override string? Name => null; + public override string? Sample => null; + public override Type? ValidatingType => null; + } + + private class NonPublicMaskDescriptor : MaskDescriptor + { + public override string? Mask => null; + public override string? Name => null; + public override string? Sample => null; + public override Type? ValidatingType => null; + } +} + +public class ValidMaskDescriptor : MaskDescriptor +{ + public override string? Mask => "000-00-0000"; + public override string? Name => "Valid Mask"; + public override string? Sample => "123-45-6789"; + public override Type? ValidatingType => typeof(string); +} From 2d7232f8f4268f6db0de69bab83e8459ee9f230e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2024 13:37:12 +0000 Subject: [PATCH 081/106] [main] Update dependencies from dotnet/arcade (#12599) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 24 ++++++++++++------------ eng/Versions.props | 6 +++--- global.json | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 342c5124bbb..2fa66765f8e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -191,29 +191,29 @@ Note: if the Uri is a new place, you will need to add a subscription from that p - + https://github.com/dotnet/arcade - 45d845e04c05fbe5da9838c454bbc3af1df6be81 + 110749ff6e8a43fcd7c8f0bd74c5fcb0da3562ed - + https://github.com/dotnet/arcade - 45d845e04c05fbe5da9838c454bbc3af1df6be81 + 110749ff6e8a43fcd7c8f0bd74c5fcb0da3562ed - + https://github.com/dotnet/arcade - 45d845e04c05fbe5da9838c454bbc3af1df6be81 + 110749ff6e8a43fcd7c8f0bd74c5fcb0da3562ed - + https://github.com/dotnet/arcade - 45d845e04c05fbe5da9838c454bbc3af1df6be81 + 110749ff6e8a43fcd7c8f0bd74c5fcb0da3562ed - + https://github.com/dotnet/arcade - 45d845e04c05fbe5da9838c454bbc3af1df6be81 + 110749ff6e8a43fcd7c8f0bd74c5fcb0da3562ed - + https://github.com/dotnet/arcade - 45d845e04c05fbe5da9838c454bbc3af1df6be81 + 110749ff6e8a43fcd7c8f0bd74c5fcb0da3562ed diff --git a/eng/Versions.props b/eng/Versions.props index 24a4efb11a4..12acf3a1964 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -56,9 +56,9 @@ - 10.0.0-beta.24604.4 - 10.0.0-beta.24604.4 - 10.0.0-beta.24604.4 + 10.0.0-beta.24605.1 + 10.0.0-beta.24605.1 + 10.0.0-beta.24605.1 17.4.0-preview-20220707-01 diff --git a/global.json b/global.json index 93f9a7361af..ee632e30db0 100644 --- a/global.json +++ b/global.json @@ -14,9 +14,9 @@ "version": "9.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24604.4", - "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24604.4", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24604.4", + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24605.1", + "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24605.1", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24605.1", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24605.1" }, From 8cafe95740a033b4855b83fe3a288b38d04ecc2a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2024 13:37:39 +0000 Subject: [PATCH 082/106] [main] Update dependencies from dotnet/runtime (#12600) [main] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 58 ++++++------- global.json | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2fa66765f8e..3b4689eef1f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 - + https://github.com/dotnet/runtime - e99557baffbe864d624cc1c95c9cbf2eefae684f + 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 diff --git a/eng/Versions.props b/eng/Versions.props index 12acf3a1964..8e382617ba3 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 - 10.0.0-alpha.1.24605.1 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24605.9 diff --git a/global.json b/global.json index ee632e30db0..8173a49ab4f 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24605.1", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24605.1", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24605.1" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24605.9" }, "native-tools": { "cmake": "latest" From cb1e49fa760ed2996b68090b74aa48d712973643 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 7 Dec 2024 13:42:09 +0000 Subject: [PATCH 083/106] [main] Update dependencies from dotnet/arcade (#12602) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 24 +++++++++---------- eng/Versions.props | 6 ++--- .../core-templates/steps/source-build.yml | 2 +- eng/common/cross/build-rootfs.sh | 8 +++---- global.json | 10 ++++---- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3b4689eef1f..bbcd9ecd93f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -191,29 +191,29 @@ Note: if the Uri is a new place, you will need to add a subscription from that p - + https://github.com/dotnet/arcade - 110749ff6e8a43fcd7c8f0bd74c5fcb0da3562ed + 61b8f746424762d2e3173ebfaab19346224d591c - + https://github.com/dotnet/arcade - 110749ff6e8a43fcd7c8f0bd74c5fcb0da3562ed + 61b8f746424762d2e3173ebfaab19346224d591c - + https://github.com/dotnet/arcade - 110749ff6e8a43fcd7c8f0bd74c5fcb0da3562ed + 61b8f746424762d2e3173ebfaab19346224d591c - + https://github.com/dotnet/arcade - 110749ff6e8a43fcd7c8f0bd74c5fcb0da3562ed + 61b8f746424762d2e3173ebfaab19346224d591c - + https://github.com/dotnet/arcade - 110749ff6e8a43fcd7c8f0bd74c5fcb0da3562ed + 61b8f746424762d2e3173ebfaab19346224d591c - + https://github.com/dotnet/arcade - 110749ff6e8a43fcd7c8f0bd74c5fcb0da3562ed + 61b8f746424762d2e3173ebfaab19346224d591c diff --git a/eng/Versions.props b/eng/Versions.props index 8e382617ba3..6d013e0afc4 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -56,9 +56,9 @@ - 10.0.0-beta.24605.1 - 10.0.0-beta.24605.1 - 10.0.0-beta.24605.1 + 10.0.0-beta.24606.6 + 10.0.0-beta.24606.6 + 10.0.0-beta.24606.6 17.4.0-preview-20220707-01 diff --git a/eng/common/core-templates/steps/source-build.yml b/eng/common/core-templates/steps/source-build.yml index 4da05afe054..f9ba1625c20 100644 --- a/eng/common/core-templates/steps/source-build.yml +++ b/eng/common/core-templates/steps/source-build.yml @@ -78,7 +78,7 @@ steps: portableBuildArgs= if [ '${{ parameters.platform.portableBuild }}' != '' ]; then - portableBuildArgs='/p:PortabelBuild=${{ parameters.platform.portableBuild }}' + portableBuildArgs='/p:PortableBuild=${{ parameters.platform.portableBuild }}' fi ${{ coalesce(parameters.platform.buildScript, './build.sh') }} --ci \ diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 20ae8c28687..096bfe51f15 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -73,8 +73,8 @@ __AlpinePackages+=" krb5-dev" __AlpinePackages+=" openssl-dev" __AlpinePackages+=" zlib-dev" -__FreeBSDBase="13.3-RELEASE" -__FreeBSDPkg="1.17.0" +__FreeBSDBase="13.4-RELEASE" +__FreeBSDPkg="1.21.3" __FreeBSDABI="13" __FreeBSDPackages="libunwind" __FreeBSDPackages+=" icu" @@ -371,7 +371,7 @@ while :; do ;; freebsd14) __CodeName=freebsd - __FreeBSDBase="14.0-RELEASE" + __FreeBSDBase="14.2-RELEASE" __FreeBSDABI="14" __SkipUnmount=1 ;; @@ -574,7 +574,7 @@ elif [[ "$__CodeName" == "freebsd" ]]; then curl -SL "https://download.freebsd.org/ftp/releases/${__FreeBSDArch}/${__FreeBSDMachineArch}/${__FreeBSDBase}/base.txz" | tar -C "$__RootfsDir" -Jxf - ./lib ./usr/lib ./usr/libdata ./usr/include ./usr/share/keys ./etc ./bin/freebsd-version fi echo "ABI = \"FreeBSD:${__FreeBSDABI}:${__FreeBSDMachineArch}\"; FINGERPRINTS = \"${__RootfsDir}/usr/share/keys\"; REPOS_DIR = [\"${__RootfsDir}/etc/pkg\"]; REPO_AUTOUPDATE = NO; RUN_SCRIPTS = NO;" > "${__RootfsDir}"/usr/local/etc/pkg.conf - echo "FreeBSD: { url: \"pkg+http://pkg.FreeBSD.org/\${ABI}/quarterly\", mirror_type: \"srv\", signature_type: \"fingerprints\", fingerprints: \"${__RootfsDir}/usr/share/keys/pkg\", enabled: yes }" > "${__RootfsDir}"/etc/pkg/FreeBSD.conf + echo "FreeBSD: { url: \"pkg+http://pkg.FreeBSD.org/\${ABI}/quarterly\", mirror_type: \"srv\", signature_type: \"fingerprints\", fingerprints: \"/usr/share/keys/pkg\", enabled: yes }" > "${__RootfsDir}"/etc/pkg/FreeBSD.conf mkdir -p "$__RootfsDir"/tmp # get and build package manager if [[ "$__hasWget" == 1 ]]; then diff --git a/global.json b/global.json index 8173a49ab4f..0ba895f9b4b 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "tools": { - "dotnet": "9.0.100", + "dotnet": "10.0.100-alpha.1.24573.1", "runtimes": { "dotnet/x64": [ "$(VSRedistCommonNetCoreSharedFrameworkx64100PackageVersion)" @@ -11,12 +11,12 @@ } }, "sdk": { - "version": "9.0.100" + "version": "10.0.100-alpha.1.24573.1" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24605.1", - "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24605.1", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24605.1", + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24606.6", + "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24606.6", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24606.6", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24605.9" }, From 65240b1f5c6edacf2ff91d5310c238771d0261ae Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 7 Dec 2024 13:42:41 +0000 Subject: [PATCH 084/106] [main] Update dependencies from dotnet/runtime (#12603) [main] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 58 ++++++------- global.json | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index bbcd9ecd93f..a7c4635be90 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 - + https://github.com/dotnet/runtime - 8fca0a156dcbb1eba5c79e387a6d8f924bfdd3a6 + 2d81cbb28a8feb1af5b790664b511b264d032877 diff --git a/eng/Versions.props b/eng/Versions.props index 6d013e0afc4..0110156c432 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 - 10.0.0-alpha.1.24605.9 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24606.5 diff --git a/global.json b/global.json index 0ba895f9b4b..7c24514fc15 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24606.6", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24606.6", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24605.9" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24606.5" }, "native-tools": { "cmake": "latest" From 0ab83bffe828e067380bf3ded163cc5f458d3877 Mon Sep 17 00:00:00 2001 From: Leaf Shi <132890443+LeafShi1@users.noreply.github.com> Date: Mon, 9 Dec 2024 17:28:02 +0800 Subject: [PATCH 085/106] Unhook the mouse down hook at the end of PropertyGridView.ProcessEnumUpAndDown (#12508) * Unhook the mouse down hook at the end of PropertyGridView.ProcessEnumUpAndDown * Removing ? from code line "EditTextBox?.SelectAll();" --- .../PropertyGrid/PropertyGridInternal/PropertyGridView.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs index 3055e78b1fc..dcdb7878659 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs @@ -2475,7 +2475,8 @@ private bool ProcessEnumUpAndDown(GridEntry entry, Keys keyCode, bool closeDropD } CommitValue(entry, valueNew, closeDropDown); - EditTextBox?.SelectAll(); + EditTextBox.HookMouseDown = false; + EditTextBox.SelectAll(); return true; } From 9bd76c9152f6ea3134f23c6662c15db02797e3b9 Mon Sep 17 00:00:00 2001 From: Leaf Shi <132890443+LeafShi1@users.noreply.github.com> Date: Mon, 9 Dec 2024 17:28:29 +0800 Subject: [PATCH 086/106] Add UIA_AutomationFocusChangedEventId to SelectInternal of the TextBoxBase.cs (#12479) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add UIA_AutomationFocusChangedEventId in SelectInternal function of PropertyGridView.GridViewTextBox * Add a check that when the selected text is (0, 0), let the AI ​​rectangle refocus the current text box * Rename the variables of function SelectInternal --- .../Windows/Forms/Controls/TextBox/TextBoxBase.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/TextBox/TextBoxBase.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/TextBox/TextBoxBase.cs index b68f7a97850..4f72acac3d1 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/TextBox/TextBoxBase.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/TextBox/TextBoxBase.cs @@ -1722,26 +1722,28 @@ public void Select(int start, int length) /// But if you do have it cached, please pass it in. This will avoid /// the expensive call to the TextLength property. /// - private protected virtual void SelectInternal(int start, int length, int textLen) + private protected virtual void SelectInternal(int selectionStart, int selectionLength, int textLength) { // if our handle is created - send message... if (IsHandleCreated) { - AdjustSelectionStartAndEnd(start, length, out int s, out int e, textLen); + AdjustSelectionStartAndEnd(selectionStart, selectionLength, out int start, out int end, textLength); - PInvokeCore.SendMessage(this, PInvokeCore.EM_SETSEL, (WPARAM)s, (LPARAM)e); + PInvokeCore.SendMessage(this, PInvokeCore.EM_SETSEL, (WPARAM)start, (LPARAM)end); if (IsAccessibilityObjectCreated) { - AccessibilityObject.RaiseAutomationEvent(UIA_EVENT_ID.UIA_Text_TextSelectionChangedEventId); + AccessibilityObject.RaiseAutomationEvent(end == 0 + ? UIA_EVENT_ID.UIA_AutomationFocusChangedEventId + : UIA_EVENT_ID.UIA_Text_TextSelectionChangedEventId); } } else { // otherwise, wait until handle is created to send this message. // Store the indices until then... - _selectionStart = start; - _selectionLength = length; + _selectionStart = selectionStart; + _selectionLength = selectionLength; _textBoxFlags[s_setSelectionOnHandleCreated] = true; } } From 41932f7d9c87dc80f08f5b5e3da186789cf47e60 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 13:36:27 +0000 Subject: [PATCH 087/106] [main] Update dependencies from dotnet/runtime (#12606) [main] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 58 ++++++------- global.json | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a7c4635be90..4db80e572bc 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d - + https://github.com/dotnet/runtime - 2d81cbb28a8feb1af5b790664b511b264d032877 + b085dadd160066d945ea638f0391091b1c96524d diff --git a/eng/Versions.props b/eng/Versions.props index 0110156c432..edcc4e03cd6 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 - 10.0.0-alpha.1.24606.5 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24609.1 diff --git a/global.json b/global.json index 7c24514fc15..be1b98a46a4 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24606.6", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24606.6", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24606.5" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24609.1" }, "native-tools": { "cmake": "latest" From 6cbaf63903bad1afd95af2d09466567979a5d8e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaus=20L=C3=B6ffelmann?= <9663150+KlausLoeffelmann@users.noreply.github.com> Date: Mon, 9 Dec 2024 14:43:19 -0800 Subject: [PATCH 088/106] Bump up NuGet Packs and apply new Analyzer Rules. (#12512) * Bump up NuGet Packs and apply new Analyzer Rules. * Downgrade Analyzer version. * Fix some additional analyzer issues. * Address review feedback. * Fix unit test. * Fix missmatching Analyzer NuGet package version. * Fix RTF format test in the RichTextBox. * Correct type in ToolTip.cs. * Address remaining feedback while keeping all tests passing. * Correct formatting in DPI_AWARENESS_CONTEXT. --- eng/Versions.props | 16 +++++----- .../src/System/Drawing/Icon.cs | 4 +-- .../src/System/Drawing/Image.cs | 2 +- src/System.Drawing.Common/tests/Helpers.cs | 2 +- .../src/Windows/Win32/Foundation/HGLOBAL.cs | 10 ------- .../src/Windows/Win32/Foundation/LPARAM.cs | 2 +- .../src/Windows/Win32/Foundation/WPARAM.cs | 6 ++-- .../Win32/Graphics/Gdi/CreateDcScope.cs | 2 +- .../Win32/Graphics/Gdi/CreatePenScope.cs | 2 +- .../src/Windows/Win32/Graphics/Gdi/HDC.cs | 3 -- .../src/Windows/Win32/Graphics/Gdi/HGDIOBJ.cs | 2 +- .../src/Windows/Win32/System/Ole/PICTDESC.cs | 2 +- .../Win32/UI/WindowsAndMessaging/HCURSOR.cs | 6 ++-- .../Win32/UI/WindowsAndMessaging/HICON.cs | 6 ++-- .../Win32/UI/WindowsAndMessaging/ICONINFO.cs | 2 +- .../BinaryFormatWriterTests.cs | 18 +++++++----- .../ProjectFileReader.FontConverter.cs | 2 +- .../ComponentModel/Design/BinaryEditor.cs | 2 +- .../Serialization/CodeDomSerializerBase.cs | 2 +- .../Serialization/TypeCodeDomSerializer.cs | 2 +- .../Design/ColorEditor.CustomColorDialog.cs | 2 +- ...BehaviorService.AdornerWindow.MouseHook.cs | 2 +- .../Forms/Design/ChangeToolStripParentVerb.cs | 2 +- .../Forms/Design/ImageListImageEditor.cs | 2 +- .../Windows/Forms/DeviceContextExtensions.cs | 2 +- .../Win32/UI/HiDpi/DPI_AWARENESS_CONTEXT.cs | 20 ++++--------- .../tests/TestUtilities/Win32/WindowClass.cs | 8 ++--- .../src/PublicAPI.Shipped.txt | 29 +++---------------- .../src/PublicAPI.Unshipped.txt | 21 ++++++++++++++ .../System/Resources/ResxFileRef.Converter.cs | 2 +- .../ComboBox.ComboBoxAccessibleObject.cs | 2 +- .../DataGridView/DataGridView.Methods.cs | 2 +- .../ImmutablePropertyDescriptorGridEntry.cs | 2 +- .../PropertyGridView.MouseHook.cs | 2 +- .../Forms/Controls/RichTextBox/RichTextBox.cs | 13 ++++++++- ...enuFilter.HostedWindowsFormsMessageHook.cs | 2 +- .../Controls/ToolStrips/ToolStripPanel.cs | 2 +- .../Forms/Form.EnumThreadWindowsCallback.cs | 4 +-- .../src/System/Windows/Forms/Form.cs | 2 +- .../src/System/Windows/Forms/Input/Cursor.cs | 4 +-- .../Windows/Forms/NativeWindow.WindowClass.cs | 2 +- ...ect.Composition.WinFormsToNativeAdapter.cs | 2 +- .../Windows/Forms/Rendering/DCMapping.cs | 5 +++- .../System/Windows/Forms/ToolTip/ToolTip.cs | 4 +-- .../UIIntegrationTests/DragDropTests.cs | 2 ++ .../Infra/ControlTestBase.cs | 4 +++ .../tests/InteropTests/RichTextBoxTests.cs | 10 +++---- .../tests/UnitTests/SerializableTypesTests.cs | 2 +- .../System/Windows/Forms/FileDialogTests.cs | 4 +-- .../System/Windows/Forms/ScreenTests.cs | 8 ++--- 50 files changed, 131 insertions(+), 130 deletions(-) delete mode 100644 src/System.Private.Windows.Core/src/Windows/Win32/Foundation/HGLOBAL.cs diff --git a/eng/Versions.props b/eng/Versions.props index edcc4e03cd6..bce7e52c59c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -48,7 +48,7 @@ Microsoft.NET.Sdk.IL.targets requires definition of MicrosoftNETCoreILAsmVersion --> $(MicrosoftNETCoreILAsmPackageVersion) - 0.3.106 + 0.3.151 @@ -73,14 +73,14 @@ - 17.0.15-alpha + 17.12.19 7.0.0 4.20.70 - 6.11.0 - 10.0.0-beta.24480.2 - 10.0.0-beta.24480.2 - 10.0.0-beta.24480.2 + 6.12.0 + 10.0.0-beta.24568.1 + 10.0.0-beta.24568.1 + 10.0.0-beta.24568.1 25.0.1 @@ -93,7 +93,7 @@ 0.1.495 1.0.0-beta.59 - 3.11.0-beta1.24219.2 + 3.12.0-beta1.24559.1 4.10.0-3.final $(MicrosoftCodeAnalysisCommonPackageVersion) $(MicrosoftCodeAnalysisCommonPackageVersion) @@ -101,7 +101,7 @@ $(MicrosoftCodeAnalysisCommonPackageVersion) 1.1.3-beta1.24352.1 $(MicrosoftCodeAnalysisAnalyzersVersion) - 8.0.0 + 10.0.0-preview.24559.1 1.2.0-beta.556 6.11.0 diff --git a/src/System.Drawing.Common/src/System/Drawing/Icon.cs b/src/System.Drawing.Common/src/System/Drawing/Icon.cs index ceb620cc9dc..57ea0b4e70e 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Icon.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Icon.cs @@ -66,7 +66,7 @@ public Icon(string fileName, int width, int height) : this() using (FileStream f = new(fileName, FileMode.Open, FileAccess.Read, FileShare.Read)) { _iconData = new byte[(int)f.Length]; - f.Read(_iconData, 0, _iconData.Length); + f.ReadExactly(_iconData); } Initialize(width, height); @@ -101,7 +101,7 @@ public Icon(Type type, string resource) : this() ?? throw new ArgumentException(SR.Format(SR.ResourceNotFound, type, resource)); _iconData = new byte[(int)stream.Length]; - stream.Read(_iconData, 0, _iconData.Length); + stream.ReadExactly(_iconData); Initialize(0, 0); } diff --git a/src/System.Drawing.Common/src/System/Drawing/Image.cs b/src/System.Drawing.Common/src/System/Drawing/Image.cs index 8dcc750830e..4a1b8349138 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Image.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Image.cs @@ -923,7 +923,7 @@ internal static unsafe void GetAnimatedGifRawData(Image image, string? filename, } image._animatedGifRawData = new byte[(int)dataStream.Length]; - dataStream.Read(image._animatedGifRawData, 0, (int)dataStream.Length); + dataStream.ReadExactly(image._animatedGifRawData, 0, (int)dataStream.Length); } finally { diff --git a/src/System.Drawing.Common/tests/Helpers.cs b/src/System.Drawing.Common/tests/Helpers.cs index 42f8df23827..ed63290fa40 100644 --- a/src/System.Drawing.Common/tests/Helpers.cs +++ b/src/System.Drawing.Common/tests/Helpers.cs @@ -100,7 +100,7 @@ internal static Rectangle GetHWndRect(HWND hwnd) private static Rectangle GetMonitorRectForWindow(HWND hwnd) { HMONITOR hmonitor = PInvokeCore.MonitorFromWindow(hwnd, MONITOR_FROM_FLAGS.MONITOR_DEFAULTTOPRIMARY); - hmonitor.Value.Should().NotBe(0); + ((nint)hmonitor.Value).Should().NotBe(0); MONITORINFO info = new() { diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Foundation/HGLOBAL.cs b/src/System.Private.Windows.Core/src/Windows/Win32/Foundation/HGLOBAL.cs deleted file mode 100644 index fba5d3050f9..00000000000 --- a/src/System.Private.Windows.Core/src/Windows/Win32/Foundation/HGLOBAL.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace Windows.Win32.Foundation; - -internal unsafe partial struct HGLOBAL -{ - public static HGLOBAL Null => default; - public bool IsNull => Value == null; -} diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Foundation/LPARAM.cs b/src/System.Private.Windows.Core/src/Windows/Win32/Foundation/LPARAM.cs index 4d464010fd1..7831ca85b0a 100644 --- a/src/System.Private.Windows.Core/src/Windows/Win32/Foundation/LPARAM.cs +++ b/src/System.Private.Windows.Core/src/Windows/Win32/Foundation/LPARAM.cs @@ -21,7 +21,7 @@ internal readonly partial struct LPARAM public static explicit operator HWND(LPARAM value) => (HWND)value.Value; - public static explicit operator LPARAM(HWND value) => (LPARAM)value.Value; + public static unsafe explicit operator LPARAM(HWND value) => (LPARAM)value.Value; public static explicit operator LPARAM(Color value) => (LPARAM)ColorTranslator.ToWin32(value); public static explicit operator Point(LPARAM value) => new(value.SIGNEDLOWORD, value.SIGNEDHIWORD); diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Foundation/WPARAM.cs b/src/System.Private.Windows.Core/src/Windows/Win32/Foundation/WPARAM.cs index de35b815bac..eb8777f90a4 100644 --- a/src/System.Private.Windows.Core/src/Windows/Win32/Foundation/WPARAM.cs +++ b/src/System.Private.Windows.Core/src/Windows/Win32/Foundation/WPARAM.cs @@ -5,10 +5,10 @@ namespace Windows.Win32.Foundation; -internal readonly partial struct WPARAM +internal readonly unsafe partial struct WPARAM { - public static unsafe implicit operator void*(WPARAM value) => (void*)value.Value; - public static unsafe implicit operator WPARAM(void* value) => new((nuint)value); + public static implicit operator void*(WPARAM value) => (void*)value.Value; + public static implicit operator WPARAM(void* value) => new((nuint)value); public static explicit operator HWND(WPARAM value) => (HWND)(nint)value.Value; public static explicit operator WPARAM(HWND value) => new((nuint)value.Value); diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/CreateDcScope.cs b/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/CreateDcScope.cs index b7c4378d672..3e5ca37cbe8 100644 --- a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/CreateDcScope.cs +++ b/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/CreateDcScope.cs @@ -50,7 +50,7 @@ public unsafe CreateDcScope( } public static implicit operator HDC(in CreateDcScope scope) => scope.HDC; - public static implicit operator HGDIOBJ(in CreateDcScope scope) => (HGDIOBJ)(scope.HDC.Value); + public static unsafe implicit operator HGDIOBJ(in CreateDcScope scope) => (HGDIOBJ)(scope.HDC.Value); public static implicit operator nint(in CreateDcScope scope) => scope.HDC; public static explicit operator WPARAM(in CreateDcScope scope) => (WPARAM)(nuint)(nint)scope.HDC; diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/CreatePenScope.cs b/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/CreatePenScope.cs index 4f1ab4fefcd..41f5979b0b7 100644 --- a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/CreatePenScope.cs +++ b/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/CreatePenScope.cs @@ -30,7 +30,7 @@ public CreatePenScope(Color color, int width = 1) => HPEN = PInvokeCore.CreatePen(PEN_STYLE.PS_SOLID, width, color); public static implicit operator HPEN(in CreatePenScope scope) => scope.HPEN; - public static implicit operator HGDIOBJ(in CreatePenScope scope) => (HGDIOBJ)scope.HPEN.Value; + public static unsafe implicit operator HGDIOBJ(in CreatePenScope scope) => scope.HPEN; public bool IsNull => HPEN.IsNull; diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/HDC.cs b/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/HDC.cs index 1ce97e0e797..6c5b27b507d 100644 --- a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/HDC.cs +++ b/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/HDC.cs @@ -7,7 +7,4 @@ namespace Windows.Win32.Graphics.Gdi; { HDC IHandle.Handle => this; object? IHandle.Wrapper => null; - - public static HDC Null => default; - public bool IsNull => Value == 0; } diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/HGDIOBJ.cs b/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/HGDIOBJ.cs index fee7f9359f0..dd49bd057a9 100644 --- a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/HGDIOBJ.cs +++ b/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/HGDIOBJ.cs @@ -3,7 +3,7 @@ namespace Windows.Win32.Graphics.Gdi; -internal readonly partial struct HGDIOBJ +internal readonly unsafe partial struct HGDIOBJ { public static implicit operator HGDIOBJ(HDC value) => (HGDIOBJ)value.Value; diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/System/Ole/PICTDESC.cs b/src/System.Private.Windows.Core/src/Windows/Win32/System/Ole/PICTDESC.cs index 7fab1bdaf40..db7bf3fd517 100644 --- a/src/System.Private.Windows.Core/src/Windows/Win32/System/Ole/PICTDESC.cs +++ b/src/System.Private.Windows.Core/src/Windows/Win32/System/Ole/PICTDESC.cs @@ -20,7 +20,7 @@ public static PICTDESC FromBitmap(IPointer bitmap, HPALETTE paletteHan return desc; } - public static PICTDESC FromIcon(IIcon icon, bool copy) + public static unsafe PICTDESC FromIcon(IIcon icon, bool copy) { PICTDESC desc = new() { diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/UI/WindowsAndMessaging/HCURSOR.cs b/src/System.Private.Windows.Core/src/Windows/Win32/UI/WindowsAndMessaging/HCURSOR.cs index 268bab3b8cf..db0b6c70929 100644 --- a/src/System.Private.Windows.Core/src/Windows/Win32/UI/WindowsAndMessaging/HCURSOR.cs +++ b/src/System.Private.Windows.Core/src/Windows/Win32/UI/WindowsAndMessaging/HCURSOR.cs @@ -3,11 +3,11 @@ namespace Windows.Win32.UI.WindowsAndMessaging; -internal partial struct HCURSOR : IHandle +internal unsafe partial struct HCURSOR : IHandle { HCURSOR IHandle.Handle => this; object? IHandle.Wrapper => null; - public static explicit operator HCURSOR(HANDLE handle) => new(handle); - public static implicit operator HANDLE(HCURSOR handle) => new(handle); + public static explicit operator HCURSOR(HANDLE handle) => new((nint)handle); + public static implicit operator HANDLE(HCURSOR handle) => new((nint)handle); } diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/UI/WindowsAndMessaging/HICON.cs b/src/System.Private.Windows.Core/src/Windows/Win32/UI/WindowsAndMessaging/HICON.cs index 34521d211c0..5110c344719 100644 --- a/src/System.Private.Windows.Core/src/Windows/Win32/UI/WindowsAndMessaging/HICON.cs +++ b/src/System.Private.Windows.Core/src/Windows/Win32/UI/WindowsAndMessaging/HICON.cs @@ -3,11 +3,11 @@ namespace Windows.Win32.UI.WindowsAndMessaging; -internal partial struct HICON : IHandle +internal unsafe partial struct HICON : IHandle { HICON IHandle.Handle => this; object? IHandle.Wrapper => null; - public static explicit operator HICON(HANDLE handle) => new(handle); - public static implicit operator HANDLE(HICON handle) => new(handle); + public static explicit operator HICON(HANDLE handle) => new((nint)handle); + public static implicit operator HANDLE(HICON handle) => new((nint)handle); } diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/UI/WindowsAndMessaging/ICONINFO.cs b/src/System.Private.Windows.Core/src/Windows/Win32/UI/WindowsAndMessaging/ICONINFO.cs index c21b62d0132..e3881948f0b 100644 --- a/src/System.Private.Windows.Core/src/Windows/Win32/UI/WindowsAndMessaging/ICONINFO.cs +++ b/src/System.Private.Windows.Core/src/Windows/Win32/UI/WindowsAndMessaging/ICONINFO.cs @@ -3,7 +3,7 @@ namespace Windows.Win32.UI.WindowsAndMessaging; -internal partial struct ICONINFO : IDisposable +internal unsafe partial struct ICONINFO : IDisposable { public void Dispose() { diff --git a/src/System.Private.Windows.Core/tests/BinaryFormatTests/FormatTests/FormattedObject/BinaryFormatWriterTests.cs b/src/System.Private.Windows.Core/tests/BinaryFormatTests/FormatTests/FormattedObject/BinaryFormatWriterTests.cs index 6ca6ba0be66..4395969fa8a 100644 --- a/src/System.Private.Windows.Core/tests/BinaryFormatTests/FormatTests/FormattedObject/BinaryFormatWriterTests.cs +++ b/src/System.Private.Windows.Core/tests/BinaryFormatTests/FormatTests/FormattedObject/BinaryFormatWriterTests.cs @@ -7,6 +7,7 @@ using System.Formats.Nrbf; using System.Windows.Forms.Nrbf; using System.Drawing; +using System.Diagnostics; namespace FormatTests.FormattedObject; @@ -34,6 +35,8 @@ public void BinaryFormatWriter_WriteString(string testString) [MemberData(nameof(TryWriteFrameworkObject_SupportedObjects_TestData))] public void BinaryFormatWriter_TryWriteFrameworkObject_SupportedObjects_BinaryFormatterRead(object value) { + Debug.Print(value.ToString()); + using MemoryStream stream = new(); bool success = BinaryFormatWriter.TryWriteFrameworkObject(stream, value); success.Should().BeTrue(); @@ -176,14 +179,14 @@ public void BinaryFormatWriter_TryWriteDrawingPrimitivesObject_UnsupportedObject ListTests.ArrayLists_UnsupportedTestData).Concat( Array_UnsupportedTestData); - public static TheoryData SystemDrawing_TestData => new() - { + public static TheoryData SystemDrawing_TestData => + [ default(PointF), default(RectangleF) - }; + ]; - public static TheoryData DrawingPrimitives_TestData => new() - { + public static TheoryData DrawingPrimitives_TestData => + [ new Point(-1, 2), new Point(int.MaxValue, int.MinValue), Point.Empty, @@ -204,7 +207,7 @@ public void BinaryFormatWriter_TryWriteDrawingPrimitivesObject_UnsupportedObject Color.FromArgb(4, Color.Yellow), Color.FromName("Blue"), SystemColors.ButtonFace - }; + ]; public static TheoryData StringArray_Parse_Data => [ @@ -221,7 +224,8 @@ public void BinaryFormatWriter_TryWriteDrawingPrimitivesObject_UnsupportedObject new DateTime[] { DateTime.MaxValue } ]; - public static IEnumerable Array_TestData => ((IEnumerable)StringArray_Parse_Data).Concat(PrimitiveArray_Parse_Data); + public static IEnumerable Array_TestData => + ((IEnumerable)StringArray_Parse_Data).Concat(PrimitiveArray_Parse_Data); public static TheoryData Array_UnsupportedTestData => [ diff --git a/src/System.Windows.Forms.Analyzers.CSharp/src/System/Windows/Forms/CSharp/Generators/ApplicationConfiguration/ProjectFileReader.FontConverter.cs b/src/System.Windows.Forms.Analyzers.CSharp/src/System/Windows/Forms/CSharp/Generators/ApplicationConfiguration/ProjectFileReader.FontConverter.cs index 7f05da81787..165a882d564 100644 --- a/src/System.Windows.Forms.Analyzers.CSharp/src/System/Windows/Forms/CSharp/Generators/ApplicationConfiguration/ProjectFileReader.FontConverter.cs +++ b/src/System.Windows.Forms.Analyzers.CSharp/src/System/Windows/Forms/CSharp/Generators/ApplicationConfiguration/ProjectFileReader.FontConverter.cs @@ -55,7 +55,7 @@ internal static class FontConverter if (styleIndex != -1) { // style found. - style = font.Substring(styleIndex, font.Length - styleIndex); + style = font.Substring(styleIndex); // Get the mid-substring containing the size information. sizeStr = font.Substring(nameIndex + 1, styleIndex - nameIndex - 1); diff --git a/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/BinaryEditor.cs b/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/BinaryEditor.cs index 41d850e1d33..4cb7f70ded2 100644 --- a/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/BinaryEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/BinaryEditor.cs @@ -46,7 +46,7 @@ internal static byte[] ConvertToBytes(object value) stream.Position = 0; int byteCount = (int)(stream.Length - stream.Position); byte[] bytes = new byte[byteCount]; - stream.Read(bytes, 0, byteCount); + stream.ReadExactly(bytes, 0, byteCount); return bytes; } diff --git a/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/CodeDomSerializerBase.cs b/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/CodeDomSerializerBase.cs index 7bd3eb184cf..7b3f0c224a7 100644 --- a/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/CodeDomSerializerBase.cs +++ b/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/CodeDomSerializerBase.cs @@ -1424,7 +1424,7 @@ static object ExecuteBinaryOperator(T leftValue, T rightValue, CodeBinaryOper } } - private static object ExecuteBooleanOperator(IConvertible left, IConvertible right, CodeBinaryOperatorType op) + private static bool ExecuteBooleanOperator(IConvertible left, IConvertible right, CodeBinaryOperatorType op) { bool result = false; switch (op) diff --git a/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/TypeCodeDomSerializer.cs b/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/TypeCodeDomSerializer.cs index ecff01f7b51..02751092735 100644 --- a/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/TypeCodeDomSerializer.cs +++ b/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/TypeCodeDomSerializer.cs @@ -15,7 +15,7 @@ namespace System.ComponentModel.Design.Serialization; public partial class TypeCodeDomSerializer : CodeDomSerializerBase { // Used only during deserialization to provide name to object mapping. - private IDictionary? _nameTable; + private HybridDictionary? _nameTable; private Dictionary? _statementTable; private static readonly Attribute[] s_designTimeFilter = [DesignOnlyAttribute.Yes]; private static readonly object s_initMethodKey = new(); diff --git a/src/System.Windows.Forms.Design/src/System/Drawing/Design/ColorEditor.CustomColorDialog.cs b/src/System.Windows.Forms.Design/src/System/Drawing/Design/ColorEditor.CustomColorDialog.cs index 1a841529883..1c80bb58454 100644 --- a/src/System.Windows.Forms.Design/src/System/Drawing/Design/ColorEditor.CustomColorDialog.cs +++ b/src/System.Windows.Forms.Design/src/System/Drawing/Design/ColorEditor.CustomColorDialog.cs @@ -23,7 +23,7 @@ public CustomColorDialog() int size = (int)(stream.Length - stream.Position); byte[] buffer = new byte[size]; - stream.Read(buffer, 0, size); + stream.ReadExactly(buffer, 0, size); _hInstance = Marshal.AllocHGlobal(size); Marshal.Copy(buffer, 0, _hInstance, size); diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/BehaviorService.AdornerWindow.MouseHook.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/BehaviorService.AdornerWindow.MouseHook.cs index fb4a394657c..c34067fa396 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/BehaviorService.AdornerWindow.MouseHook.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/BehaviorService.AdornerWindow.MouseHook.cs @@ -79,7 +79,7 @@ private unsafe void HookMouse() _mouseHookHandle = PInvoke.SetWindowsHookEx( WINDOWS_HOOK_ID.WH_MOUSE, (delegate* unmanaged[Stdcall])hook, - (HINSTANCE)0, + HINSTANCE.Null, PInvokeCore.GetCurrentThreadId()); _isHooked = _mouseHookHandle != 0; diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ChangeToolStripParentVerb.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ChangeToolStripParentVerb.cs index de426f5087e..f41e75d0c80 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ChangeToolStripParentVerb.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ChangeToolStripParentVerb.cs @@ -117,7 +117,7 @@ public void ChangeParent() } } - private static Control GetParent(ToolStripContainer container, Control c) + private static Control GetParent(ToolStripContainer container, ToolStrip c) { Control newParent = container.ContentPanel; DockStyle dock = c.Dock; diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ImageListImageEditor.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ImageListImageEditor.cs index b550a87ebcd..26abab9a586 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ImageListImageEditor.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ImageListImageEditor.cs @@ -100,7 +100,7 @@ private static ImageListImage LoadImageFromStream(Stream stream, bool imageIsIco { // Copy the original stream to a buffer, then wrap a memory stream around it to avoid locking the file. byte[] buffer = new byte[stream.Length]; - stream.Read(buffer, 0, (int)stream.Length); + stream.ReadExactly(buffer, 0, (int)stream.Length); // The created image will take over ownership of the stream. MemoryStream ms = new(buffer); diff --git a/src/System.Windows.Forms.Primitives/src/System/Windows/Forms/DeviceContextExtensions.cs b/src/System.Windows.Forms.Primitives/src/System/Windows/Forms/DeviceContextExtensions.cs index 5e8d271c476..44fe1dc13d9 100644 --- a/src/System.Windows.Forms.Primitives/src/System/Windows/Forms/DeviceContextExtensions.cs +++ b/src/System.Windows.Forms.Primitives/src/System/Windows/Forms/DeviceContextExtensions.cs @@ -131,7 +131,7 @@ internal static void DrawAndFillEllipse( Rectangle bounds) => DrawAndFillEllipse(hdc.HDC, pen, brush, bounds.Left, bounds.Top, bounds.Right, bounds.Bottom); - internal static void DrawAndFillEllipse( + internal static unsafe void DrawAndFillEllipse( this HDC hdc, HPEN pen, HBRUSH brush, diff --git a/src/System.Windows.Forms.Primitives/src/Windows/Win32/UI/HiDpi/DPI_AWARENESS_CONTEXT.cs b/src/System.Windows.Forms.Primitives/src/Windows/Win32/UI/HiDpi/DPI_AWARENESS_CONTEXT.cs index b218c315459..f757a2b2f46 100644 --- a/src/System.Windows.Forms.Primitives/src/Windows/Win32/UI/HiDpi/DPI_AWARENESS_CONTEXT.cs +++ b/src/System.Windows.Forms.Primitives/src/Windows/Win32/UI/HiDpi/DPI_AWARENESS_CONTEXT.cs @@ -5,7 +5,7 @@ namespace Windows.Win32.UI.HiDpi; internal readonly partial struct DPI_AWARENESS_CONTEXT { - internal static DPI_AWARENESS_CONTEXT UNSPECIFIED_DPI_AWARENESS_CONTEXT { get; } = (DPI_AWARENESS_CONTEXT)0; + internal static DPI_AWARENESS_CONTEXT UNSPECIFIED_DPI_AWARENESS_CONTEXT { get; } = Null; /// /// Compares for equality. @@ -14,18 +14,8 @@ internal readonly partial struct DPI_AWARENESS_CONTEXT /// if the specified context is equal; otherwise, if not equal /// or the underlying OS does not support comparing context. /// - public bool IsEquivalent(DPI_AWARENESS_CONTEXT dpiContext) - { - if (this == UNSPECIFIED_DPI_AWARENESS_CONTEXT && dpiContext == UNSPECIFIED_DPI_AWARENESS_CONTEXT) - { - return true; - } - - if (OsVersion.IsWindows10_1607OrGreater()) - { - return PInvoke.AreDpiAwarenessContextsEqual(this, dpiContext); - } - - return false; - } + public bool IsEquivalent(DPI_AWARENESS_CONTEXT dpiContext) => + (this == UNSPECIFIED_DPI_AWARENESS_CONTEXT && dpiContext == UNSPECIFIED_DPI_AWARENESS_CONTEXT) + || (OsVersion.IsWindows10_1607OrGreater() + && (bool)PInvoke.AreDpiAwarenessContextsEqual(this, dpiContext)); } diff --git a/src/System.Windows.Forms.Primitives/tests/TestUtilities/Win32/WindowClass.cs b/src/System.Windows.Forms.Primitives/tests/TestUtilities/Win32/WindowClass.cs index e209bd7993b..b133ab8ec4b 100644 --- a/src/System.Windows.Forms.Primitives/tests/TestUtilities/Win32/WindowClass.cs +++ b/src/System.Windows.Forms.Primitives/tests/TestUtilities/Win32/WindowClass.cs @@ -59,7 +59,7 @@ public unsafe WindowClass( if (icon.IsNull) { - icon = PInvokeCore.LoadIcon((HINSTANCE)0, (PCWSTR)(char*)PInvokeCore.IDI_APPLICATION); + icon = PInvokeCore.LoadIcon(HINSTANCE.Null, (PCWSTR)(char*)PInvokeCore.IDI_APPLICATION); } else if (icon == (-1)) { @@ -68,7 +68,7 @@ public unsafe WindowClass( if (cursor == default) { - cursor = PInvoke.LoadCursor((HINSTANCE)0, (PCWSTR)(char*)PInvoke.IDC_ARROW); + cursor = PInvoke.LoadCursor(HINSTANCE.Null, (PCWSTR)(char*)PInvoke.IDC_ARROW); } else if (cursor == (-1)) { @@ -172,7 +172,7 @@ public unsafe HWND CreateWindow( nHeight: bounds.Height, hWndParent: parentWindow, hMenu: menuHandle, - hInstance: (HINSTANCE)0, + hInstance: HINSTANCE.Null, lpParam: (void*)parameters); } else @@ -190,7 +190,7 @@ public unsafe HWND CreateWindow( nHeight: bounds.Height, hWndParent: parentWindow, hMenu: menuHandle, - hInstance: (HINSTANCE)0, + hInstance: HINSTANCE.Null, lpParam: (void*)parameters); } } diff --git a/src/System.Windows.Forms/src/PublicAPI.Shipped.txt b/src/System.Windows.Forms/src/PublicAPI.Shipped.txt index d3900b1af31..220b0aaad27 100644 --- a/src/System.Windows.Forms/src/PublicAPI.Shipped.txt +++ b/src/System.Windows.Forms/src/PublicAPI.Shipped.txt @@ -2272,7 +2272,6 @@ static System.Windows.Forms.Application.Run(System.Windows.Forms.ApplicationCont static System.Windows.Forms.Application.Run(System.Windows.Forms.Form! mainForm) -> void static System.Windows.Forms.Application.SafeTopLevelCaptionFormat.get -> string! static System.Windows.Forms.Application.SafeTopLevelCaptionFormat.set -> void -static System.Windows.Forms.Application.SetColorMode(System.Windows.Forms.SystemColorMode systemColorMode) -> void static System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(bool defaultValue) -> void static System.Windows.Forms.Application.SetDefaultFont(System.Drawing.Font! font) -> void static System.Windows.Forms.Application.SetHighDpiMode(System.Windows.Forms.HighDpiMode highDpiMode) -> bool @@ -2775,9 +2774,9 @@ static System.Windows.Forms.TabRenderer.IsSupported.get -> bool static System.Windows.Forms.TaskDialog.ShowDialog(nint hwndOwner, System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterOwner) -> System.Windows.Forms.TaskDialogButton! static System.Windows.Forms.TaskDialog.ShowDialog(System.Windows.Forms.IWin32Window! owner, System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterOwner) -> System.Windows.Forms.TaskDialogButton! static System.Windows.Forms.TaskDialog.ShowDialog(System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterOwner) -> System.Windows.Forms.TaskDialogButton! -static System.Windows.Forms.TaskDialog.ShowDialogAsync(nint hwndOwner, System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterOwner) -> System.Threading.Tasks.Task! -static System.Windows.Forms.TaskDialog.ShowDialogAsync(System.Windows.Forms.IWin32Window! owner, System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterOwner) -> System.Threading.Tasks.Task! -static System.Windows.Forms.TaskDialog.ShowDialogAsync(System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterScreen) -> System.Threading.Tasks.Task! +[WFO5002]static System.Windows.Forms.TaskDialog.ShowDialogAsync(nint hwndOwner, System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterOwner) -> System.Threading.Tasks.Task! +[WFO5002]static System.Windows.Forms.TaskDialog.ShowDialogAsync(System.Windows.Forms.IWin32Window! owner, System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterOwner) -> System.Threading.Tasks.Task! +[WFO5002]static System.Windows.Forms.TaskDialog.ShowDialogAsync(System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterScreen) -> System.Threading.Tasks.Task! static System.Windows.Forms.TaskDialogButton.Abort.get -> System.Windows.Forms.TaskDialogButton! static System.Windows.Forms.TaskDialogButton.Cancel.get -> System.Windows.Forms.TaskDialogButton! static System.Windows.Forms.TaskDialogButton.Close.get -> System.Windows.Forms.TaskDialogButton! @@ -4642,7 +4641,7 @@ System.Windows.Forms.ControlEventHandler System.Windows.Forms.ControlPaint System.Windows.Forms.ControlStyles System.Windows.Forms.ControlStyles.AllPaintingInWmPaint = 8192 -> System.Windows.Forms.ControlStyles -System.Windows.Forms.ControlStyles.ApplyThemingImplicitly = 524288 -> System.Windows.Forms.ControlStyles +[WFO5001]System.Windows.Forms.ControlStyles.ApplyThemingImplicitly = 524288 -> System.Windows.Forms.ControlStyles System.Windows.Forms.ControlStyles.CacheText = 16384 -> System.Windows.Forms.ControlStyles System.Windows.Forms.ControlStyles.ContainerControl = 1 -> System.Windows.Forms.ControlStyles System.Windows.Forms.ControlStyles.DoubleBuffer = 65536 -> System.Windows.Forms.ControlStyles @@ -6417,20 +6416,16 @@ System.Windows.Forms.Form.DpiChanged -> System.Windows.Forms.DpiChangedEventHand System.Windows.Forms.Form.Form() -> void System.Windows.Forms.Form.FormBorderColor.get -> System.Drawing.Color System.Windows.Forms.Form.FormBorderColor.set -> void -System.Windows.Forms.Form.FormBorderColorChanged -> System.EventHandler? System.Windows.Forms.Form.FormBorderStyle.get -> System.Windows.Forms.FormBorderStyle System.Windows.Forms.Form.FormBorderStyle.set -> void System.Windows.Forms.Form.FormCaptionBackColor.get -> System.Drawing.Color System.Windows.Forms.Form.FormCaptionBackColor.set -> void -System.Windows.Forms.Form.FormCaptionBackColorChanged -> System.EventHandler? System.Windows.Forms.Form.FormCaptionTextColor.get -> System.Drawing.Color System.Windows.Forms.Form.FormCaptionTextColor.set -> void -System.Windows.Forms.Form.FormCaptionTextColorChanged -> System.EventHandler? System.Windows.Forms.Form.FormClosed -> System.Windows.Forms.FormClosedEventHandler? System.Windows.Forms.Form.FormClosing -> System.Windows.Forms.FormClosingEventHandler? System.Windows.Forms.Form.FormCornerPreference.get -> System.Windows.Forms.FormCornerPreference System.Windows.Forms.Form.FormCornerPreference.set -> void -System.Windows.Forms.Form.FormCornerPreferenceChanged -> System.EventHandler? System.Windows.Forms.Form.HelpButton.get -> bool System.Windows.Forms.Form.HelpButton.set -> void System.Windows.Forms.Form.HelpButtonClicked -> System.ComponentModel.CancelEventHandler? @@ -6484,11 +6479,8 @@ System.Windows.Forms.Form.RightToLeftLayoutChanged -> System.EventHandler? System.Windows.Forms.Form.SetDesktopBounds(int x, int y, int width, int height) -> void System.Windows.Forms.Form.SetDesktopLocation(int x, int y) -> void System.Windows.Forms.Form.Show(System.Windows.Forms.IWin32Window? owner) -> void -System.Windows.Forms.Form.ShowAsync(System.Windows.Forms.IWin32Window? owner = null) -> System.Threading.Tasks.Task! System.Windows.Forms.Form.ShowDialog() -> System.Windows.Forms.DialogResult System.Windows.Forms.Form.ShowDialog(System.Windows.Forms.IWin32Window? owner) -> System.Windows.Forms.DialogResult -System.Windows.Forms.Form.ShowDialogAsync() -> System.Threading.Tasks.Task! -System.Windows.Forms.Form.ShowDialogAsync(System.Windows.Forms.IWin32Window! owner) -> System.Threading.Tasks.Task! System.Windows.Forms.Form.ShowIcon.get -> bool System.Windows.Forms.Form.ShowIcon.set -> void System.Windows.Forms.Form.ShowInTaskbar.get -> bool @@ -6532,11 +6524,6 @@ System.Windows.Forms.FormClosingEventArgs.FormClosingEventArgs(System.Windows.Fo System.Windows.Forms.FormClosingEventHandler System.Windows.Forms.FormCollection System.Windows.Forms.FormCollection.FormCollection() -> void -System.Windows.Forms.FormCornerPreference -System.Windows.Forms.FormCornerPreference.Default = 0 -> System.Windows.Forms.FormCornerPreference -System.Windows.Forms.FormCornerPreference.DoNotRound = 1 -> System.Windows.Forms.FormCornerPreference -System.Windows.Forms.FormCornerPreference.Round = 2 -> System.Windows.Forms.FormCornerPreference -System.Windows.Forms.FormCornerPreference.RoundSmall = 3 -> System.Windows.Forms.FormCornerPreference System.Windows.Forms.FormStartPosition System.Windows.Forms.FormStartPosition.CenterParent = 4 -> System.Windows.Forms.FormStartPosition System.Windows.Forms.FormStartPosition.CenterScreen = 1 -> System.Windows.Forms.FormStartPosition @@ -9551,10 +9538,6 @@ System.Windows.Forms.StructFormat System.Windows.Forms.StructFormat.Ansi = 1 -> System.Windows.Forms.StructFormat System.Windows.Forms.StructFormat.Auto = 3 -> System.Windows.Forms.StructFormat System.Windows.Forms.StructFormat.Unicode = 2 -> System.Windows.Forms.StructFormat -System.Windows.Forms.SystemColorMode -System.Windows.Forms.SystemColorMode.Classic = 0 -> System.Windows.Forms.SystemColorMode -System.Windows.Forms.SystemColorMode.Dark = 2 -> System.Windows.Forms.SystemColorMode -System.Windows.Forms.SystemColorMode.System = 1 -> System.Windows.Forms.SystemColorMode System.Windows.Forms.SystemInformation System.Windows.Forms.SystemParameter System.Windows.Forms.SystemParameter.CaretWidthMetric = 8 -> System.Windows.Forms.SystemParameter @@ -13018,12 +13001,8 @@ virtual System.Windows.Forms.Form.OnClosed(System.EventArgs! e) -> void virtual System.Windows.Forms.Form.OnClosing(System.ComponentModel.CancelEventArgs! e) -> void virtual System.Windows.Forms.Form.OnDeactivate(System.EventArgs! e) -> void virtual System.Windows.Forms.Form.OnDpiChanged(System.Windows.Forms.DpiChangedEventArgs! e) -> void -virtual System.Windows.Forms.Form.OnFormBorderColorChanged(System.EventArgs! e) -> void -virtual System.Windows.Forms.Form.OnFormCaptionBackColorChanged(System.EventArgs! e) -> void -virtual System.Windows.Forms.Form.OnFormCaptionTextColorChanged(System.EventArgs! e) -> void virtual System.Windows.Forms.Form.OnFormClosed(System.Windows.Forms.FormClosedEventArgs! e) -> void virtual System.Windows.Forms.Form.OnFormClosing(System.Windows.Forms.FormClosingEventArgs! e) -> void -virtual System.Windows.Forms.Form.OnFormCornerPreferenceChanged(System.EventArgs! e) -> void virtual System.Windows.Forms.Form.OnGetDpiScaledSize(int deviceDpiOld, int deviceDpiNew, ref System.Drawing.Size desiredSize) -> bool virtual System.Windows.Forms.Form.OnHelpButtonClicked(System.ComponentModel.CancelEventArgs! e) -> void virtual System.Windows.Forms.Form.OnInputLanguageChanged(System.Windows.Forms.InputLanguageChangedEventArgs! e) -> void diff --git a/src/System.Windows.Forms/src/PublicAPI.Unshipped.txt b/src/System.Windows.Forms/src/PublicAPI.Unshipped.txt index 1c427e0ef6c..bdd6c2d1665 100644 --- a/src/System.Windows.Forms/src/PublicAPI.Unshipped.txt +++ b/src/System.Windows.Forms/src/PublicAPI.Unshipped.txt @@ -1 +1,22 @@ System.Windows.Forms.DataGridViewCellStyle.Font.get -> System.Drawing.Font? +[WFO5001]static System.Windows.Forms.Application.SetColorMode(System.Windows.Forms.SystemColorMode systemColorMode) -> void +[WFO5001]System.Windows.Forms.Form.FormBorderColorChanged -> System.EventHandler? +[WFO5001]System.Windows.Forms.Form.FormCaptionBackColorChanged -> System.EventHandler? +[WFO5001]System.Windows.Forms.Form.FormCaptionTextColorChanged -> System.EventHandler? +[WFO5001]System.Windows.Forms.Form.FormCornerPreferenceChanged -> System.EventHandler? +[WFO5001]System.Windows.Forms.FormCornerPreference +[WFO5001]System.Windows.Forms.FormCornerPreference.Default = 0 -> System.Windows.Forms.FormCornerPreference +[WFO5001]System.Windows.Forms.FormCornerPreference.DoNotRound = 1 -> System.Windows.Forms.FormCornerPreference +[WFO5001]System.Windows.Forms.FormCornerPreference.Round = 2 -> System.Windows.Forms.FormCornerPreference +[WFO5001]System.Windows.Forms.FormCornerPreference.RoundSmall = 3 -> System.Windows.Forms.FormCornerPreference +[WFO5001]System.Windows.Forms.SystemColorMode +[WFO5001]System.Windows.Forms.SystemColorMode.Classic = 0 -> System.Windows.Forms.SystemColorMode +[WFO5001]System.Windows.Forms.SystemColorMode.Dark = 2 -> System.Windows.Forms.SystemColorMode +[WFO5001]System.Windows.Forms.SystemColorMode.System = 1 -> System.Windows.Forms.SystemColorMode +[WFO5001]virtual System.Windows.Forms.Form.OnFormBorderColorChanged(System.EventArgs! e) -> void +[WFO5001]virtual System.Windows.Forms.Form.OnFormCaptionBackColorChanged(System.EventArgs! e) -> void +[WFO5001]virtual System.Windows.Forms.Form.OnFormCaptionTextColorChanged(System.EventArgs! e) -> void +[WFO5001]virtual System.Windows.Forms.Form.OnFormCornerPreferenceChanged(System.EventArgs! e) -> void +[WFO5002]System.Windows.Forms.Form.ShowAsync(System.Windows.Forms.IWin32Window? owner = null) -> System.Threading.Tasks.Task! +[WFO5002]System.Windows.Forms.Form.ShowDialogAsync() -> System.Threading.Tasks.Task! +[WFO5002]System.Windows.Forms.Form.ShowDialogAsync(System.Windows.Forms.IWin32Window! owner) -> System.Threading.Tasks.Task! diff --git a/src/System.Windows.Forms/src/System/Resources/ResxFileRef.Converter.cs b/src/System.Windows.Forms/src/System/Resources/ResxFileRef.Converter.cs index 55157c38f07..e1eea3ece96 100644 --- a/src/System.Windows.Forms/src/System/Resources/ResxFileRef.Converter.cs +++ b/src/System.Windows.Forms/src/System/Resources/ResxFileRef.Converter.cs @@ -120,7 +120,7 @@ public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destina using (FileStream fileStream = new(fileName, FileMode.Open, FileAccess.Read, FileShare.Read)) { temp = new byte[fileStream.Length]; - fileStream.Read(temp, 0, (int)fileStream.Length); + fileStream.ReadExactly(temp, 0, (int)fileStream.Length); } if (toCreate == typeof(byte[])) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ComboBox/ComboBox.ComboBoxAccessibleObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ComboBox/ComboBox.ComboBoxAccessibleObject.cs index cdcbfa45beb..adf8e703345 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ComboBox/ComboBox.ComboBoxAccessibleObject.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ComboBox/ComboBox.ComboBoxAccessibleObject.cs @@ -130,7 +130,7 @@ internal void RemoveComboBoxItemAccessibleObjectAt(int index) return; } - IReadOnlyList entries = owner.Items.InnerList; + List entries = owner.Items.InnerList; Debug.Assert(index < entries.Count); Entry item = entries[index]; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridView.Methods.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridView.Methods.cs index 403a1170cb4..a56f85becd4 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridView.Methods.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridView.Methods.cs @@ -11515,7 +11515,7 @@ private void CheckEventArgsIndexesUpperBounds(IDataGridViewCellEventArgs e) ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(e.RowIndex, Rows.Count, "e.RowIndex"); } - private static void CheckEventArgsIndexesNotNegative(IDataGridViewCellEventArgs e) + private static void CheckEventArgsIndexesNotNegative(DataGridViewCellValueEventArgs e) { ArgumentOutOfRangeException.ThrowIfNegative(e.ColumnIndex, "e.ColumnIndex"); ArgumentOutOfRangeException.ThrowIfNegative(e.RowIndex, "e.RowIndex"); diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/ImmutablePropertyDescriptorGridEntry.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/ImmutablePropertyDescriptorGridEntry.cs index d94137a0e8a..6cb2e3978cd 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/ImmutablePropertyDescriptorGridEntry.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/ImmutablePropertyDescriptorGridEntry.cs @@ -54,7 +54,7 @@ public override object? PropertyValue PropertyDescriptorCollection? properties = parentConverter.GetProperties(parentEntry, owner); if (properties is not null) { - IDictionary values = new Hashtable(properties.Count); + Hashtable values = new Hashtable(properties.Count); for (int i = 0; i < properties.Count; i++) { if (PropertyDescriptor.Name is not null && PropertyDescriptor.Name.Equals(properties[i].Name)) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.MouseHook.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.MouseHook.cs index 1203a3d9191..9b30e681e5d 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.MouseHook.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.MouseHook.cs @@ -95,7 +95,7 @@ private unsafe void HookMouse() _mouseHookHandle = PInvoke.SetWindowsHookEx( WINDOWS_HOOK_ID.WH_MOUSE, (delegate* unmanaged[Stdcall])hook, - (HINSTANCE)0, + HINSTANCE.Null, PInvokeCore.GetCurrentThreadId()); Debug.Assert(!_mouseHookHandle.IsNull, "Failed to install mouse hook"); diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/RichTextBox/RichTextBox.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/RichTextBox/RichTextBox.cs index 94b9dd5d3c9..c14818b4c25 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/RichTextBox/RichTextBox.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/RichTextBox/RichTextBox.cs @@ -2857,8 +2857,19 @@ private void StreamIn(Stream data, uint flags) if ((flags & PInvoke.SF_RTF) != 0) { long streamStart = _editStream.Position; + byte[] bytes = new byte[SZ_RTF_TAG.Length]; - _editStream.Read(bytes, (int)streamStart, SZ_RTF_TAG.Length); + try + { + // When we reading with `ReadExactly`, we usually will get overshoot at this point anyway in most cases + // and then know that the format cannot be correct. So, we're packing this and throw, but we still need + // to throw an `ArgumentException` to not introduce a breaking change. + _editStream.ReadExactly(bytes, (int)streamStart, SZ_RTF_TAG.Length); + } + catch (EndOfStreamException ex) + { + throw new ArgumentException(SR.InvalidFileFormat, ex); + } // Encode using the default encoding. string str = (CodePagesEncodingProvider.Instance.GetEncoding(0) ?? Encoding.UTF8).GetString(bytes); diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripManager.ModalMenuFilter.HostedWindowsFormsMessageHook.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripManager.ModalMenuFilter.HostedWindowsFormsMessageHook.cs index a1160a2cbf5..ae6c260d2c6 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripManager.ModalMenuFilter.HostedWindowsFormsMessageHook.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripManager.ModalMenuFilter.HostedWindowsFormsMessageHook.cs @@ -66,7 +66,7 @@ private unsafe void InstallMessageHook() _messageHookHandle = PInvoke.SetWindowsHookEx( WINDOWS_HOOK_ID.WH_GETMESSAGE, (delegate* unmanaged[Stdcall])hook, - (HINSTANCE)0, + HINSTANCE.Null, PInvokeCore.GetCurrentThreadId()); if (_messageHookHandle != IntPtr.Zero) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripPanel.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripPanel.cs index abc3e0041b2..107277f133e 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripPanel.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripPanel.cs @@ -993,7 +993,7 @@ private void MoveOutsideContainer(ToolStrip toolStripToDrag, Point screenLocatio toolStripToDrag.PerformLayout(); #if DEBUG - ISupportToolStripPanel draggedControl = toolStripToDrag; + ToolStrip draggedControl = toolStripToDrag; if (draggedControl.IsCurrentlyDragging) { Debug_VerifyNoOverlaps(); diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Form.EnumThreadWindowsCallback.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Form.EnumThreadWindowsCallback.cs index 3b808e354b2..56f09afbc41 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Form.EnumThreadWindowsCallback.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Form.EnumThreadWindowsCallback.cs @@ -35,14 +35,14 @@ internal BOOL Callback(HWND hwnd) } // Resets the owner of all the windows owned by this Form before handle recreation. - internal void ResetOwners() + internal unsafe void ResetOwners() { if (_ownedWindows is not null) { foreach (HWND hwnd in _ownedWindows) { nint oldValue = PInvokeCore.SetWindowLong(hwnd, WINDOW_LONG_PTR_INDEX.GWL_HWNDPARENT, 0); - Debug.Assert(oldValue == _formHandle.Value); + Debug.Assert(oldValue == (nint)_formHandle.Value); } } } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Form.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Form.cs index b61190873d2..4d30f9c454e 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Form.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Form.cs @@ -6064,7 +6064,7 @@ private void UpdateLayered() } } - private void UpdateMenuHandles(bool recreateMenu = false) + private unsafe void UpdateMenuHandles(bool recreateMenu = false) { if (!IsHandleCreated) { diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Input/Cursor.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Input/Cursor.cs index 6049ee60253..14351a6b9f1 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Input/Cursor.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Input/Cursor.cs @@ -35,7 +35,7 @@ internal unsafe Cursor(PCWSTR nResourceId, string cursorsProperty) GC.SuppressFinalize(this); _freeHandle = false; CursorsProperty = cursorsProperty; - _handle = PInvoke.LoadCursor((HINSTANCE)0, nResourceId); + _handle = PInvoke.LoadCursor(HINSTANCE.Null, nResourceId); if (_handle.IsNull) { throw new Win32Exception(string.Format(SR.FailedToLoadCursor, Marshal.GetLastWin32Error())); @@ -474,7 +474,7 @@ internal unsafe byte[] GetData() public static bool operator !=(Cursor? left, Cursor? right) => !(left == right); - public override int GetHashCode() => (int)_handle.Value; + public override unsafe int GetHashCode() => (int)_handle.Value; public override bool Equals(object? obj) => obj is Cursor cursor && this == cursor; } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/NativeWindow.WindowClass.cs b/src/System.Windows.Forms/src/System/Windows/Forms/NativeWindow.WindowClass.cs index ab0c10c0390..0f1273097c4 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/NativeWindow.WindowClass.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/NativeWindow.WindowClass.cs @@ -142,7 +142,7 @@ private unsafe void RegisterClass() // A system defined Window class was specified, get its info. fixed (char* n = localClassName) { - if (!PInvoke.GetClassInfo((HINSTANCE)0, n, &windowClass)) + if (!PInvoke.GetClassInfo(HINSTANCE.Null, n, &windowClass)) { throw new Win32Exception(Marshal.GetLastWin32Error(), SR.InvalidWndClsName); } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.WinFormsToNativeAdapter.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.WinFormsToNativeAdapter.cs index 77f9bbb2d93..cb132cb5e9c 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.WinFormsToNativeAdapter.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.WinFormsToNativeAdapter.cs @@ -357,7 +357,7 @@ private static HRESULT SaveStreamToHGLOBAL(ref HGLOBAL hglobal, Stream stream) { Span span = new(buffer, size); stream.Position = 0; - stream.Read(span); + stream.ReadExactly(span); } finally { diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Rendering/DCMapping.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Rendering/DCMapping.cs index 4ef8c0e211e..9337a420ffa 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Rendering/DCMapping.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Rendering/DCMapping.cs @@ -28,7 +28,10 @@ namespace System.Windows.Forms; public unsafe DCMapping(HDC hdc, Rectangle bounds) { - ArgumentNullException.ThrowIfNull(hdc); + if (hdc.IsNull) + { + throw new ArgumentNullException(nameof(hdc)); + } _hdc = hdc; _savedState = PInvokeCore.SaveDC(hdc); diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ToolTip/ToolTip.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ToolTip/ToolTip.cs index ff4e6c0c220..a11d20c6698 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/ToolTip/ToolTip.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/ToolTip/ToolTip.cs @@ -2323,8 +2323,7 @@ private unsafe void WndProc(ref Message message) using Graphics graphics = paintScope.HDC.CreateGraphics(); - IWin32Window? window = GetCurrentToolWindow(); - if (window is not null) + if (GetCurrentToolWindow() is IWin32Window window) { Font font; try @@ -2339,6 +2338,7 @@ private unsafe void WndProc(ref Message message) } Control? control = window as Control ?? Control.FromHandle(window.Handle); + OnDraw( new DrawToolTipEventArgs( graphics, diff --git a/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/DragDropTests.cs b/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/DragDropTests.cs index bfd30f7eadf..52bd6337be3 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/DragDropTests.cs +++ b/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/DragDropTests.cs @@ -247,6 +247,7 @@ unsafe void RunTest() return Task.CompletedTask; +#pragma warning disable VSTHRD100 // Avoid async void methods async void RunInputSimulator(Point virtualPointStart, Point virtualPointEnd) { await InputSimulator.SendAsync( @@ -265,6 +266,7 @@ await InputSimulator.SendAsync( .MoveMouseToPositionOnVirtualDesktop(virtualPointEnd.X, virtualPointEnd.Y) .LeftButtonUp()); } +#pragma warning restore VSTHRD100 // Avoid async void methods }); } diff --git a/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/Infra/ControlTestBase.cs b/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/Infra/ControlTestBase.cs index b1725fe2e3b..723785506cf 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/Infra/ControlTestBase.cs +++ b/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/Infra/ControlTestBase.cs @@ -307,7 +307,9 @@ protected async Task RunFormAsync(Func<(Form dialog, T control)> createDialog TaskCompletionSource gate = new(TaskCreationOptions.RunContinuationsAsynchronously); JoinableTask test = JoinableTaskFactory.RunAsync(async () => { +#pragma warning disable VSTHRD003 // Avoid awaiting foreign Tasks await gate.Task; +#pragma warning restore VSTHRD003 // Avoid awaiting foreign Tasks await JoinableTaskFactory.SwitchToMainThreadAsync(); await WaitForIdleAsync(); try @@ -351,7 +353,9 @@ protected async Task RunFormWithoutControlAsync(Func createForm, F TaskCompletionSource gate = new(TaskCreationOptions.RunContinuationsAsynchronously); JoinableTask test = JoinableTaskFactory.RunAsync(async () => { +#pragma warning disable VSTHRD003 // Avoid awaiting foreign Tasks await gate.Task; +#pragma warning restore VSTHRD003 // Avoid awaiting foreign Tasks await JoinableTaskFactory.SwitchToMainThreadAsync(); await WaitForIdleAsync(); try diff --git a/src/System.Windows.Forms/tests/InteropTests/RichTextBoxTests.cs b/src/System.Windows.Forms/tests/InteropTests/RichTextBoxTests.cs index 6fc412db5cd..2691337a13f 100644 --- a/src/System.Windows.Forms/tests/InteropTests/RichTextBoxTests.cs +++ b/src/System.Windows.Forms/tests/InteropTests/RichTextBoxTests.cs @@ -19,7 +19,7 @@ public static void RichTextBox_EnLink_Test() RichTextBox_EnLink(out var value); Assert.Equal(132u, value.nmhdr.code); - Assert.Equal((HWND)765, value.nmhdr.hwndFrom); + Assert.Equal((HWND)(nint)765, value.nmhdr.hwndFrom); Assert.Equal(432u, value.nmhdr.idFrom); Assert.Equal(22, value.msg); Assert.Equal((nuint)6578, value.wParam); @@ -34,7 +34,7 @@ public static void RichTextBox_EnProtected_Test() RichTextBox_EnProtected(out var value); Assert.Equal(132u, value.nmhdr.code); - Assert.Equal((HWND)765, value.nmhdr.hwndFrom); + Assert.Equal((HWND)(nint)765, value.nmhdr.hwndFrom); Assert.Equal(432u, value.nmhdr.idFrom); Assert.Equal(22, value.msg); Assert.Equal((nuint)6578, value.wParam); @@ -49,7 +49,7 @@ public static void RichTextBox_EnDropFiles_Test() RichTextBox_EnDropFiles(out var value); Assert.Equal(132u, value.nmhdr.code); - Assert.Equal((HWND)765, value.nmhdr.hwndFrom); + Assert.Equal((HWND)(nint)765, value.nmhdr.hwndFrom); Assert.Equal(432u, value.nmhdr.idFrom); Assert.Equal(22, value.hDrop); Assert.Equal(6578, value.cp); @@ -130,7 +130,7 @@ public static void RichTextBox_ReqResize_Test() RichTextBox_ReqResize(out var value); Assert.Equal(132u, value.nmhdr.code); - Assert.Equal((HWND)765, value.nmhdr.hwndFrom); + Assert.Equal((HWND)(nint)765, value.nmhdr.hwndFrom); Assert.Equal(432u, value.nmhdr.idFrom); Assert.Equal(6578, value.rc.left); Assert.Equal(109, value.rc.right); @@ -144,7 +144,7 @@ public static void RichTextBox_SelChange_Test() RichTextBox_SelChange(out var value); Assert.Equal(132u, value.nmhdr.code); - Assert.Equal((HWND)765, value.nmhdr.hwndFrom); + Assert.Equal((HWND)(nint)765, value.nmhdr.hwndFrom); Assert.Equal(432u, value.nmhdr.idFrom); Assert.Equal(RICH_EDIT_GET_CONTEXT_MENU_SEL_TYPE.SEL_MULTICHAR, value.seltyp); Assert.Equal(109, value.chrg.cpMin); diff --git a/src/System.Windows.Forms/tests/UnitTests/SerializableTypesTests.cs b/src/System.Windows.Forms/tests/UnitTests/SerializableTypesTests.cs index d77e269a967..f7824ee0610 100644 --- a/src/System.Windows.Forms/tests/UnitTests/SerializableTypesTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/SerializableTypesTests.cs @@ -61,7 +61,7 @@ unsafe void ValidateResult(string blob) Assert.True(ComHelpers.TryGetObjectForIUnknown(streamOut, out ComManagedStream managedStream)); Stream bufferStream = managedStream.GetDataStream(); byte[] buffer = new byte[3]; - bufferStream.Read(buffer, 0, buffer.Length); + bufferStream.ReadExactly(buffer); Assert.Equal(payload, Encoding.UTF8.GetString(buffer)); } } diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/FileDialogTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/FileDialogTests.cs index ae73054706a..c976191976f 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/FileDialogTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/FileDialogTests.cs @@ -651,7 +651,7 @@ public unsafe void FileDialog_RunDialog_NonVista_Success(bool result) dialog.RunFileDialogAction = o => { Assert.Equal(sizeof(OPENFILENAME), (int)o.lStructSize); - Assert.Equal((HWND)1, o.hwndOwner); + Assert.Equal((HWND)(nint)1, o.hwndOwner); Assert.Equal(dialog.Instance, o.hInstance); ReadOnlySpan filter = new(o.lpstrFilter.Value, o.lpstrFilter.StringListLength); Assert.True(filter.SequenceEqual(" \0*.*")); @@ -747,7 +747,7 @@ public unsafe void FileDialog_RunDialog_ShowHelp_Success(bool result) dialog.RunFileDialogAction = o => { Assert.Equal(sizeof(OPENFILENAME), (int)o.lStructSize); - Assert.Equal((HWND)1, o.hwndOwner); + Assert.Equal((HWND)(nint)1, o.hwndOwner); Assert.Equal(dialog.Instance, o.hInstance); ReadOnlySpan filter = new(o.lpstrFilter.Value, o.lpstrFilter.StringListLength); Assert.True(filter.SequenceEqual(" \0*.*")); diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ScreenTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ScreenTests.cs index cecdfe281da..f1fa6bf945e 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ScreenTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ScreenTests.cs @@ -33,15 +33,15 @@ public void Screen_PrimaryScreen_Get_ReturnsExpected() public static IEnumerable Equals_Screen_TestData() { - Screen screen = new((HMONITOR)1); + Screen screen = new((HMONITOR)(nint)1); yield return new object[] { screen, screen, true }; - yield return new object[] { screen, new Screen((HMONITOR)1), true }; - yield return new object[] { screen, new Screen((HMONITOR)2), false }; + yield return new object[] { screen, new Screen((HMONITOR)(nint)1), true }; + yield return new object[] { screen, new Screen((HMONITOR)(nint)2), false }; } public static IEnumerable Equals_Object_TestData() { - Screen screen = new((HMONITOR)1); + Screen screen = new((HMONITOR)(nint)1); yield return new object[] { screen, new(), false }; yield return new object[] { screen, null, false }; } From e50878fca2173bed38cd4aba2767da86101ec8b8 Mon Sep 17 00:00:00 2001 From: Jeremy Kuhne Date: Mon, 9 Dec 2024 17:13:41 -0800 Subject: [PATCH 089/106] Add additional error defines (#12614) Add a number of additional defines that are coming up in WPF. Also add a few more NtStatus related helpers to HRESULT. --- .../src/NativeMethods.txt | 24 ++++++--- .../src/Windows/Win32/Foundation/HRESULT.cs | 49 ++++++++++++++++++- 2 files changed, 65 insertions(+), 8 deletions(-) diff --git a/src/System.Private.Windows.Core/src/NativeMethods.txt b/src/System.Private.Windows.Core/src/NativeMethods.txt index c61bef77b73..8cf1d9a8816 100644 --- a/src/System.Private.Windows.Core/src/NativeMethods.txt +++ b/src/System.Private.Windows.Core/src/NativeMethods.txt @@ -18,6 +18,7 @@ CreateICW CreatePen CreateRectRgn CreateSolidBrush +DATA_S_SAMEFORMATETC DefWindowProc DeleteDC DeleteObject @@ -49,9 +50,7 @@ DRAGDROP_S_CANCEL DRAGDROP_S_DROP DRAGDROP_S_USEDEFAULTCURSORS DrawIconEx -DV_E_DVASPECT -DV_E_FORMATETC -DV_E_TYMED +DV_E_* E_ABORT E_ACCESSDENIED E_FAIL @@ -60,6 +59,7 @@ E_INVALIDARG E_NOINTERFACE E_NOTIMPL E_OUTOFMEMORY +E_PENDING E_POINTER E_UNEXPECTED EM_* @@ -170,10 +170,19 @@ MonitorFromWindow MONITORINFOEXW MONITORINFOF_* NONCLIENTMETRICSW +NS_E_WMP_URLDOWNLOADFAILED +NS_E_WMP_LOGON_FAILURE +NS_E_WMP_CANNOT_FIND_FILE +NS_E_WMP_UNSUPPORTED_FORMAT +NS_E_WMP_DSHOW_UNSUPPORTED_FORMAT +NS_E_WMP_INVALID_ASX NTSTATUS OBJ_TYPE OBJECT_IDENTIFIER OffsetViewportOrgEx +OLECMDERR_E_DISABLED +OLECMDERR_E_NOTSUPPORTED +OLECMDERR_E_UNKNOWNGROUP OLE_E_ADVISENOTSUPPORTED OLE_E_INVALIDRECT OLE_E_NOCONNECTION @@ -194,6 +203,10 @@ REGDB_E_CLASSNOTREG ReleaseDC RestoreDC RPC_E_CHANGED_MODE +RPC_E_DISCONNECTED +RPC_E_SERVERFAULT +RPC_E_SYS_CALL_FAILED +RPC_STATUS S_FALSE S_OK SAFEARRAY @@ -223,10 +236,7 @@ STATFLAG STATUS_NO_MEMORY STATUS_PENDING STATUS_SUCCESS -STG_E_FILENOTFOUND -STG_E_INVALIDFLAG -STG_E_INVALIDFUNCTION -STG_E_INVALIDPOINTER +STG_E_* STGTY STILL_ACTIVE SystemParametersInfo diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Foundation/HRESULT.cs b/src/System.Private.Windows.Core/src/Windows/Win32/Foundation/HRESULT.cs index d296a94dfae..ddd1dec40df 100644 --- a/src/System.Private.Windows.Core/src/Windows/Win32/Foundation/HRESULT.cs +++ b/src/System.Private.Windows.Core/src/Windows/Win32/Foundation/HRESULT.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. using Windows.Win32.System.Diagnostics.Debug; +using Windows.Win32.System.Variant; +using Windows.Win32.System.Com; namespace Windows.Win32.Foundation; @@ -23,13 +25,29 @@ public int Code // #define HRESULT_CODE(hr) ((hr) & 0xFFFF) => Value & 0xFFFF; + /// + /// if the HRESULT represents an NTSTATUS code. + /// + public bool IsNtStatus => (Value & (int)FACILITY_CODE.FACILITY_NT_BIT) == (int)FACILITY_CODE.FACILITY_NT_BIT; + + /// + /// Extracts the code. Check before calling this method. + /// + public NTSTATUS ToNtStatus() + { + Debug.Assert(IsNtStatus); + return new NTSTATUS(Value & ~(int)FACILITY_CODE.FACILITY_NT_BIT); + } + /// /// Converts a Win32 error code into an HRESULT. [HRESULT_FROM_WIN32] /// public static HRESULT FromWin32(WIN32_ERROR error) // https://learn.microsoft.com/windows/win32/api/winerror/nf-winerror-hresult_from_win32 // return (HRESULT)(x) <= 0 ? (HRESULT)(x) : (HRESULT) (((x) & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000); - => new(((int)error & 0x0000FFFF) | unchecked((int)0x80070000)); + => error == WIN32_ERROR.NO_ERROR + ? S_OK + : new HRESULT(((int)error & 0x0000FFFF) | unchecked((int)0x80070000)); public static implicit operator HRESULT(Exception ex) { @@ -55,6 +73,35 @@ public static implicit operator HRESULT(Exception ex) public static readonly HRESULT COR_E_TARGETINVOCATION = (HRESULT)unchecked((int)0x80131604); public static readonly HRESULT COR_E_OBJECTDISPOSED = (HRESULT)unchecked((int)0x80131622); + /// + /// There is no associated handler for the given item registered by the specified application. + /// (Windows Jump List) + /// + public static readonly HRESULT DESTS_E_NO_MATCHING_ASSOC_HANDLER = (HRESULT)unchecked((int)0x80040F03); + + /// + /// Object required. + /// + /// + /// + /// Visual Basic 6 and VBA raise this when objects have been collected or values + /// aren't actually or object pointers. + /// + /// + /// Seen in various places as E_UNKNOWNWORDERROR, VBA_E_NOTOBJECT, or the VB native EBERR_NotObject. + /// is used for all VB errors raised as s. + /// + /// + /// + /// Object required (Error 424) + /// + /// + /// + /// + /// Closing Word when a search is running was a way this could be generated per legacy comments. + /// + public static readonly HRESULT VB_E_NOTOBJECT = (HRESULT)unchecked((int)0x800A01A8); + #pragma warning restore format #pragma warning restore IDE1006 } From 3d6e12c19bfd859f1fd9e9fc794b6a28c6e99ace Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 13:42:09 +0000 Subject: [PATCH 090/106] [main] Update dependencies from dotnet/arcade (#12617) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 24 +++--- eng/Versions.props | 6 +- eng/common/cross/toolchain.cmake | 138 ++++++++++++------------------- global.json | 6 +- 4 files changed, 73 insertions(+), 101 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4db80e572bc..d03aaf03695 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -191,29 +191,29 @@ Note: if the Uri is a new place, you will need to add a subscription from that p - + https://github.com/dotnet/arcade - 61b8f746424762d2e3173ebfaab19346224d591c + 1fba3c5407537249f8c55332cd3d1ac81c39fdb2 - + https://github.com/dotnet/arcade - 61b8f746424762d2e3173ebfaab19346224d591c + 1fba3c5407537249f8c55332cd3d1ac81c39fdb2 - + https://github.com/dotnet/arcade - 61b8f746424762d2e3173ebfaab19346224d591c + 1fba3c5407537249f8c55332cd3d1ac81c39fdb2 - + https://github.com/dotnet/arcade - 61b8f746424762d2e3173ebfaab19346224d591c + 1fba3c5407537249f8c55332cd3d1ac81c39fdb2 - + https://github.com/dotnet/arcade - 61b8f746424762d2e3173ebfaab19346224d591c + 1fba3c5407537249f8c55332cd3d1ac81c39fdb2 - + https://github.com/dotnet/arcade - 61b8f746424762d2e3173ebfaab19346224d591c + 1fba3c5407537249f8c55332cd3d1ac81c39fdb2 diff --git a/eng/Versions.props b/eng/Versions.props index bce7e52c59c..72dc1c57f66 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -56,9 +56,9 @@ - 10.0.0-beta.24606.6 - 10.0.0-beta.24606.6 - 10.0.0-beta.24606.6 + 10.0.0-beta.24609.8 + 10.0.0-beta.24609.8 + 10.0.0-beta.24609.8 17.4.0-preview-20220707-01 diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake index 9a4e285a5ae..deac538e690 100644 --- a/eng/common/cross/toolchain.cmake +++ b/eng/common/cross/toolchain.cmake @@ -40,7 +40,7 @@ if(TARGET_ARCH_NAME STREQUAL "arm") set(TOOLCHAIN "arm-linux-gnueabihf") endif() if(TIZEN) - set(TIZEN_TOOLCHAIN "armv7hl-tizen-linux-gnueabihf/9.2.0") + set(TIZEN_TOOLCHAIN "armv7hl-tizen-linux-gnueabihf") endif() elseif(TARGET_ARCH_NAME STREQUAL "arm64") set(CMAKE_SYSTEM_PROCESSOR aarch64) @@ -49,7 +49,7 @@ elseif(TARGET_ARCH_NAME STREQUAL "arm64") elseif(LINUX) set(TOOLCHAIN "aarch64-linux-gnu") if(TIZEN) - set(TIZEN_TOOLCHAIN "aarch64-tizen-linux-gnu/9.2.0") + set(TIZEN_TOOLCHAIN "aarch64-tizen-linux-gnu") endif() elseif(FREEBSD) set(triple "aarch64-unknown-freebsd12") @@ -58,7 +58,7 @@ elseif(TARGET_ARCH_NAME STREQUAL "armel") set(CMAKE_SYSTEM_PROCESSOR armv7l) set(TOOLCHAIN "arm-linux-gnueabi") if(TIZEN) - set(TIZEN_TOOLCHAIN "armv7l-tizen-linux-gnueabi/9.2.0") + set(TIZEN_TOOLCHAIN "armv7l-tizen-linux-gnueabi") endif() elseif(TARGET_ARCH_NAME STREQUAL "armv6") set(CMAKE_SYSTEM_PROCESSOR armv6l) @@ -81,7 +81,7 @@ elseif(TARGET_ARCH_NAME STREQUAL "riscv64") else() set(TOOLCHAIN "riscv64-linux-gnu") if(TIZEN) - set(TIZEN_TOOLCHAIN "riscv64-tizen-linux-gnu/13.1.0") + set(TIZEN_TOOLCHAIN "riscv64-tizen-linux-gnu") endif() endif() elseif(TARGET_ARCH_NAME STREQUAL "s390x") @@ -98,7 +98,7 @@ elseif(TARGET_ARCH_NAME STREQUAL "x64") elseif(LINUX) set(TOOLCHAIN "x86_64-linux-gnu") if(TIZEN) - set(TIZEN_TOOLCHAIN "x86_64-tizen-linux-gnu/9.2.0") + set(TIZEN_TOOLCHAIN "x86_64-tizen-linux-gnu") endif() elseif(FREEBSD) set(triple "x86_64-unknown-freebsd12") @@ -115,7 +115,7 @@ elseif(TARGET_ARCH_NAME STREQUAL "x86") set(TOOLCHAIN "i686-linux-gnu") endif() if(TIZEN) - set(TIZEN_TOOLCHAIN "i586-tizen-linux-gnu/9.2.0") + set(TIZEN_TOOLCHAIN "i586-tizen-linux-gnu") endif() else() message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only arm, arm64, armel, armv6, ppc64le, riscv64, s390x, x64 and x86 are supported!") @@ -127,32 +127,46 @@ endif() # Specify include paths if(TIZEN) - if(TARGET_ARCH_NAME STREQUAL "arm") - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/) - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/armv7hl-tizen-linux-gnueabihf) - endif() - if(TARGET_ARCH_NAME STREQUAL "armel") - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/) - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/armv7l-tizen-linux-gnueabi) - endif() - if(TARGET_ARCH_NAME STREQUAL "arm64") - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}/include/c++/) - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}/include/c++/aarch64-tizen-linux-gnu) - endif() - if(TARGET_ARCH_NAME STREQUAL "x86") - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/) - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/i586-tizen-linux-gnu) - endif() - if(TARGET_ARCH_NAME STREQUAL "x64") - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}/include/c++/) - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}/include/c++/x86_64-tizen-linux-gnu) - endif() - if(TARGET_ARCH_NAME STREQUAL "riscv64") - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}/include/c++/) - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}/include/c++/riscv64-tizen-linux-gnu) + function(find_toolchain_dir prefix) + # Dynamically find the version subdirectory + file(GLOB DIRECTORIES "${prefix}/*") + list(GET DIRECTORIES 0 FIRST_MATCH) + get_filename_component(TOOLCHAIN_VERSION ${FIRST_MATCH} NAME) + + set(TIZEN_TOOLCHAIN_PATH "${prefix}/${TOOLCHAIN_VERSION}" PARENT_SCOPE) + endfunction() + + if(TARGET_ARCH_NAME MATCHES "^(arm|armel|x86)$") + find_toolchain_dir("${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") + else() + find_toolchain_dir("${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") endif() + + message(STATUS "TIZEN_TOOLCHAIN_PATH set to: ${TIZEN_TOOLCHAIN_PATH}") + + include_directories(SYSTEM ${TIZEN_TOOLCHAIN_PATH}/include/c++) + include_directories(SYSTEM ${TIZEN_TOOLCHAIN_PATH}/include/c++/${TIZEN_TOOLCHAIN}) endif() +function(locate_toolchain_exec exec var) + set(TOOLSET_PREFIX ${TOOLCHAIN}-) + string(TOUPPER ${exec} EXEC_UPPERCASE) + if(NOT "$ENV{CLR_${EXEC_UPPERCASE}}" STREQUAL "") + set(${var} "$ENV{CLR_${EXEC_UPPERCASE}}" PARENT_SCOPE) + return() + endif() + + find_program(EXEC_LOCATION_${exec} + NAMES + "${TOOLSET_PREFIX}${exec}${CLR_CMAKE_COMPILER_FILE_NAME_VERSION}" + "${TOOLSET_PREFIX}${exec}") + + if (EXEC_LOCATION_${exec} STREQUAL "EXEC_LOCATION_${exec}-NOTFOUND") + message(FATAL_ERROR "Unable to find toolchain executable. Name: ${exec}, Prefix: ${TOOLSET_PREFIX}.") + endif() + set(${var} ${EXEC_LOCATION_${exec}} PARENT_SCOPE) +endfunction() + if(ANDROID) if(TARGET_ARCH_NAME STREQUAL "arm") set(ANDROID_ABI armeabi-v7a) @@ -183,66 +197,24 @@ elseif(FREEBSD) set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fuse-ld=lld") elseif(ILLUMOS) set(CMAKE_SYSROOT "${CROSS_ROOTFS}") + set(CMAKE_SYSTEM_PREFIX_PATH "${CROSS_ROOTFS}") + set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lssp") + set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lssp") include_directories(SYSTEM ${CROSS_ROOTFS}/include) - set(TOOLSET_PREFIX ${TOOLCHAIN}-) - function(locate_toolchain_exec exec var) - string(TOUPPER ${exec} EXEC_UPPERCASE) - if(NOT "$ENV{CLR_${EXEC_UPPERCASE}}" STREQUAL "") - set(${var} "$ENV{CLR_${EXEC_UPPERCASE}}" PARENT_SCOPE) - return() - endif() - - find_program(EXEC_LOCATION_${exec} - NAMES - "${TOOLSET_PREFIX}${exec}${CLR_CMAKE_COMPILER_FILE_NAME_VERSION}" - "${TOOLSET_PREFIX}${exec}") - - if (EXEC_LOCATION_${exec} STREQUAL "EXEC_LOCATION_${exec}-NOTFOUND") - message(FATAL_ERROR "Unable to find toolchain executable. Name: ${exec}, Prefix: ${TOOLSET_PREFIX}.") - endif() - set(${var} ${EXEC_LOCATION_${exec}} PARENT_SCOPE) - endfunction() - - set(CMAKE_SYSTEM_PREFIX_PATH "${CROSS_ROOTFS}") - locate_toolchain_exec(gcc CMAKE_C_COMPILER) locate_toolchain_exec(g++ CMAKE_CXX_COMPILER) - - set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lssp") - set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lssp") elseif(HAIKU) set(CMAKE_SYSROOT "${CROSS_ROOTFS}") set(CMAKE_PROGRAM_PATH "${CMAKE_PROGRAM_PATH};${CROSS_ROOTFS}/cross-tools-x86_64/bin") - - set(TOOLSET_PREFIX ${TOOLCHAIN}-) - function(locate_toolchain_exec exec var) - string(TOUPPER ${exec} EXEC_UPPERCASE) - if(NOT "$ENV{CLR_${EXEC_UPPERCASE}}" STREQUAL "") - set(${var} "$ENV{CLR_${EXEC_UPPERCASE}}" PARENT_SCOPE) - return() - endif() - - find_program(EXEC_LOCATION_${exec} - NAMES - "${TOOLSET_PREFIX}${exec}${CLR_CMAKE_COMPILER_FILE_NAME_VERSION}" - "${TOOLSET_PREFIX}${exec}") - - if (EXEC_LOCATION_${exec} STREQUAL "EXEC_LOCATION_${exec}-NOTFOUND") - message(FATAL_ERROR "Unable to find toolchain executable. Name: ${exec}, Prefix: ${TOOLSET_PREFIX}.") - endif() - set(${var} ${EXEC_LOCATION_${exec}} PARENT_SCOPE) - endfunction() - set(CMAKE_SYSTEM_PREFIX_PATH "${CROSS_ROOTFS}") + set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lssp") + set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lssp") locate_toolchain_exec(gcc CMAKE_C_COMPILER) locate_toolchain_exec(g++ CMAKE_CXX_COMPILER) - set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lssp") - set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lssp") - # let CMake set up the correct search paths include(Platform/Haiku) else() @@ -272,21 +244,21 @@ endif() if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$") if(TIZEN) - add_toolchain_linker_flag("-B${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") + add_toolchain_linker_flag("-B${TIZEN_TOOLCHAIN_PATH}") add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib") add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib") - add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") + add_toolchain_linker_flag("-L${TIZEN_TOOLCHAIN_PATH}") endif() elseif(TARGET_ARCH_NAME MATCHES "^(arm64|x64|riscv64)$") if(TIZEN) - add_toolchain_linker_flag("-B${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") + add_toolchain_linker_flag("-B${TIZEN_TOOLCHAIN_PATH}") add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib64") add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib64") - add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") + add_toolchain_linker_flag("-L${TIZEN_TOOLCHAIN_PATH}") add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/lib64") add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib64") - add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") + add_toolchain_linker_flag("-Wl,--rpath-link=${TIZEN_TOOLCHAIN_PATH}") endif() elseif(TARGET_ARCH_NAME STREQUAL "s390x") add_toolchain_linker_flag("--target=${TOOLCHAIN}") @@ -297,10 +269,10 @@ elseif(TARGET_ARCH_NAME STREQUAL "x86") endif() add_toolchain_linker_flag(-m32) if(TIZEN) - add_toolchain_linker_flag("-B${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") + add_toolchain_linker_flag("-B${TIZEN_TOOLCHAIN_PATH}") add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib") add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib") - add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") + add_toolchain_linker_flag("-L${TIZEN_TOOLCHAIN_PATH}") endif() elseif(ILLUMOS) add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib/amd64") diff --git a/global.json b/global.json index be1b98a46a4..e4633c5246a 100644 --- a/global.json +++ b/global.json @@ -14,9 +14,9 @@ "version": "10.0.100-alpha.1.24573.1" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24606.6", - "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24606.6", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24606.6", + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24609.8", + "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24609.8", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24609.8", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24609.1" }, From 25fc00446c019c0768c18e576c91664405534a0d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 13:42:38 +0000 Subject: [PATCH 091/106] [main] Update dependencies from dotnet/runtime (#12618) [main] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 58 ++++++------- global.json | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d03aaf03695..91110db014d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 - + https://github.com/dotnet/runtime - b085dadd160066d945ea638f0391091b1c96524d + 920a17ac91440abb5b34109104e72da77ec58b59 diff --git a/eng/Versions.props b/eng/Versions.props index 72dc1c57f66..6457a7aa3cd 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 - 10.0.0-alpha.1.24609.1 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24610.2 diff --git a/global.json b/global.json index e4633c5246a..bb2aee91e3a 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24609.8", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24609.8", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24609.1" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24610.2" }, "native-tools": { "cmake": "latest" From afc85ac10838099a508344a86bc5aa5ecea3f75c Mon Sep 17 00:00:00 2001 From: Tanya Solyanik Date: Tue, 10 Dec 2024 14:46:32 -0800 Subject: [PATCH 092/106] Ensure memory is freed on a serialization failure in the clipboard (#12619) 1. Ensure that HGLOBAL is freed when a serialization exception is thrown when flushing data to the clipboard 2. Ensure that we don't attempt deserialization if we couldn't serialize data from the inproc scenario --- .../src/Windows/Win32/Foundation/HRESULT.cs | 1 + ...ect.Composition.NativeToWinFormsAdapter.cs | 14 ++++++++----- ...ect.Composition.WinFormsToNativeAdapter.cs | 11 ++++++++-- .../System/Windows/Forms/DataObjectTests.cs | 21 +++++++++++++++++++ 4 files changed, 40 insertions(+), 7 deletions(-) diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Foundation/HRESULT.cs b/src/System.Private.Windows.Core/src/Windows/Win32/Foundation/HRESULT.cs index ddd1dec40df..8b7e6d1a84c 100644 --- a/src/System.Private.Windows.Core/src/Windows/Win32/Foundation/HRESULT.cs +++ b/src/System.Private.Windows.Core/src/Windows/Win32/Foundation/HRESULT.cs @@ -72,6 +72,7 @@ public static implicit operator HRESULT(Exception ex) public static readonly HRESULT COR_E_SAFEARRAYTYPEMISMATCH = (HRESULT)unchecked((int)0x80131533); public static readonly HRESULT COR_E_TARGETINVOCATION = (HRESULT)unchecked((int)0x80131604); public static readonly HRESULT COR_E_OBJECTDISPOSED = (HRESULT)unchecked((int)0x80131622); + public static readonly HRESULT COR_E_SERIALIZATION = (HRESULT)unchecked((int)0x8013150c); /// /// There is no associated handler for the given item registered by the specified application. diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs index b327cdb7a71..a858fac42eb 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs @@ -111,10 +111,10 @@ DataFormats.TextConstant or DataFormats.RtfConstant or DataFormats.OemTextConsta static object ReadObjectFromHGLOBAL(HGLOBAL hglobal, bool restrictDeserialization) { - MemoryStream stream = ReadByteStreamFromHGLOBAL(hglobal, out bool isSerializedObject); - return !isSerializedObject - ? stream - : BinaryFormatUtilities.ReadObjectFromStream(stream, restrictDeserialization); + MemoryStream stream = ReadByteStreamFromHGLOBAL(hglobal, out bool isSerializedObject); + return !isSerializedObject + ? stream + : BinaryFormatUtilities.ReadObjectFromStream(stream, restrictDeserialization); } } @@ -266,10 +266,14 @@ private static unsafe string ReadUtf8StringFromHGLOBAL(HGLOBAL hglobal) // get the data out. Debug.WriteLineIf(hr == HRESULT.CLIPBRD_E_BAD_DATA, "CLIPBRD_E_BAD_DATA returned when trying to get clipboard data."); Debug.WriteLineIf(hr == HRESULT.DV_E_TYMED, "DV_E_TYMED returned when trying to get clipboard data."); + // This happens in copy == false case when the managed type does not have the [Serializable] attribute. + Debug.WriteLineIf(hr == HRESULT.E_UNEXPECTED, "E_UNEXPECTED returned when trying to get clipboard data."); + Debug.WriteLineIf(hr == HRESULT.COR_E_SERIALIZATION, + "COR_E_SERIALIZATION returned when trying to get clipboard data, for example, BinaryFormatter threw SerializationException."); try { - if (medium.tymed == Com.TYMED.TYMED_HGLOBAL && !medium.hGlobal.IsNull) + if (medium.tymed == Com.TYMED.TYMED_HGLOBAL && !medium.hGlobal.IsNull && hr != HRESULT.COR_E_SERIALIZATION) { data = GetDataFromHGLOBAL(medium.hGlobal, format); } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.WinFormsToNativeAdapter.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.WinFormsToNativeAdapter.cs index cb132cb5e9c..f0907158841 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.WinFormsToNativeAdapter.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.WinFormsToNativeAdapter.cs @@ -135,6 +135,13 @@ public HRESULT GetDataHere(FORMATETC* pformatetc, STGMEDIUM* pmedium) // of this exception, so it will always work.) return SaveDataToHGLOBAL(ex, format, ref *pmedium); } + catch (Exception) when (!pmedium->hGlobal.IsNull) + { + PInvokeCore.GlobalFree(pmedium->hGlobal); + pmedium->hGlobal = HGLOBAL.Null; + + throw; + } } if (((TYMED)pformatetc->tymed).HasFlag(TYMED.TYMED_GDI)) @@ -335,14 +342,14 @@ private static HRESULT SaveObjectToHGLOBAL(ref HGLOBAL hglobal, object data, boo private static HRESULT SaveStreamToHGLOBAL(ref HGLOBAL hglobal, Stream stream) { - if (hglobal != 0) + if (!hglobal.IsNull) { PInvokeCore.GlobalFree(hglobal); } int size = checked((int)stream.Length); hglobal = PInvokeCore.GlobalAlloc(GLOBAL_ALLOC_FLAGS.GMEM_MOVEABLE, (uint)size); - if (hglobal == 0) + if (hglobal.IsNull) { return HRESULT.E_OUTOFMEMORY; } diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.cs index b83564711eb..39ee7d7da84 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.cs @@ -2502,4 +2502,25 @@ public unsafe void DataObject_Native_GetFormats_ReturnsExpected() data.GetDataPresent("notExist").Should().BeFalse(); data.GetFormats().Should().BeEquivalentTo([typeof(Bitmap).FullName, nameof(Bitmap), customFormat]); } + + [WinFormsFact] + public unsafe void DataObject_Native_GetData_SerializationFailure() + { + using Font value = new("Ariel", 10); + using BinaryFormatterScope scope = new(enable: true); + DataObject native = new(DataFormats.Locale, value); + + // Simulate receiving DataObject from native. + // Clipboard.SetDataObject(native, copy: true); + var comDataObject = ComHelpers.GetComPointer(native); + Com.FORMATETC formatetc = new() + { + tymed = (uint)TYMED.TYMED_HGLOBAL, + cfFormat = (ushort)CLIPBOARD_FORMAT.CF_LOCALE + }; + comDataObject->GetData(formatetc, out Com.STGMEDIUM medium); + + // Validate that HGLOBAL had been freed when handling an error. + medium.hGlobal.IsNull.Should().BeTrue(); + } } From 0773d890f7947a3b01d9909d80080d06fbe23c09 Mon Sep 17 00:00:00 2001 From: v-zhgl <38325459+Zheng-Li01@users.noreply.github.com> Date: Tue, 10 Dec 2024 22:53:54 +0000 Subject: [PATCH 093/106] Add code coverage for DataGridViewComboBoxCell.ObjectCollection (#12580) * Add code coverage for DataGridViewComboBoxCell.ObjectCollection * Handle FeedBacks --- ...dViewComboBoxCell.ObjectCollectionTests.cs | 339 ++++++++++++++++++ 1 file changed, 339 insertions(+) create mode 100644 src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewComboBoxCell.ObjectCollectionTests.cs diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewComboBoxCell.ObjectCollectionTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewComboBoxCell.ObjectCollectionTests.cs new file mode 100644 index 00000000000..311aa17d494 --- /dev/null +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewComboBoxCell.ObjectCollectionTests.cs @@ -0,0 +1,339 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +namespace System.Windows.Forms.Tests; + +public class DataGridViewComboBoxCell_ObjectCollectionTests : IDisposable +{ + private readonly DataGridViewComboBoxCell _comboBoxCell; + private readonly DataGridViewComboBoxCell.ObjectCollection _collection; + + public void Dispose() => _comboBoxCell.Dispose(); + + public DataGridViewComboBoxCell_ObjectCollectionTests() + { + _comboBoxCell = new(); + _collection = new(_comboBoxCell); + } + + [WinFormsFact] + public void ObjectCollection_Add_Remove_Operations() + { + _collection.Count.Should().Be(0); + + int index1 = _collection.Add("Item1"); + int index2 = _collection.Add("Item2"); + _collection.Count.Should().Be(2); + index1.Should().Be(0); + index2.Should().Be(1); + + _collection.Remove("Item1"); + _collection.Count.Should().Be(1); + _collection[0].Should().Be("Item2"); + + _collection.Add("Item1"); + _collection.Remove("Item2"); + _collection.Count.Should().Be(1); + _collection[0].Should().Be("Item1"); + + _collection.Clear(); + _collection.Count.Should().Be(0); + } + + [WinFormsFact] + public void ObjectCollection_IsReadOnly_ReturnsCorrectValue() => + _collection.IsReadOnly.Should().BeFalse(); + + [WinFormsFact] + public void ObjectCollection_Add_AddsItemInSortedOrder() + { + _comboBoxCell.Sorted = true; + var item1 = "B"; + var item2 = "A"; + + _collection.Add(item1); + int index = _collection.Add(item2); + + index.Should().Be(0); + _collection.Count.Should().Be(2); + _collection[0].Should().Be(item2); + _collection[1].Should().Be(item1); + } + + [WinFormsFact] + public void ObjectCollection_Add_ThrowsException_WhenItemIsNull() + { + Action action = () => _collection.Add(null!); + + action.Should().Throw(); + } + + [WinFormsFact] + public void ObjectCollection_AddRange_AddsItemsCorrectly() + { + var items = new object[] { "Item1", "Item2", "Item3" }; + + _collection.AddRange(items); + + _collection.Count.Should().Be(3); + _collection[0].Should().Be("Item1"); + _collection[1].Should().Be("Item2"); + _collection[2].Should().Be("Item3"); + } + + [WinFormsFact] + public void ObjectCollection_AddRange_AddsItemsInSortedOrder() + { + _comboBoxCell.Sorted = true; + var items = new object[] { "B", "A", "C" }; + + _collection.AddRange(items); + + _collection.Count.Should().Be(3); + _collection[0].Should().Be("A"); + _collection[1].Should().Be("B"); + _collection[2].Should().Be("C"); + } + + [WinFormsFact] + public void ObjectCollection_AddRange_DoesNotAddItems_WhenExceptionIsThrown() + { + var items = new object[] { "Item1", null!, "Item3" }; + + Action action = () => _collection.AddRange(items); + + action.Should().Throw(); + _collection.Count.Should().Be(0); + } + + [WinFormsFact] + public void ObjectCollection_Indexer_Get_ReturnsCorrectItem() + { + var item1 = "Item1"; + var item2 = "Item2"; + _collection.Add(item1); + _collection.Add(item2); + + _collection[0].Should().Be(item1); + _collection[1].Should().Be(item2); + } + + [WinFormsFact] + public void ObjectCollection_Indexer_Set_SetsItemCorrectly() + { + var item1 = "Item1"; + var item2 = "Item2"; + _collection.Add(item1); + + _collection[0] = item2; + + _collection[0].Should().Be(item2); + } + + [WinFormsTheory] + [InlineData(-1)] + [InlineData(1)] + public void ObjectCollection_Indexer_Set_ThrowsException_WhenIndexIsInvalid(int index) + { + Action action = () => _collection[index] = "Item"; + + action.Should().Throw(); + } + + [WinFormsFact] + public void ObjectCollection_Indexer_Set_ThrowsException_WhenValueIsNull() + { + _collection.Add("Item"); + + Action action = () => _collection[0] = null!; + + action.Should().Throw(); + } + + [WinFormsTheory] + [BoolData] + public void ObjectCollection_Clear_RemovesAllItems(bool sorted) + { + _comboBoxCell.Sorted = sorted; + _collection.Add("Item1"); + _collection.Add("Item2"); + + _collection.Clear(); + + _collection.Count.Should().Be(0); + } + + [WinFormsTheory] + [BoolData] + public void ObjectCollection_Contains_ReturnsCorrectValue(bool sorted) + { + _comboBoxCell.Sorted = sorted; + var item = "Item1"; + _collection.Add(item); + + _collection.Contains(item).Should().BeTrue(); + _collection.Contains("NonExistentItem").Should().BeFalse(); + } + + [WinFormsFact] + public void ObjectCollection_Contains_ThrowsException_WhenItemIsNull() + { + Action action = () => _collection.Contains(null!); + + action.Should().Throw(); + } + + [WinFormsFact] + public void ObjectCollection_CopyTo_CopiesItemsCorrectly() + { + var items = new object[] { "Item1", "Item2", "Item3" }; + _collection.AddRange(items); + var destination = new object[3]; + + _collection.CopyTo(destination, 0); + + destination[0].Should().Be("Item1"); + destination[1].Should().Be("Item2"); + destination[2].Should().Be("Item3"); + } + + [WinFormsFact] + public void ObjectCollection_CopyTo_ThrowsException_WhenInvalidConditions() + { + Action actionNullDestination = () => _collection.CopyTo(null!, 0); + actionNullDestination.Should().Throw(); + + var destination = new object[3]; + Action actionNegativeIndex = () => _collection.CopyTo(destination, -1); + actionNegativeIndex.Should().Throw(); + + Action actionOutOfRangeIndex = () => _collection.CopyTo(destination, 4); + actionOutOfRangeIndex.Should().Throw(); + } + + [WinFormsFact] + public void ObjectCollection_CopyTo_ThrowsException_WhenDestinationArrayIsTooSmall() + { + var items = new object[] { "Item1", "Item2", "Item3" }; + _collection.AddRange(items); + var destination = new object[2]; + + Action action = () => _collection.CopyTo(destination, 0); + + action.Should().Throw(); + } + + [WinFormsFact] + public void ObjectCollection_GetEnumerator_ReturnsEnumerator() + { + var items = new object[] { "Item1", "Item2", "Item3" }; + _collection.AddRange(items); + + var enumerator = _collection.GetEnumerator(); + + enumerator.Should().NotBeNull(); + enumerator.MoveNext().Should().BeTrue(); + enumerator.Current.Should().Be("Item1"); + enumerator.MoveNext().Should().BeTrue(); + enumerator.Current.Should().Be("Item2"); + enumerator.MoveNext().Should().BeTrue(); + enumerator.Current.Should().Be("Item3"); + enumerator.MoveNext().Should().BeFalse(); + } + + [WinFormsFact] + public void ObjectCollection_IndexOf_ReturnsCorrectIndex_WhenItemExists() + { + var item1 = "Item1"; + var item2 = "Item2"; + _collection.Add(item1); + _collection.Add(item2); + + _collection.IndexOf(item1).Should().Be(0); + _collection.IndexOf(item2).Should().Be(1); + _collection.IndexOf("NonExistentItem").Should().Be(-1); + } + + [WinFormsFact] + public void ObjectCollection_IndexOf_ThrowsException_WhenItemIsNull() + { + Action action = () => _collection.IndexOf(null!); + + action.Should().Throw(); + } + + [WinFormsTheory] + [InlineData("Item1", "Item2", false)] + [InlineData("Item2", "Item1", true)] + public void ObjectCollection_Insert_InsertsItemCorrectly_OrInSortedOrder(string item1, string item2, bool sorted) + { + _comboBoxCell.Sorted = sorted; + _collection.Add(item1); + _collection.Insert(0, item2); + + if (sorted) + { + _collection[0].Should().Be(item2); + _collection[1].Should().Be(item1); + } + else + { + _collection[0].Should().Be(item2); + _collection[1].Should().Be(item1); + } + } + + [WinFormsTheory] + [BoolData] + public void ObjectCollection_Insert_ThrowsException_WhenIndexIsInvalidOrItemIsNull(bool sorted) + { + _comboBoxCell.Sorted = sorted; + + Action actionNegativeIndex = () => _collection.Insert(-1, "Item"); + Action actionOutOfRangeIndex = () => _collection.Insert(1, "Item"); + Action actionNullItem = () => _collection.Insert(0, null!); + + actionNegativeIndex.Should().Throw(); + actionOutOfRangeIndex.Should().Throw(); + actionNullItem.Should().Throw(); + } + + [WinFormsFact] + public void ObjectCollection_Remove_DoesNothing_WhenItemDoesNotExist() + { + var item1 = "Item1"; + var item2 = "Item2"; + _collection.Add(item1); + + _collection.Remove(item2); + + _collection.Count.Should().Be(1); + _collection[0].Should().Be(item1); + } + + [WinFormsFact] + public void ObjectCollection_RemoveAt_RemovesItemCorrectly() + { + var item1 = "Item1"; + var item2 = "Item2"; + _collection.Add(item1); + _collection.Add(item2); + + _collection.RemoveAt(0); + + _collection.Count.Should().Be(1); + _collection[0].Should().Be(item2); + } + + [WinFormsTheory] + [InlineData(-1)] + [InlineData(1)] + public void ObjectCollection_RemoveAt_ThrowsException_WhenIndexIsInvalid(int index) + { + Action action = () => _collection.RemoveAt(index); + + action.Should().Throw(); + } +} From 516ddf1f873d02b268b58a733f40b9ec860d8d42 Mon Sep 17 00:00:00 2001 From: Jeremy Kuhne Date: Tue, 10 Dec 2024 15:54:16 -0800 Subject: [PATCH 094/106] Move NoAssertContext to Core test utilities (#12621) This will allow it to be used in WPF as well. --- src/Common/tests/TestUtilities/GlobalUsings.cs | 1 + src/Common/tests/TestUtilities/ModuleInitializer.cs | 1 - .../tests/TestUtilities/NoAssertContext.cs | 2 -- src/Common/tests/TestUtilities/ThrowingTraceListener.cs | 7 +++---- .../tests/TestUtilities/GlobalUsings.cs | 1 - 5 files changed, 4 insertions(+), 8 deletions(-) rename src/{System.Windows.Forms.Primitives => Common}/tests/TestUtilities/NoAssertContext.cs (99%) diff --git a/src/Common/tests/TestUtilities/GlobalUsings.cs b/src/Common/tests/TestUtilities/GlobalUsings.cs index 581f24df927..55d86a67182 100644 --- a/src/Common/tests/TestUtilities/GlobalUsings.cs +++ b/src/Common/tests/TestUtilities/GlobalUsings.cs @@ -1,5 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +global using System.Diagnostics; global using System.Diagnostics.CodeAnalysis; global using Xunit; diff --git a/src/Common/tests/TestUtilities/ModuleInitializer.cs b/src/Common/tests/TestUtilities/ModuleInitializer.cs index 2cb757018d6..bad5b308b0d 100644 --- a/src/Common/tests/TestUtilities/ModuleInitializer.cs +++ b/src/Common/tests/TestUtilities/ModuleInitializer.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Diagnostics; using System.Runtime.CompilerServices; namespace System; diff --git a/src/System.Windows.Forms.Primitives/tests/TestUtilities/NoAssertContext.cs b/src/Common/tests/TestUtilities/NoAssertContext.cs similarity index 99% rename from src/System.Windows.Forms.Primitives/tests/TestUtilities/NoAssertContext.cs rename to src/Common/tests/TestUtilities/NoAssertContext.cs index dcf564ddf77..67d29efae30 100644 --- a/src/System.Windows.Forms.Primitives/tests/TestUtilities/NoAssertContext.cs +++ b/src/Common/tests/TestUtilities/NoAssertContext.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#nullable enable - using System.Collections.Concurrent; namespace System; diff --git a/src/Common/tests/TestUtilities/ThrowingTraceListener.cs b/src/Common/tests/TestUtilities/ThrowingTraceListener.cs index f85b1a03788..6f9b0a9111c 100644 --- a/src/Common/tests/TestUtilities/ThrowingTraceListener.cs +++ b/src/Common/tests/TestUtilities/ThrowingTraceListener.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Diagnostics; - namespace System; public sealed class ThrowingTraceListener : TraceListener @@ -12,8 +10,9 @@ public sealed class ThrowingTraceListener : TraceListener public override void Fail(string? message, string? detailMessage) { throw new InvalidOperationException( - (string.IsNullOrEmpty(message) ? "Assertion failed" : message) + - (string.IsNullOrEmpty(detailMessage) ? "" : Environment.NewLine + detailMessage)); + $"{(string.IsNullOrEmpty(message) ? "Assertion failed" : message)}{(string.IsNullOrEmpty(detailMessage) + ? "" + : $"{Environment.NewLine}{detailMessage}")}"); } public override void Write(object? o) diff --git a/src/System.Windows.Forms.Primitives/tests/TestUtilities/GlobalUsings.cs b/src/System.Windows.Forms.Primitives/tests/TestUtilities/GlobalUsings.cs index f5e1f631fa7..7839656bf50 100644 --- a/src/System.Windows.Forms.Primitives/tests/TestUtilities/GlobalUsings.cs +++ b/src/System.Windows.Forms.Primitives/tests/TestUtilities/GlobalUsings.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -global using System.Diagnostics; global using System.Diagnostics.CodeAnalysis; global using Windows.Win32; global using Windows.Win32.Foundation; From 230d3495651245f441ba85c1092915349ee94bc0 Mon Sep 17 00:00:00 2001 From: Tanya Solyanik Date: Tue, 10 Dec 2024 16:20:55 -0800 Subject: [PATCH 095/106] Removed BitmapBinder because it was made redundant by us reading/writing primitive and known types manually (#12620) * The purpose of BitmapBinder was to restrict binary formatter deserialization for known formats that should not accept managed types other than primitives or bitmaps. All types that are allowed by the BitmapBinder are supported as "common known" types and are serialized by writing the serialization record "manually", not by calling the BinaryFormatter. We read some other types, such as collections but these have been read in NET9 as well, when we added special case for the common types. Currently this binder is used only in the failure cases to raise a special exception that indicates that we should not read the data again. --- .../Forms/OLE/DataObject.BitmapBinder.cs | 69 --------- ...bject.Composition.BinaryFormatUtilities.cs | 46 +++--- .../Forms/BinaryFormatUtilitiesTests.cs | 4 +- .../System/Windows/Forms/DataObjectTests.cs | 3 +- .../Forms/DataObject_BitmapBinderTests.cs | 138 ------------------ 5 files changed, 30 insertions(+), 230 deletions(-) delete mode 100644 src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.BitmapBinder.cs delete mode 100644 src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObject_BitmapBinderTests.cs diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.BitmapBinder.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.BitmapBinder.cs deleted file mode 100644 index 44ac7aa28aa..00000000000 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.BitmapBinder.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Drawing; -using System.Reflection; -using System.Runtime.Serialization; - -namespace System.Windows.Forms; - -public partial class DataObject -{ - /// - /// Binder that restricts deserialization to Bitmap type and serialization to strings and Bitmaps. - /// Deserialization of known safe types (strings and arrays of primitives) does not invoke the binder. - /// - /// - /// - /// This gets skipped when our code handles its known types. - /// While there are more types allowed (such as , they are all safe. - /// - /// - private sealed class BitmapBinder : SerializationBinder - { - // Bitmap type lives in different assemblies in the .NET Framework and in .NET Core. To support serialization - // between both runtimes the .NET Framework identities are used. - private const string AllowedTypeName = "System.Drawing.Bitmap"; - private const string AllowedAssemblyName = "System.Drawing"; - - // .NET Framework PublicKeyToken=b03f5f7f11d50a3a - private static ReadOnlySpan AllowedToken => [0xB0, 0x3F, 0x5F, 0x7F, 0x11, 0xD5, 0x0A, 0x3A]; - - public override Type? BindToType(string assemblyName, string typeName) - { - // Only safe to deserialize types are bypassing this callback. Strings and arrays of primitive types in - // particular. - - if (AllowedTypeName.Equals(typeName, StringComparison.Ordinal)) - { - try - { - AssemblyName nameToBind = new(assemblyName); - if (AllowedAssemblyName.Equals(nameToBind.Name, StringComparison.Ordinal) - && AllowedToken.SequenceEqual(nameToBind.GetPublicKeyToken())) - { - return typeof(Bitmap); - } - } - catch (Exception ex) when (ex is ArgumentException or FileLoadException) - { - } - } - - throw new RestrictedTypeDeserializationException(SR.UnexpectedClipboardType); - } - - public override void BindToName(Type serializedType, out string? assemblyName, out string? typeName) - { - // Null values will follow the default codepath in BinaryFormatter. - assemblyName = null; - typeName = null; - - // Bitmap and string types are safe types to serialize/deserialize. - if (!serializedType.Equals(typeof(string)) && !serializedType.Equals(typeof(Bitmap))) - { - throw new SerializationException(string.Format(SR.UnexpectedTypeForClipboardFormat, serializedType.FullName)); - } - } - } -} diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.BinaryFormatUtilities.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.BinaryFormatUtilities.cs index dc646bc6913..03eb095aa1b 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.BinaryFormatUtilities.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.BinaryFormatUtilities.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters; using System.Runtime.Serialization.Formatters.Binary; using System.Windows.Forms.BinaryFormat; @@ -17,11 +18,13 @@ internal static class BinaryFormatUtilities internal static void WriteObjectToStream(MemoryStream stream, object data, bool restrictSerialization) { long position = stream.Position; - bool success = false; try { - success = WinFormsBinaryFormatWriter.TryWriteCommonObject(stream, data); + if (WinFormsBinaryFormatWriter.TryWriteCommonObject(stream, data)) + { + return; + } } catch (Exception ex) when (!ex.IsCriticalException()) { @@ -29,24 +32,23 @@ internal static void WriteObjectToStream(MemoryStream stream, object data, bool Debug.Fail($"Unexpected exception writing binary formatted data. {ex.Message}"); } -#pragma warning disable SYSLIB0011 // Type or member is obsolete - if (!success) + if (restrictSerialization) { - // This check is to help in trimming scenarios with a trim warning on a call to BinaryFormatter.Serialize(), - // which has a RequiresUnreferencedCode annotation. - // If the flag is false, the trimmer will not generate a warning, since BinaryFormatter.Serialize(), will not be called, - // If the flag is true, the trimmer will generate a warning for calling a method that has a RequiresUnreferencedCode annotation. - if (!EnableUnsafeBinaryFormatterInNativeObjectSerialization) - { - throw new NotSupportedException(SR.BinaryFormatterNotSupported); - } + throw new SerializationException(string.Format(SR.UnexpectedTypeForClipboardFormat, data.GetType().FullName)); + } - stream.Position = position; - new BinaryFormatter() - { - Binder = restrictSerialization ? new BitmapBinder() : null - }.Serialize(stream, data); +#pragma warning disable SYSLIB0011 // Type or member is obsolete + // This check is to help in trimming scenarios with a trim warning on a call to BinaryFormatter.Serialize(), + // which has a RequiresUnreferencedCode annotation. + // If the flag is false, the trimmer will not generate a warning, since BinaryFormatter.Serialize(), will not be called, + // If the flag is true, the trimmer will generate a warning for calling a method that has a RequiresUnreferencedCode annotation. + if (!EnableUnsafeBinaryFormatterInNativeObjectSerialization) + { + throw new NotSupportedException(SR.BinaryFormatterNotSupported); } + + stream.Position = position; + new BinaryFormatter().Serialize(stream, data); #pragma warning restore SYSLIB0011 } @@ -65,6 +67,11 @@ internal static object ReadObjectFromStream(MemoryStream stream, bool restrictDe // Couldn't parse for some reason, let the BinaryFormatter try to handle it. } + if (restrictDeserialization) + { + throw new RestrictedTypeDeserializationException(SR.UnexpectedClipboardType); + } + // This check is to help in trimming scenarios with a trim warning on a call to BinaryFormatter.Deserialize(), // which has a RequiresUnreferencedCode annotation. // If the flag is false, the trimmer will not generate a warning, since BinaryFormatter.Deserialize() will not be called, @@ -79,15 +86,14 @@ internal static object ReadObjectFromStream(MemoryStream stream, bool restrictDe #pragma warning disable SYSLIB0011 // Type or member is obsolete #pragma warning disable SYSLIB0050 // Type or member is obsolete #pragma warning disable CA2300 // Do not use insecure deserializer BinaryFormatter -#pragma warning disable CA2302 // Ensure BinaryFormatter.Binder is set before calling BinaryFormatter.Deserialize +#pragma warning disable CA2301 // The method 'object BinaryFormatter.Deserialize(Stream serializationStream)' is insecure when deserializing untrusted data without a SerializationBinder to restrict the type of objects in the deserialized object graph. // cs/dangerous-binary-deserialization return new BinaryFormatter() { - Binder = restrictDeserialization ? new BitmapBinder() : null, AssemblyFormat = FormatterAssemblyStyle.Simple }.Deserialize(stream); // CodeQL[SM03722] : BinaryFormatter is intended to be used as a fallback for unsupported types. Users must explicitly opt into this behavior. #pragma warning restore CA2300 -#pragma warning restore CA2302 +#pragma warning restore CA2301 #pragma warning restore SYSLIB0050 #pragma warning restore SYSLIB0011 } diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.cs index 6b392d74422..7489136aa2d 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.cs @@ -38,7 +38,7 @@ private void WriteObjectToStream(object value, bool restrictSerialization = fals private object? RoundTripObject_RestrictedFormat(object value) { // This is equivalent to SetData/GetData methods using registered OLE formats and thus the BitmapBinder, - // and works with the BF AppCompat switches. + // and works with the BinaryFormat AppCompat switches. WriteObjectToStream(value, restrictSerialization: true); return ReadObjectFromStream(restrictDeserialization: true); } @@ -314,7 +314,7 @@ public void RoundTrip_Unsupported(IList value) public void RoundTrip_RestrictedFormat_Unsupported(IList value) { Action writer = () => WriteObjectToStream(value, restrictSerialization: true); - writer.Should().Throw(); + writer.Should().Throw(); using BinaryFormatterScope scope = new(enable: true); writer.Should().Throw(); diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.cs index 39ee7d7da84..42941bc5973 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.cs @@ -2506,8 +2506,9 @@ public unsafe void DataObject_Native_GetFormats_ReturnsExpected() [WinFormsFact] public unsafe void DataObject_Native_GetData_SerializationFailure() { - using Font value = new("Ariel", 10); + using Font value = new("Arial", 10); using BinaryFormatterScope scope = new(enable: true); + // We are blocking managed font from being serialized as a Locale format. DataObject native = new(DataFormats.Locale, value); // Simulate receiving DataObject from native. diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObject_BitmapBinderTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObject_BitmapBinderTests.cs deleted file mode 100644 index e3bf137f682..00000000000 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObject_BitmapBinderTests.cs +++ /dev/null @@ -1,138 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Collections; -using System.Drawing; -using System.Drawing.Imaging; -using System.Runtime.Serialization; -using System.Runtime.Serialization.Formatters.Binary; - -namespace System.Windows.Forms.Tests; - -public class DataObject_BitmapBinderTests -{ - private static readonly SerializationBinder s_serializationBinder - = (SerializationBinder)Activator.CreateInstance(typeof(DataObject).Assembly.GetType("System.Windows.Forms.DataObject+BitmapBinder")); - - [WinFormsTheory] - [MemberData(nameof(AllowedSerializationTypes))] - public void BitmapBinder_BindToName_AllowedSerializationTypes(object value) - { - using BinaryFormatterScope formatterScope = new(enable: true); - using (value as IDisposable) - { - using MemoryStream stream = new(); -#pragma warning disable SYSLIB0011 // Type or member is obsolete - BinaryFormatter formatter = new() - { - Binder = s_serializationBinder - }; -#pragma warning restore - - formatter.Serialize(stream, value); - stream.Length.Should().BeGreaterThan(0); - } - } - - [WinFormsTheory] - [MemberData(nameof(AllowedSerializationTypes))] - public unsafe void BitmapBinder_BindToType_AllowedSerializationTypes(object value) - { - using BinaryFormatterScope formatterScope = new(enable: true); - using (value as IDisposable) - { - using MemoryStream stream = new(); -#pragma warning disable SYSLIB0011 // Type or member is obsolete - // cs/binary-formatter-without-binder - BinaryFormatter formatter = new(); // CodeQL [SM04191] This is a test. Safe because the deserialization process is performed on trusted data and the types are controlled and validated. -#pragma warning restore - formatter.Serialize(stream, value); - stream.Length.Should().BeGreaterThan(0); - stream.Position = 0; - - formatter = new() - { - Binder = s_serializationBinder - }; - - // cs/dangerous-binary-deserialization - object deserialized = formatter.Deserialize(stream); // CodeQL [SM03722] : Testing legacy feature. Safe use because input stream is controlled contains strings and Bitmap which is instantiated by a binder. - deserialized.Should().NotBeNull(); - - if (value is not Bitmap bitmap) - { - deserialized.Should().BeEquivalentTo(value); - } - else - { - Bitmap deserializedBitmap = deserialized.Should().BeOfType().Which; - BitmapData originalData = bitmap.LockBits(default, ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); - BitmapData deserializedData = deserializedBitmap.LockBits(default, ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); - try - { - ReadOnlySpan originalBytes = new((byte*)originalData.Scan0, originalData.Stride * originalData.Height); - ReadOnlySpan deserializedBytes = new((byte*)deserializedData.Scan0, deserializedData.Stride * deserializedData.Height); - deserializedBytes.SequenceEqual(originalBytes).Should().BeTrue(); - } - finally - { - bitmap.UnlockBits(originalData); - deserializedBitmap.UnlockBits(deserializedData); - } - } - } - } - - public static TheoryData AllowedSerializationTypes => - [ - "Information At your Fingertips", - new string[] { "Hello" }, - new Bitmap(5, 5) - ]; - - [WinFormsTheory] - [MemberData(nameof(DisallowedSerializationTypes))] - public void BitmapBinder_BindToName_DisallowedSerializationTypes(object value) - { - using BinaryFormatterScope formatterScope = new(enable: true); - using MemoryStream stream = new(); -#pragma warning disable SYSLIB0011 // Type or member is obsolete - BinaryFormatter formatter = new() - { - Binder = s_serializationBinder - }; -#pragma warning restore SYSLIB0011 - - Action action = () => formatter.Serialize(stream, value); - action.Should().Throw(); - } - - [WinFormsTheory] - [MemberData(nameof(DisallowedSerializationTypes))] - public void BitmapBinder_BindToType_DisallowedSerializationTypes(object value) - { - using BinaryFormatterScope formatterScope = new(enable: true); - using MemoryStream stream = new(); -#pragma warning disable SYSLIB0011 // Type or member is obsolete - // cs/binary-formatter-without-binder - BinaryFormatter formatter = new(); // CodeQL [SM04191] : This is a test. Safe use because the deserialization process is performed on trusted data and the types are controlled and validated. -#pragma warning restore SYSLIB0011 - formatter.Serialize(stream, value); - stream.Length.Should().BeGreaterThan(0); - stream.Position = 0; - - formatter = new() - { - Binder = s_serializationBinder - }; - - Action action = () => formatter.Deserialize(stream); - action.Should().Throw(); - } - - public static TheoryData DisallowedSerializationTypes => - [ - new List() { "Hello" }, - new Hashtable() { { "Silver", "Hammer" } } - ]; -} From 2174154fe2ae6c61136a9c1e4aa9ad29048d1a88 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 11 Dec 2024 13:37:29 +0000 Subject: [PATCH 096/106] [main] Update dependencies from dotnet/arcade (#12625) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 24 ++++++++++++------------ eng/Versions.props | 6 +++--- global.json | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 91110db014d..f6a2bad7d02 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -191,29 +191,29 @@ Note: if the Uri is a new place, you will need to add a subscription from that p - + https://github.com/dotnet/arcade - 1fba3c5407537249f8c55332cd3d1ac81c39fdb2 + d5c8bb8726b46b5867961f5d8f56f1b13e72dcb9 - + https://github.com/dotnet/arcade - 1fba3c5407537249f8c55332cd3d1ac81c39fdb2 + d5c8bb8726b46b5867961f5d8f56f1b13e72dcb9 - + https://github.com/dotnet/arcade - 1fba3c5407537249f8c55332cd3d1ac81c39fdb2 + d5c8bb8726b46b5867961f5d8f56f1b13e72dcb9 - + https://github.com/dotnet/arcade - 1fba3c5407537249f8c55332cd3d1ac81c39fdb2 + d5c8bb8726b46b5867961f5d8f56f1b13e72dcb9 - + https://github.com/dotnet/arcade - 1fba3c5407537249f8c55332cd3d1ac81c39fdb2 + d5c8bb8726b46b5867961f5d8f56f1b13e72dcb9 - + https://github.com/dotnet/arcade - 1fba3c5407537249f8c55332cd3d1ac81c39fdb2 + d5c8bb8726b46b5867961f5d8f56f1b13e72dcb9 diff --git a/eng/Versions.props b/eng/Versions.props index 6457a7aa3cd..0db97e78327 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -56,9 +56,9 @@ - 10.0.0-beta.24609.8 - 10.0.0-beta.24609.8 - 10.0.0-beta.24609.8 + 10.0.0-beta.24610.2 + 10.0.0-beta.24610.2 + 10.0.0-beta.24610.2 17.4.0-preview-20220707-01 diff --git a/global.json b/global.json index bb2aee91e3a..68e4233f83f 100644 --- a/global.json +++ b/global.json @@ -14,9 +14,9 @@ "version": "10.0.100-alpha.1.24573.1" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24609.8", - "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24609.8", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24609.8", + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24610.2", + "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24610.2", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24610.2", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24610.2" }, From 0b07c2003724941a3848f336a9510d6a35517d82 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 11 Dec 2024 17:05:53 +0000 Subject: [PATCH 097/106] [main] Update dependencies from dotnet/runtime (#12626) [main] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 58 ++++++------- global.json | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f6a2bad7d02..e8a0ed3a6ee 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,186 +7,186 @@ Note: if the Uri is a new place, you will need to add a subscription from that p --> - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e - + https://github.com/dotnet/runtime - 920a17ac91440abb5b34109104e72da77ec58b59 + aa9cd3b3234ef5bfe7d6037016bd7e6b8f991a5e diff --git a/eng/Versions.props b/eng/Versions.props index 0db97e78327..fca8e412072 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,37 +13,37 @@ - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 5.0.0-preview.7.20320.5 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 6.1.0-preview.1.24511.1 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 - 10.0.0-alpha.1.24610.2 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 + 10.0.0-alpha.1.24611.1 diff --git a/global.json b/global.json index 68e4233f83f..11d25b7fa99 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24610.2", "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24610.2", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", - "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24610.2" + "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24611.1" }, "native-tools": { "cmake": "latest" From 85ac69e0a095541e7fc6a0387bdf56eb9b9e6c6d Mon Sep 17 00:00:00 2001 From: Jeremy Kuhne Date: Wed, 11 Dec 2024 16:28:23 -0800 Subject: [PATCH 098/106] Tweak Scratch projects and add WPF visibility for SPWC (#12628) Couple of minor tweaks to the scratch projects for ease of use. Also add System.Printing for visibility of System.Private.Windows.Core. --- src/System.Private.Windows.Core/src/Properties/AssemblyInfo.cs | 1 + .../tests/IntegrationTests/ScratchProject/Program.cs | 3 ++- .../IntegrationTests/ScratchProject/ScratchProject.csproj | 1 - .../IntegrationTests/ScratchProjectWithInternals/Program.cs | 3 ++- .../ScratchProjectWithInternals.csproj | 1 - 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/System.Private.Windows.Core/src/Properties/AssemblyInfo.cs b/src/System.Private.Windows.Core/src/Properties/AssemblyInfo.cs index e07ee692c6b..8607a14ec88 100644 --- a/src/System.Private.Windows.Core/src/Properties/AssemblyInfo.cs +++ b/src/System.Private.Windows.Core/src/Properties/AssemblyInfo.cs @@ -36,6 +36,7 @@ [assembly: InternalsVisibleTo($"PresentationFramework, PublicKey={PublicKeys.MicrosoftShared}")] [assembly: InternalsVisibleTo($"PresentationUI, PublicKey={PublicKeys.MicrosoftShared}")] [assembly: InternalsVisibleTo($"ReachFramework, PublicKey={PublicKeys.MicrosoftShared}")] +[assembly: InternalsVisibleTo($"System.Printing, PublicKey={PublicKeys.MicrosoftShared}")] [assembly: InternalsVisibleTo($"System.Windows.Controls.Ribbon, PublicKey={PublicKeys.Ecma}")] [assembly: InternalsVisibleTo($"System.Windows.Input.Manipulations, PublicKey={PublicKeys.Ecma}")] [assembly: InternalsVisibleTo($"System.Windows.Presentation, PublicKey={PublicKeys.Ecma}")] diff --git a/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject/Program.cs b/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject/Program.cs index 28d00838ec1..56f45123c64 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject/Program.cs +++ b/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject/Program.cs @@ -12,6 +12,7 @@ public static void Main() { Application.EnableVisualStyles(); Application.SetHighDpiMode(HighDpiMode.PerMonitorV2); - Application.Run(new Form1()); + Form1 form = new(); + Application.Run(form); } } diff --git a/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject/ScratchProject.csproj b/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject/ScratchProject.csproj index a9c8b393905..58f6135e1d1 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject/ScratchProject.csproj +++ b/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject/ScratchProject.csproj @@ -3,7 +3,6 @@ WinExe enable - WinExe enable true true diff --git a/src/System.Windows.Forms/tests/IntegrationTests/ScratchProjectWithInternals/Program.cs b/src/System.Windows.Forms/tests/IntegrationTests/ScratchProjectWithInternals/Program.cs index 52f6a4cc389..a3b745b18f9 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/ScratchProjectWithInternals/Program.cs +++ b/src/System.Windows.Forms/tests/IntegrationTests/ScratchProjectWithInternals/Program.cs @@ -13,6 +13,7 @@ public static unsafe void Main() { Application.EnableVisualStyles(); Application.SetHighDpiMode(HighDpiMode.PerMonitorV2); - Application.Run(new Form1()); + Form1 form = new(); + Application.Run(form); } } diff --git a/src/System.Windows.Forms/tests/IntegrationTests/ScratchProjectWithInternals/ScratchProjectWithInternals.csproj b/src/System.Windows.Forms/tests/IntegrationTests/ScratchProjectWithInternals/ScratchProjectWithInternals.csproj index 6299aef794f..9ea487ca847 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/ScratchProjectWithInternals/ScratchProjectWithInternals.csproj +++ b/src/System.Windows.Forms/tests/IntegrationTests/ScratchProjectWithInternals/ScratchProjectWithInternals.csproj @@ -3,7 +3,6 @@ WinExe enable - WinExe enable true true From f091e7b5c19190de7d4166fffabb8aebe1199470 Mon Sep 17 00:00:00 2001 From: Tanya Solyanik Date: Wed, 11 Dec 2024 16:55:05 -0800 Subject: [PATCH 099/106] Adding new strongly typed methods to Clipboard, DataObject and IDataObject. (#11545) Related to ##12362 Fixes #11350 The TryGetData methods use NRBF deserializer by default and will fall back to use BinaryFormatter if the application opts into BinaryFormatter use in this context. The GetData methods have a compatibility mode when the appropriate AppContext switches are enabled but by default they can read only known and primitive types or POCOs with primitive fields. These methods in the DataObject class are obsoleted. --- docs/list-of-diagnostics.md | 4 + src/Common/src/Obsoletions.cs | 9 +- .../TestUtilities/AppContextSwitchNames.cs | 17 +- ...BinaryFormatterInClipboardDragDropScope.cs | 46 ++ .../NrbfSerializerInClipboardDragDropScope.cs | 46 ++ .../VisualBasic/MyServices/ClipboardProxy.vb | 21 +- .../src/Obsoletions.vb | 13 + .../src/PublicAPI.Unshipped.txt | 2 + .../MyServices/ClipboardProxyTests.cs | 52 ++ .../Nrbf/SerializationRecordExtensions.cs | 43 + .../LocalAppContextSwitches.cs | 44 +- .../src/GlobalSuppressions.cs | 1 - .../src/PublicAPI.Unshipped.txt | 17 + .../Windows/Forms/Internal/Formatter.cs | 4 +- .../Windows/Forms/Internal/TypeExtensions.cs | 276 +++++++ .../src/System/Windows/Forms/OLE/Clipboard.cs | 236 +++++- ...bject.Composition.BinaryFormatUtilities.cs | 151 +++- .../OLE/DataObject.Composition.Binder.cs | 237 ++++++ ...ect.Composition.NativeToWinFormsAdapter.cs | 418 ++++++---- ...DataObject.Composition.TypeNameComparer.cs | 89 +++ .../Forms/OLE/DataObject.Composition.cs | 27 +- .../Windows/Forms/OLE/DataObject.DataStore.cs | 93 ++- .../System/Windows/Forms/OLE/DataObject.cs | 135 +++- .../Windows/Forms/OLE/DataObjectExtensions.cs | 64 ++ .../System/Windows/Forms/OLE/IDataObject.cs | 9 + .../Windows/Forms/OLE/ITypedDataObject.cs | 86 ++ .../DesignBehaviorsTests.cs | 2 + .../runtimeconfig.template.json | 2 + .../System.Windows.Forms.Tests.csproj | 1 + .../WinFormsBinaryFormattedObjectTests.cs | 4 +- ...iesTests.BinaryFormatterFullCompatScope.cs | 28 + .../Forms/BinaryFormatUtilitiesTests.cs | 740 +++++++++++++++++- .../System/Windows/Forms/ClipboardTests.cs | 252 +++++- .../Forms/DataObjectExtensionsTests.cs | 261 ++++++ .../Forms/DataObjectTests.ClipboardTests.cs | 1 + .../System/Windows/Forms/DataObjectTests.cs | 280 ++++++- .../Windows/Forms/DragDropHelperTests.cs | 19 +- .../Forms/NativeToWinFormsAdapterTests.cs | 533 +++++++++++++ .../Forms/RichTextBoxTests.ClipboardTests.cs | 2 + .../Windows/Forms/ToolStripItemTests.cs | 2 +- .../Windows/Forms/TypeExtensionsTests.cs | 138 ++++ .../Windows/Forms/TypeNameComparerTests.cs | 106 +++ 42 files changed, 4252 insertions(+), 259 deletions(-) create mode 100644 src/Common/tests/TestUtilities/BinaryFormatterInClipboardDragDropScope.cs create mode 100644 src/Common/tests/TestUtilities/NrbfSerializerInClipboardDragDropScope.cs create mode 100644 src/Microsoft.VisualBasic.Forms/src/Obsoletions.vb create mode 100644 src/System.Windows.Forms/src/System/Windows/Forms/Internal/TypeExtensions.cs create mode 100644 src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.Binder.cs create mode 100644 src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.TypeNameComparer.cs create mode 100644 src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObjectExtensions.cs create mode 100644 src/System.Windows.Forms/src/System/Windows/Forms/OLE/ITypedDataObject.cs create mode 100644 src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.BinaryFormatterFullCompatScope.cs create mode 100644 src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectExtensionsTests.cs create mode 100644 src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/NativeToWinFormsAdapterTests.cs create mode 100644 src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/TypeExtensionsTests.cs create mode 100644 src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/TypeNameComparerTests.cs diff --git a/docs/list-of-diagnostics.md b/docs/list-of-diagnostics.md index f5ac1054037..492d4cb4832 100644 --- a/docs/list-of-diagnostics.md +++ b/docs/list-of-diagnostics.md @@ -13,6 +13,7 @@ The acceptance criteria for adding an obsoletion includes: * Add new constants to `src\Common\src\Obsoletions.cs`, following the existing conventions * A `...Message` const using the same description added to the table below * A `...DiagnosticId` const for the `WFDEV###` id +* If adding attribute to Microsoft.VisualBasic.Forms assembly, edit src\Microsoft.VisualBasic.Forms\src\Obsoletions.vb file * Annotate `src` files by referring to the constants defined from `Obsoletions.cs` * Specify the `UrlFormat = Obsoletions.SharedUrlFormat` * Example: `[Obsolete(Obsoletions.DomainUpDownAccessibleObjectMessage, DiagnosticId = Obsoletions.DomainUpDownAccessibleObjectDiagnosticId, UrlFormat = Obsoletions.SharedUrlFormat)]` @@ -39,6 +40,9 @@ The acceptance criteria for adding an obsoletion includes: | __`WFDEV002`__ | `DomainUpDown.DomainUpDownAccessibleObject` is no longer used to provide accessible support for `DomainUpDown` controls. Use `ControlAccessibleObject` instead. | | __`WFDEV003`__ | `DomainUpDown.DomainItemAccessibleObject` is no longer used to provide accessible support for `DomainUpDown` items. | | __`WFDEV004`__ | `Form.OnClosing`, `Form.OnClosed` and the corresponding events are obsolete. Use `Form.OnFormClosing`, `Form.OnFormClosed`, `Form.FormClosing` and `Form.FormClosed` instead. | +| __`WFDEV005`__ | `Clipboard.GetData(string)` method is obsolete. Use `Clipboard.TryGetData` methods instead. | +| __`WFDEV005`__ | `DataObject.GetData` methods are obsolete. Use the corresponding `DataObject.TryGetData` instead. | +| __`WFDEV005`__ | `ClipboardProxy.GetData(As String)` method is obsolete. Use `ClipboardProxy.TryGetData(Of T)(As String, As T)` instead. | ## Analyzer Warnings diff --git a/src/Common/src/Obsoletions.cs b/src/Common/src/Obsoletions.cs index 310c0c7626a..7c6ee8b10ec 100644 --- a/src/Common/src/Obsoletions.cs +++ b/src/Common/src/Obsoletions.cs @@ -9,7 +9,7 @@ internal static class Obsoletions { internal const string SharedUrlFormat = "https://aka.ms/winforms-warnings/{0}"; - // Please see docs\project\list-of-diagnostics.md for instructions on the steps required + // Please see docs\list-of-diagnostics.md for instructions on the steps required // to introduce a new obsoletion, apply it to downlevel builds, claim a diagnostic id, // and ensure the "aka.ms/dotnet-warnings/{0}" URL points to documentation for the obsoletion // The diagnostic ids reserved for obsoletions are WFDEV### (WFDEV001 - WFDEV999). @@ -24,4 +24,11 @@ internal static class Obsoletions internal const string FormOnClosingClosedMessage = "Form.OnClosing, Form.OnClosed and the corresponding events are obsolete. Use Form.OnFormClosing, Form.OnFormClosed, Form.FormClosing and Form.FormClosed instead."; internal const string FormOnClosingClosedDiagnosticId = "WFDEV004"; + + internal const string ClipboardGetDataMessage = "`Clipboard.GetData(string)` method is obsolete. Use `Clipboard.TryGetData` methods instead."; + internal const string ClipboardGetDataDiagnosticId = "WFDEV005"; + + internal const string DataObjectGetDataMessage = "`DataObject.GetData` methods are obsolete. Use the corresponding `DataObject.TryGetData` instead."; + + internal const string ClipboardProxyGetDataMessage = "`ClipboardProxy.GetData(As String)` method is obsolete. Use `ClipboardProxy.TryGetData(Of T)(As String, As T)` instead."; } diff --git a/src/Common/tests/TestUtilities/AppContextSwitchNames.cs b/src/Common/tests/TestUtilities/AppContextSwitchNames.cs index a6592b061b0..bf75119eb07 100644 --- a/src/Common/tests/TestUtilities/AppContextSwitchNames.cs +++ b/src/Common/tests/TestUtilities/AppContextSwitchNames.cs @@ -14,8 +14,23 @@ public const string EnableUnsafeBinaryFormatterSerialization = "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization"; /// - /// Switch that controls switch caching. + /// Switch that controls switch caching. This switch is set to + /// in our test assemblies. /// public const string LocalAppContext_DisableCaching = "TestSwitch.LocalAppContext.DisableCaching"; + + /// + /// The switch that controls whether or not the is enabled in the + /// Clipboard or drag and drop scenarios + /// + public const string ClipboardDragDropEnableUnsafeBinaryFormatterSerializationSwitchName + = "Windows.ClipboardDragDrop.EnableUnsafeBinaryFormatterSerialization"; + + /// + /// The switch that controls whether or not the System.Windows.Forms.BinaryFormat.Deserializer + /// is enabled in the Clipboard or drag and drop scenarios. + /// + public const string ClipboardDragDropEnableNrbfSerializationSwitchName + = "Windows.ClipboardDragDrop.EnableNrbfSerialization"; } diff --git a/src/Common/tests/TestUtilities/BinaryFormatterInClipboardDragDropScope.cs b/src/Common/tests/TestUtilities/BinaryFormatterInClipboardDragDropScope.cs new file mode 100644 index 00000000000..f5a93820743 --- /dev/null +++ b/src/Common/tests/TestUtilities/BinaryFormatterInClipboardDragDropScope.cs @@ -0,0 +1,46 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System; + +public readonly ref struct BinaryFormatterInClipboardDragDropScope +{ + private readonly AppContextSwitchScope _switchScope; + + public BinaryFormatterInClipboardDragDropScope(bool enable) + { + Monitor.Enter(typeof(BinaryFormatterInClipboardDragDropScope)); + _switchScope = new(AppContextSwitchNames.ClipboardDragDropEnableUnsafeBinaryFormatterSerializationSwitchName, GetDefaultValue, enable); + } + + public void Dispose() + { + try + { + _switchScope.Dispose(); + } + finally + { + Monitor.Exit(typeof(BinaryFormatterInClipboardDragDropScope)); + } + } + + internal static bool GetDefaultValue() + { + var assemblies = AppDomain.CurrentDomain.GetAssemblies(); + foreach (var assembly in assemblies) + { + if (assembly.FullName?.StartsWith("System.Windows.Forms.Primitives,", StringComparison.InvariantCultureIgnoreCase) == true) + { + var type = assembly.GetType("System.Windows.Forms.Primitives.LocalAppContextSwitches") + ?? throw new InvalidOperationException("Could not find LocalAppContextSwitches type in System.Windows.Forms.Primitives assembly."); + + bool value = type.TestAccessor().CreateDelegate>("GetSwitchDefaultValue") + (AppContextSwitchNames.ClipboardDragDropEnableUnsafeBinaryFormatterSerializationSwitchName); + return value; + } + } + + throw new InvalidOperationException("Could not find System.Windows.Forms.Primitives assembly in the test process."); + } +} diff --git a/src/Common/tests/TestUtilities/NrbfSerializerInClipboardDragDropScope.cs b/src/Common/tests/TestUtilities/NrbfSerializerInClipboardDragDropScope.cs new file mode 100644 index 00000000000..7d7283e0f2e --- /dev/null +++ b/src/Common/tests/TestUtilities/NrbfSerializerInClipboardDragDropScope.cs @@ -0,0 +1,46 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System; + +public readonly ref struct NrbfSerializerInClipboardDragDropScope +{ + private readonly AppContextSwitchScope _switchScope; + + public NrbfSerializerInClipboardDragDropScope(bool enable) + { + Monitor.Enter(typeof(NrbfSerializerInClipboardDragDropScope)); + _switchScope = new(AppContextSwitchNames.ClipboardDragDropEnableNrbfSerializationSwitchName, GetDefaultValue, enable); + } + + public void Dispose() + { + try + { + _switchScope.Dispose(); + } + finally + { + Monitor.Exit(typeof(NrbfSerializerInClipboardDragDropScope)); + } + } + + internal static bool GetDefaultValue() + { + var assemblies = AppDomain.CurrentDomain.GetAssemblies(); + foreach (var assembly in assemblies) + { + if (assembly.FullName?.StartsWith("System.Windows.Forms.Primitives,", StringComparison.InvariantCultureIgnoreCase) == true) + { + var type = assembly.GetType("System.Windows.Forms.Primitives.LocalAppContextSwitches") + ?? throw new InvalidOperationException("Could not find LocalAppContextSwitches type in System.Windows.Forms.Primitives assembly."); + + bool value = type.TestAccessor().CreateDelegate>("GetSwitchDefaultValue") + (AppContextSwitchNames.ClipboardDragDropEnableNrbfSerializationSwitchName); + return value; + } + } + + throw new InvalidOperationException("Could not find System.Windows.Forms.Primitives assembly in the test process."); + } +} diff --git a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/MyServices/ClipboardProxy.vb b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/MyServices/ClipboardProxy.vb index 2a747f9d266..6187bc12fa5 100644 --- a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/MyServices/ClipboardProxy.vb +++ b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/MyServices/ClipboardProxy.vb @@ -6,6 +6,8 @@ Imports System.ComponentModel Imports System.Drawing Imports System.IO Imports System.Windows.Forms +Imports System.Reflection.Metadata +Imports System.Runtime.InteropServices Namespace Microsoft.VisualBasic.MyServices @@ -93,8 +95,15 @@ Namespace Microsoft.VisualBasic.MyServices ''' ''' The type of data being sought. ''' The data. + Public Function GetData(format As String) As Object +#Disable Warning WFDEV005 ' Type or member is obsolete Return Clipboard.GetData(format) +#Enable Warning WFDEV005 End Function ''' @@ -183,6 +192,16 @@ Namespace Microsoft.VisualBasic.MyServices Clipboard.SetFileDropList(filePaths) End Sub + ''' + Public Function TryGetData(Of T)(format As String, resolver As Func(Of TypeName, Type), ByRef data As T) As Boolean + Return Clipboard.TryGetData(format, resolver, data) + End Function + + ''' + Public Function TryGetData(Of T)(format As String, ByRef data As T) As Boolean + Return Clipboard.TryGetData(format, data) + End Function + ''' ''' Saves the passed in to the clipboard. ''' @@ -192,7 +211,7 @@ Namespace Microsoft.VisualBasic.MyServices End Sub ''' - ''' Saves the passed in String to the clipboard. + ''' Saves the passed in to the clipboard. ''' ''' The to save. Public Sub SetText(text As String) diff --git a/src/Microsoft.VisualBasic.Forms/src/Obsoletions.vb b/src/Microsoft.VisualBasic.Forms/src/Obsoletions.vb new file mode 100644 index 00000000000..43a6ca6adf0 --- /dev/null +++ b/src/Microsoft.VisualBasic.Forms/src/Obsoletions.vb @@ -0,0 +1,13 @@ +' Licensed to the .NET Foundation under one or more agreements. +' The .NET Foundation licenses this file to you under the MIT license. + +Friend NotInheritable Class Obsoletions + + Friend Const SharedUrlFormat As String = "https://aka.ms/winforms-warnings/{0}" + + ' Please see docs\list-Of-diagnostics.md for how to claim a diagnostic id. + ' The diagnostic ids reserved for obsoletions are WFDEV### (WFDEV001 - WFDEV999). + + Friend Const ClipboardProxyGetDataMessage As String = "`ClipboardProxy.GetData(As String)` method is obsolete. Use `ClipboardProxy.TryGetData(Of T)(As String, As T)` instead." + Friend Const ClipboardGetDataDiagnosticId As String = "WFDEV005" +End Class diff --git a/src/Microsoft.VisualBasic.Forms/src/PublicAPI.Unshipped.txt b/src/Microsoft.VisualBasic.Forms/src/PublicAPI.Unshipped.txt index e69de29bb2d..65993b67a39 100644 --- a/src/Microsoft.VisualBasic.Forms/src/PublicAPI.Unshipped.txt +++ b/src/Microsoft.VisualBasic.Forms/src/PublicAPI.Unshipped.txt @@ -0,0 +1,2 @@ +Microsoft.VisualBasic.MyServices.ClipboardProxy.TryGetData(Of T)(format As String, ByRef data As T) -> Boolean +Microsoft.VisualBasic.MyServices.ClipboardProxy.TryGetData(Of T)(format As String, resolver As System.Func(Of System.Reflection.Metadata.TypeName, System.Type), ByRef data As T) -> Boolean \ No newline at end of file diff --git a/src/Microsoft.VisualBasic/tests/UnitTests/Microsoft/VisualBasic/MyServices/ClipboardProxyTests.cs b/src/Microsoft.VisualBasic/tests/UnitTests/Microsoft/VisualBasic/MyServices/ClipboardProxyTests.cs index 61d048046de..f95e21f215a 100644 --- a/src/Microsoft.VisualBasic/tests/UnitTests/Microsoft/VisualBasic/MyServices/ClipboardProxyTests.cs +++ b/src/Microsoft.VisualBasic/tests/UnitTests/Microsoft/VisualBasic/MyServices/ClipboardProxyTests.cs @@ -4,6 +4,7 @@ #nullable enable using System.Drawing; +using System.Reflection.Metadata; using Microsoft.VisualBasic.Devices; using DataFormats = System.Windows.Forms.DataFormats; using TextDataFormat = System.Windows.Forms.TextDataFormat; @@ -16,6 +17,7 @@ namespace Microsoft.VisualBasic.MyServices.Tests; [UISettings(MaxAttempts = 3)] // Try up to 3 times before failing. public class ClipboardProxyTests { +#pragma warning disable WFDEV005 // Type or member is obsolete private static string GetUniqueText() => Guid.NewGuid().ToString("D"); [WinFormsFact] @@ -83,4 +85,54 @@ public void Text() System.Windows.Forms.Clipboard.GetText(TextDataFormat.UnicodeText).Should().Be(clipboard.GetText(TextDataFormat.UnicodeText)); clipboard.GetText(TextDataFormat.UnicodeText).Should().Be(text); } + + [WinFormsFact] + public void DataOfT_StringArray() + { + var clipboard = new Computer().Clipboard; + string format = nameof(DataOfT_StringArray); + // Array of primitive types does not require the OOB assembly. + string[] data = ["thing1", "thing2"]; + clipboard.SetData(format, data); + // Both methods return true. + clipboard.TryGetData(format, out string[]? actual).Should() + .Be(System.Windows.Forms.Clipboard.TryGetData(format, out string[]? expected)); + actual.Should().BeEquivalentTo(expected); + } + + [WinFormsFact] + public void DataOfT_BinaryFormatterRequired() + { + var clipboard = new Computer().Clipboard; + string format = nameof(DataOfT_BinaryFormatterRequired); + DataWithObjectField data = new("thing1", "thing2"); + using BinaryFormatterScope scope = new(enable: true); + using BinaryFormatterInClipboardDragDropScope clipboardScope = new(enable: true); + // This test assembly does not reference the OOB package, we will write the NotSupportedException to the clipboard. + clipboard.SetData(format, data); + // Both methods return false. + Action tryGetData = () => clipboard.TryGetData(format, DataWithObjectField.Resolver, out DataWithObjectField? actual); + string actual = tryGetData.Should().Throw().Which.Message; + Action tryGetData1 = () => System.Windows.Forms.Clipboard.TryGetData(format, DataWithObjectField.Resolver, out DataWithObjectField? expected); + string expected = tryGetData1.Should().Throw().Which.Message; + actual.Should().BeEquivalentTo(expected); + } + + [Serializable] + private class DataWithObjectField + { + public DataWithObjectField(string text1, object object2) + { + _text1 = text1; + _object2 = object2; + } + + public string _text1; + public object _object2; + + public static Type Resolver(TypeName typeName) => + typeof(DataWithObjectField).FullName == typeName.FullName + ? typeof(DataWithObjectField) + : throw new NotSupportedException($"Can't resolve {typeName.AssemblyQualifiedName}"); + } } diff --git a/src/System.Private.Windows.Core/src/System/Private/Windows/Core/Nrbf/SerializationRecordExtensions.cs b/src/System.Private.Windows.Core/src/System/Private/Windows/Core/Nrbf/SerializationRecordExtensions.cs index 80f0f584c81..7f9ba95a70b 100644 --- a/src/System.Private.Windows.Core/src/System/Private/Windows/Core/Nrbf/SerializationRecordExtensions.cs +++ b/src/System.Private.Windows.Core/src/System/Private/Windows/Core/Nrbf/SerializationRecordExtensions.cs @@ -5,6 +5,7 @@ using System.ComponentModel; using System.Drawing; using System.Formats.Nrbf; +using System.Private.Windows.Core.BinaryFormat; using System.Reflection; using System.Runtime.ExceptionServices; using System.Runtime.Serialization; @@ -41,6 +42,48 @@ internal static SerializationRecord Decode(this Stream stream) } } + internal static SerializationRecord Decode(this Stream stream, out IReadOnlyDictionary recordMap) + { + try + { + return NrbfDecoder.Decode(stream, out recordMap, leaveOpen: true); + } + catch (Exception ex) when (ex is ArgumentException or InvalidCastException or ArithmeticException or IOException) + { + // Make the exception easier to catch, but retain the original stack trace. + throw ex.ConvertToSerializationException(); + } + catch (TargetInvocationException ex) + { + throw ExceptionDispatchInfo.Capture(ex.InnerException!).SourceException.ConvertToSerializationException(); + } + } + + /// + /// Deserializes the to an object. + /// + [RequiresUnreferencedCode("Ultimately calls resolver for type names in the data.")] + public static object? Deserialize( + this SerializationRecord rootRecord, + IReadOnlyDictionary recordMap, + ITypeResolver typeResolver) + { + DeserializationOptions options = new() + { + TypeResolver = typeResolver + }; + + try + { + return Deserializer.Deserialize(rootRecord.Id, recordMap, options); + } + catch (SerializationException ex) + { + throw ExceptionDispatchInfo.SetRemoteStackTrace( + new NotSupportedException(ex.Message, ex), ex.StackTrace ?? string.Empty); + } + } + internal delegate bool TryGetDelegate(SerializationRecord record, [NotNullWhen(true)] out object? value); internal static bool TryGet(TryGetDelegate get, SerializationRecord record, [NotNullWhen(true)] out object? value) diff --git a/src/System.Windows.Forms.Primitives/src/System/LocalAppContextSwitches/LocalAppContextSwitches.cs b/src/System.Windows.Forms.Primitives/src/System/LocalAppContextSwitches/LocalAppContextSwitches.cs index 2b4b42128d5..21922e3e89d 100644 --- a/src/System.Windows.Forms.Primitives/src/System/LocalAppContextSwitches/LocalAppContextSwitches.cs +++ b/src/System.Windows.Forms.Primitives/src/System/LocalAppContextSwitches/LocalAppContextSwitches.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Runtime.CompilerServices; +using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Versioning; namespace System.Windows.Forms.Primitives; @@ -25,6 +26,8 @@ internal static partial class LocalAppContextSwitches internal const string NoClientNotificationsSwitchName = "Switch.System.Windows.Forms.AccessibleObject.NoClientNotifications"; internal const string EnableMsoComponentManagerSwitchName = "Switch.System.Windows.Forms.EnableMsoComponentManager"; internal const string TreeNodeCollectionAddRangeRespectsSortOrderSwitchName = "System.Windows.Forms.TreeNodeCollectionAddRangeRespectsSortOrder"; + internal const string ClipboardDragDropEnableUnsafeBinaryFormatterSerializationSwitchName = "Windows.ClipboardDragDrop.EnableUnsafeBinaryFormatterSerialization"; + internal const string ClipboardDragDropEnableNrbfSerializationSwitchName = "Windows.ClipboardDragDrop.EnableNrbfSerialization"; private static int s_scaleTopLevelFormMinMaxSizeForDpi; private static int s_anchorLayoutV2; @@ -36,11 +39,13 @@ internal static partial class LocalAppContextSwitches private static int s_noClientNotifications; private static int s_enableMsoComponentManager; private static int s_treeNodeCollectionAddRangeRespectsSortOrder; + private static int s_clipboardDragDropEnableUnsafeBinaryFormatterSerialization; + private static int s_clipboardDragDropEnableNrbfSerialization; private static FrameworkName? s_targetFrameworkName; /// - /// When there is no exception handler registered for a thread, rethrows the exception. The exception will + /// When there is no exception handler registered for a thread, re-throws the exception. The exception will /// not be presented in a dialog or swallowed when not in interactive mode. This is always opt-in and is /// intended for scenarios where setting handlers for threads isn't practical. /// @@ -106,6 +111,11 @@ private static bool GetSwitchDefaultValue(string switchName) return true; } + if (switchName == ClipboardDragDropEnableNrbfSerializationSwitchName) + { + return true; + } + if (TargetFrameworkName is not { } framework) { return false; @@ -218,4 +228,36 @@ public static bool TreeNodeCollectionAddRangeRespectsSortOrder [MethodImpl(MethodImplOptions.AggressiveInlining)] get => GetCachedSwitchValue(TreeNodeCollectionAddRangeRespectsSortOrderSwitchName, ref s_treeNodeCollectionAddRangeRespectsSortOrder); } + + /// + /// If , then Clipboard and DataObject Get and Set methods will attempts to serialize or deserialize + /// binary formatted content using either or System.Windows.Forms.BinaryFormat.Deserializer. + /// To use , application should also opt in into the + /// "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization" option and reference the out-of-band + /// "System.Runtime.Serialization.Formatters" NuGet package and opt out from using the System.Windows.Forms.BinaryFormat.Deserializer + /// by setting "Windows.ClipboardDragDrop.EnableNrbfSerialization" to + /// + public static bool ClipboardDragDropEnableUnsafeBinaryFormatterSerialization + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => GetCachedSwitchValue(ClipboardDragDropEnableUnsafeBinaryFormatterSerializationSwitchName, + ref s_clipboardDragDropEnableUnsafeBinaryFormatterSerialization); + } + + /// + /// If , then Clipboard Get methods will prefer System.Windows.Forms.BinaryFormat.Deserializer + /// to deserialize the payload, if needed. If , then is used + /// to get full compatibility with the downlevel versions of .NET. + /// + /// + /// + /// This switch has no effect if "Windows.ClipboardDragDrop.EnableUnsafeBinaryFormatterSerialization" + /// is set to . + /// + /// + public static bool ClipboardDragDropEnableNrbfSerialization + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => GetCachedSwitchValue(ClipboardDragDropEnableNrbfSerializationSwitchName, ref s_clipboardDragDropEnableNrbfSerialization); + } } diff --git a/src/System.Windows.Forms/src/GlobalSuppressions.cs b/src/System.Windows.Forms/src/GlobalSuppressions.cs index 10b5d06d35f..0e99c230d1d 100644 --- a/src/System.Windows.Forms/src/GlobalSuppressions.cs +++ b/src/System.Windows.Forms/src/GlobalSuppressions.cs @@ -229,7 +229,6 @@ [assembly: SuppressMessage("CodeQuality", "IDE0051:Remove unused private members", Justification = "Designer", Scope = "member", Target = "~M:System.Windows.Forms.MdiClient.ShouldSerializeLocation~System.Boolean")] // Ideally these should be different exceptions, but leaving them as shipped for compatibility -[assembly: SuppressMessage("Usage", "CA2201:Do not raise reserved exception types", Justification = "Compat", Scope = "member", Target = "~M:System.Windows.Forms.DataObject.Composition.NativeToWinFormsAdapter.GetDataFromHGLOBAL(Windows.Win32.Foundation.HGLOBAL,System.String)~System.Object")] [assembly: SuppressMessage("Usage", "CA2201:Do not raise reserved exception types", Justification = "Compat", Scope = "member", Target = "~M:System.Windows.Forms.DataObject.Composition.NativeToWinFormsAdapter.ReadByteStreamFromHGLOBAL(Windows.Win32.Foundation.HGLOBAL,System.Boolean@)~System.IO.MemoryStream")] [assembly: SuppressMessage("Usage", "CA2201:Do not raise reserved exception types", Justification = "Compat", Scope = "member", Target = "~M:System.Windows.Forms.DataObject.Composition.NativeToRuntimeAdapter.System#Runtime#InteropServices#ComTypes#IDataObject#EnumFormatEtc(System.Runtime.InteropServices.ComTypes.DATADIR)~System.Runtime.InteropServices.ComTypes.IEnumFORMATETC")] [assembly: SuppressMessage("Usage", "CA2201:Do not raise reserved exception types", Justification = "Compat", Scope = "member", Target = "~M:System.Windows.Forms.Clipboard.SetDataObject(System.Object,System.Boolean,System.Int32,System.Int32)")] diff --git a/src/System.Windows.Forms/src/PublicAPI.Unshipped.txt b/src/System.Windows.Forms/src/PublicAPI.Unshipped.txt index bdd6c2d1665..d778a18227d 100644 --- a/src/System.Windows.Forms/src/PublicAPI.Unshipped.txt +++ b/src/System.Windows.Forms/src/PublicAPI.Unshipped.txt @@ -1,4 +1,21 @@ +static System.Windows.Forms.Clipboard.TryGetData(string! format, out T data) -> bool +static System.Windows.Forms.Clipboard.TryGetData(string! format, System.Func! resolver, out T data) -> bool +static System.Windows.Forms.DataObjectExtensions.TryGetData(this System.Windows.Forms.IDataObject! dataObject, out T data) -> bool +static System.Windows.Forms.DataObjectExtensions.TryGetData(this System.Windows.Forms.IDataObject! dataObject, string! format, bool autoConvert, out T data) -> bool +static System.Windows.Forms.DataObjectExtensions.TryGetData(this System.Windows.Forms.IDataObject! dataObject, string! format, out T data) -> bool +static System.Windows.Forms.DataObjectExtensions.TryGetData(this System.Windows.Forms.IDataObject! dataObject, string! format, System.Func! resolver, bool autoConvert, out T data) -> bool System.Windows.Forms.DataGridViewCellStyle.Font.get -> System.Drawing.Font? +System.Windows.Forms.DataObject.TryGetData(out T data) -> bool +System.Windows.Forms.DataObject.TryGetData(string! format, bool autoConvert, out T data) -> bool +System.Windows.Forms.DataObject.TryGetData(string! format, out T data) -> bool +System.Windows.Forms.DataObject.TryGetData(string! format, System.Func! resolver, bool autoConvert, out T data) -> bool +System.Windows.Forms.DataObjectExtensions +System.Windows.Forms.ITypedDataObject +System.Windows.Forms.ITypedDataObject.TryGetData(out T data) -> bool +System.Windows.Forms.ITypedDataObject.TryGetData(string! format, bool autoConvert, out T data) -> bool +System.Windows.Forms.ITypedDataObject.TryGetData(string! format, out T data) -> bool +System.Windows.Forms.ITypedDataObject.TryGetData(string! format, System.Func! resolver, bool autoConvert, out T data) -> bool +virtual System.Windows.Forms.DataObject.TryGetDataCore(string! format, System.Func? resolver, bool autoConvert, out T data) -> bool [WFO5001]static System.Windows.Forms.Application.SetColorMode(System.Windows.Forms.SystemColorMode systemColorMode) -> void [WFO5001]System.Windows.Forms.Form.FormBorderColorChanged -> System.EventHandler? [WFO5001]System.Windows.Forms.Form.FormCaptionBackColorChanged -> System.EventHandler? diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Internal/Formatter.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Internal/Formatter.cs index a0724a11370..ae5f8e125a0 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Internal/Formatter.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Internal/Formatter.cs @@ -525,9 +525,9 @@ public static bool IsNullData(object? value, object? dataSourceNullValue) } /// - /// Extract the inner type from a nullable type + /// Extract the inner type from a nullable type. /// - private static Type NullableUnwrap(Type type) + public static Type NullableUnwrap(Type type) { if (type == s_stringType) // ...performance optimization for the most common case { diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Internal/TypeExtensions.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Internal/TypeExtensions.cs new file mode 100644 index 00000000000..c252bb8f0d8 --- /dev/null +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Internal/TypeExtensions.cs @@ -0,0 +1,276 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Immutable; +using System.Reflection.Metadata; +using System.Runtime.CompilerServices; + +namespace System.Windows.Forms; + +/// +/// Helper methods for comparing s and s. +/// +internal static class TypeExtensions +{ + private static readonly Type s_forwardedFromAttributeType = typeof(TypeForwardedFromAttribute); + + /// + /// Get the full assembly name this is forwarded from. + /// + /// + /// if the is forwarded from another assembly; + /// otherwise, . + /// + public static bool TryGetForwardedFromName(this Type type, [NotNullWhen(true)] out string? name) + { + name = default; + + // Special case types like arrays. + Type attributedType = type; + while (attributedType.HasElementType) + { + attributedType = attributedType.GetElementType()!; + } + + object[] attributes = attributedType.GetCustomAttributes(s_forwardedFromAttributeType, inherit: false); + if (attributes.Length > 0 && attributes[0] is TypeForwardedFromAttribute attribute) + { + name = attribute.AssemblyFullName; + return true; + } + + return false; + } + + /// + /// The entry point for matching to . The top level + /// can be nullable, as the user would request a nullable type read from the clipboard payload, but the root record would + /// serialize a non-nullable type, thus from the root record is not nullable. + /// + public static bool MatchExceptAssemblyVersion(this Type type, TypeName typeName) + { + type = Formatter.NullableUnwrap(type); + + return type.MatchLessAssemblyVersion(typeName); + } + + /// + /// Match namespace-qualified type names and assembly names with no version. + /// + /// + /// + /// Read the from the to match the unified assembly names, + /// because had been serialized with the forwarded from assembly name by our serializers. + /// + /// + // based on https://github.com/dotnet/runtime/blob/1474fc3fafca26b4b051be7dacdba8ac2804c56e/src/libraries/System.Formats.Nrbf/src/System/Formats/Nrbf/SerializationRecord.cs#L68 + private static bool MatchLessAssemblyVersion(this Type type, TypeName typeName) + { + // We don't need to check for pointers and references to arrays, + // as it's impossible to serialize them with BinaryFormatter. + if (type is null || type.IsPointer || type.IsByRef) + { + return false; + } + + // At first, check the non-allocating properties for mismatch. + if (type.IsArray != typeName.IsArray + || type.IsConstructedGenericType != typeName.IsConstructedGenericType + || type.IsNested != typeName.IsNested + || (type.IsArray && type.GetArrayRank() != typeName.GetArrayRank()) + || type.IsSZArray != typeName.IsSZArray // int[] vs int[*] + ) + { + return false; + } + + if (!type.TryGetForwardedFromName(out string? name)) + { + name = type.Assembly.FullName; + } + + if (!AssemblyNamesLessVersionMatch(name, typeName.AssemblyName)) + { + return false; + } + + if (type.FullName == typeName.FullName) + { + return true; + } + + if (typeName.IsArray) + { + return MatchLessAssemblyVersion(type.GetElementType()!, typeName.GetElementType()); + } + + if (type.IsConstructedGenericType) + { + if (!MatchLessAssemblyVersion(type.GetGenericTypeDefinition(), typeName.GetGenericTypeDefinition())) + { + return false; + } + + ImmutableArray genericNames = typeName.GetGenericArguments(); + Type[] genericTypes = type.GetGenericArguments(); + + if (genericNames.Length != genericTypes.Length) + { + return false; + } + + for (int i = 0; i < genericTypes.Length; i++) + { + if (!MatchLessAssemblyVersion(genericTypes[i], genericNames[i])) + { + return false; + } + } + + return true; + } + + return false; + + static bool AssemblyNamesLessVersionMatch(string? fullName, AssemblyNameInfo? nameInfo) + { + if (string.Equals(fullName, nameInfo?.FullName, StringComparison.InvariantCultureIgnoreCase)) + { + return true; + } + + if (fullName is null || nameInfo is null) + { + return false; + } + + if (!AssemblyNameInfo.TryParse(fullName, out AssemblyNameInfo? nameInfo1)) + { + return false; + } + + // Match everything except for the versions. + return nameInfo.Name == nameInfo1.Name + && ((nameInfo.CultureName ?? string.Empty) == nameInfo1.CultureName) + && nameInfo.PublicKeyOrToken.AsSpan().SequenceEqual(nameInfo1.PublicKeyOrToken.AsSpan()); + } + } + + /// + /// Match s using all information that had been set by the caller. + /// + public static bool Matches(this TypeName x, TypeName y) + { + if (x.IsArray != y.IsArray + || x.IsConstructedGenericType != y.IsConstructedGenericType + || x.IsNested != y.IsNested + || (x.IsArray && x.GetArrayRank() != y.GetArrayRank()) + || x.IsSZArray != y.IsSZArray // int[] vs int[*] + ) + { + return false; + } + + if (!AssemblyNamesMatch(x.AssemblyName, y.AssemblyName)) + { + return false; + } + + if (x.FullName == y.FullName) + { + return true; + } + + if (y.IsArray) + { + return Matches(x.GetElementType(), y.GetElementType()); + } + + if (x.IsConstructedGenericType) + { + if (!Matches(x.GetGenericTypeDefinition(), y.GetGenericTypeDefinition())) + { + return false; + } + + ImmutableArray genericNamesY = y.GetGenericArguments(); + ImmutableArray genericNamesX = x.GetGenericArguments(); + + if (genericNamesX.Length != genericNamesY.Length) + { + return false; + } + + for (int i = 0; i < genericNamesX.Length; i++) + { + if (!Matches(genericNamesX[i], genericNamesY[i])) + { + return false; + } + } + + return true; + } + + return false; + + static bool AssemblyNamesMatch(AssemblyNameInfo? name1, AssemblyNameInfo? name2) + { + if (name1 is null && name2 is null) + { + return true; + } + + if (name1 is null || name2 is null) + { + return false; + } + + // Case-sensitive comparisons. + return name1.Name == name2.Name + && name1.CultureName == name2.CultureName + && name1.Version == name2.Version + && name1.PublicKeyOrToken.AsSpan().SequenceEqual(name2.PublicKeyOrToken.AsSpan()); + } + } + + /// + /// Convert to . This method removes nullability wrapper + /// from the top level type only because in the serialization root record is not nullable. + /// + public static TypeName ToTypeName(this Type type) + { + // Unwrap type that is matched against the root record type. + type = Formatter.NullableUnwrap(type); + if (!type.TryGetForwardedFromName(out string? assemblyName)) + { + assemblyName = type.Assembly.FullName; + } + + return TypeName.Parse($"{GetTypeFullName(type)}, {assemblyName}"); + + static string GetTypeFullName(Type type) + { + if (type.IsConstructedGenericType) + { + Type[] genericArguments = type.GetGenericArguments(); + string[] genericTypeNames = new string[genericArguments.Length]; + for (int i = 0; i < type.GetGenericArguments().Length; i++) + { + Type generic = genericArguments[i]; + // Keep Nullable wrappers for types inside generic types. + if (!generic.TryGetForwardedFromName(out string? name)) + { + name = generic.Assembly.FullName; + } + + genericTypeNames[i] = $"[{GetTypeFullName(generic)}, {name}]"; + } + + return $"{type.Namespace}.{type.Name}[{string.Join(",", genericTypeNames)}]"; + } + + return type.FullName.OrThrowIfNull(); + } + } +} diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/Clipboard.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/Clipboard.cs index bdfdd78f333..186ea02cb42 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/Clipboard.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/Clipboard.cs @@ -3,7 +3,10 @@ using System.Collections.Specialized; using System.Drawing; +using System.Formats.Nrbf; +using System.Reflection.Metadata; using System.Runtime.InteropServices; +using System.Runtime.Serialization.Formatters.Binary; using Windows.Win32.System.Com; using Com = Windows.Win32.System.Com; @@ -17,11 +20,13 @@ public static class Clipboard /// /// Places non-persistent data on the system . /// + /// public static void SetDataObject(object data) => SetDataObject(data, copy: false); /// /// Overload that uses default values for retryTimes and retryDelay. /// + /// public static void SetDataObject(object data, bool copy) => SetDataObject(data, copy, retryTimes: 10, retryDelay: 100); @@ -29,6 +34,11 @@ public static void SetDataObject(object data, bool copy) => /// Places data on the system and uses copy to specify whether the data /// should remain on the after the application exits. /// + /// + /// + /// See remarks for for recommendations on how to implement custom . + /// + /// public static unsafe void SetDataObject(object data, bool copy, int retryTimes, int retryDelay) { if (Application.OleRequired() != ApartmentState.STA) @@ -81,7 +91,7 @@ public static unsafe void SetDataObject(object data, bool copy, int retryTimes, if (Application.OleRequired() != ApartmentState.STA) { // Only throw if a message loop was started. This makes the case of trying to query the clipboard from the - // finalizer or non-ui MTA thread silently fail, instead of making the application die. + // finalizer or non-UI MTA thread silently fail, instead of making the application die. return Application.MessageLoop ? throw new ThreadStateException(SR.ThreadMustBeSTA) : null; } @@ -218,7 +228,7 @@ public static bool ContainsText(TextDataFormat format) /// /// Retrieves an audio stream from the . /// - public static Stream? GetAudioStream() => GetData(DataFormats.WaveAudioConstant) as Stream; + public static Stream? GetAudioStream() => GetTypedDataIfAvailable(DataFormats.WaveAudioConstant); /// /// Retrieves data from the in the specified format. @@ -226,12 +236,201 @@ public static bool ContainsText(TextDataFormat format) /// /// The current thread is not in single-threaded apartment (STA) mode. /// + [Obsolete( + Obsoletions.ClipboardGetDataMessage, + error: false, + DiagnosticId = Obsoletions.ClipboardGetDataDiagnosticId, + UrlFormat = Obsoletions.SharedUrlFormat)] public static object? GetData(string format) => string.IsNullOrWhiteSpace(format) ? null : GetData(format, autoConvert: false); private static object? GetData(string format, bool autoConvert) => GetDataObject() is IDataObject dataObject ? dataObject.GetData(format, autoConvert) : null; + /// + /// Retrieves data from the in the specified format if that data is of type . + /// This is an alternative to that uses only when application + /// enabled the switch named "Windows.ClipboardDragDrop.EnableUnsafeBinaryFormatterSerialization". + /// By default the NRBF deserializer attempts to deserialize the stream. It can be disabled in favor of + /// with switch named "Windows.ClipboardDragDrop.EnableNrbfSerialization". + /// + /// + /// + /// The format of the data to retrieve. See the class for a set of predefined data formats. + /// + /// + /// + /// + /// A that is used only when deserializing non-OLE formats. It returns the type if + /// is allowed or throws a if is not + /// expected. It should not return a . It should resolve type requested by the user as + /// , as well as types of its fields, unless they are primitive or known types. + /// + /// + /// The following types are resolved automatically: + /// + /// + /// + /// + /// NRBF primitive types + /// (bool, byte, char, decimal, double, short, int, long, sbyte, ushort, uint, ulong, float, string, TimeSpan, DateTime). + /// + /// + /// + /// + /// System.Drawing.Primitive.dll exchange types (PointF, RectangleF, Point, Rectangle, SizeF, Size, Color). + /// + /// + /// + /// + /// Types commonly used in WinForms applications (System.Drawing.Bitmap, System.Windows.Forms.ImageListStreamer, + /// System.NotSupportedException, only the message is re-hydrated, List{T} where T is an NRBF primitive type, + /// and arrays of NRBF primitive types). + /// + /// + /// + /// + /// parameter can be matched according to the user requirements, for example, only namespace-qualified + /// type names, or full type and assembly names, or full type names and short assembly names. + /// + /// + /// + /// + /// Out parameter that contains the retrieved data in the specified format, or if the data is + /// unavailable in the specified format, or is of a wrong . + /// + /// + /// + /// if the data of this format is present on the clipboard and the value is + /// of a matching type and that value can be successfully retrieved, or + /// if the format is not present or the value is of a wrong . + /// + /// + /// + /// Avoid loading assemblies named in the argument of the resolver function. Resolve only types + /// available at the compile time, for example do not call the method. + /// + /// + /// Some common types, for example , are type-forwarded from .NET Framework assemblies using the + /// . serializes these types + /// using the forwarded from assembly information. The resolver function should take this into account and either + /// match only namespace qualified type names or read the + /// from the allowed type and match it to the property of . + /// + /// + /// Make sure to match short assembly names if other information, such as version, is not needed, for example, when your + /// application can read multiple versions of the type. For exact matching, including assembly version, resolver + /// function is required, however primitive and common types are always matched after assembly version is removed. + /// + /// + /// Arrays, generic types, and nullable value types have full element name, including its assembly name, in the + /// property. Resolver function should either remove or type-forward these assembly + /// names when matching. + /// + /// + /// + /// If application does not support and the object can't be deserialized otherwise, or + /// application supports but is an , + /// or not a concrete type, or if does not resolve the actual payload type. Or + /// the on the does not implement + /// interface. + /// + /// + /// + /// + [CLSCompliant(false)] + public static bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + string format, + Func resolver, + [NotNullWhen(true), MaybeNullWhen(false)] out T data) + { + data = default; + resolver.OrThrowIfNull(); + + return GetTypedDataObject(format, out ITypedDataObject? typed) + && typed.TryGetData(format, resolver, autoConvert: false, out data); + } + + /// + public static bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + string format, + [NotNullWhen(true), MaybeNullWhen(false)] out T data) + { + data = default; + + return GetTypedDataObject(format, out ITypedDataObject? typed) && typed.TryGetData(format, out data); + } + + private static bool GetTypedDataObject( + string format, + [NotNullWhen(true), MaybeNullWhen(false)] out ITypedDataObject typed) + { + typed = default; + if (!DataObject.IsValidFormatAndType(format) + || GetDataObject() is not { } dataObject) + { + // Invalid format or no object on the clipboard at all. + return false; + } + + if (dataObject is not ITypedDataObject typedDataObject) + { + // TODO (TanyaSo): localize string + throw new NotSupportedException(string.Format( + "Data object `{0}` doesn't implement `ITypedDataObject` interface and can't be read" + + " using `TryGetData(string, out T)` method.", + dataObject.GetType().FullName)); + } + + typed = typedDataObject; + return true; + } + /// /// Retrieves a collection of file names from the . /// @@ -239,7 +438,7 @@ public static StringCollection GetFileDropList() { StringCollection result = []; - if (GetData(DataFormats.FileDropConstant, autoConvert: true) is string[] strings) + if (GetTypedDataIfAvailable(DataFormats.FileDropConstant) is string[] strings) { result.AddRange(strings); } @@ -248,9 +447,12 @@ public static StringCollection GetFileDropList() } /// - /// Retrieves an image from the . + /// Retrieves a from the . /// - public static Image? GetImage() => GetData(DataFormats.Bitmap, autoConvert: true) as Image; + /// + /// s are re-hydrated from a by reading a byte array. + /// + public static Image? GetImage() => GetTypedDataIfAvailable(DataFormats.Bitmap); /// /// Retrieves text data from the in the format. @@ -264,7 +466,24 @@ public static StringCollection GetFileDropList() public static string GetText(TextDataFormat format) { SourceGenerated.EnumValidator.Validate(format, nameof(format)); - return GetData(ConvertToDataFormats(format)) as string ?? string.Empty; + + return GetTypedDataIfAvailable(ConvertToDataFormats(format)) is string text ? text : string.Empty; + } + + private static T? GetTypedDataIfAvailable<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>(string format) + { + IDataObject? data = GetDataObject(); + if (data is ITypedDataObject typed) + { + return typed.TryGetData(format, autoConvert: true, out T? value) ? value : default; + } + + if (data is IDataObject dataObject) + { + return dataObject.GetData(format, autoConvert: true) is T value ? value : default; + } + + return default; } /// @@ -281,6 +500,11 @@ public static void SetAudio(Stream audioStream) => /// /// Clears the Clipboard and then adds data in the specified format. /// + /// + /// + /// See remarks for for recommendations on how to implement custom . + /// + /// public static void SetData(string format, object data) { if (string.IsNullOrWhiteSpace(format.OrThrowIfNull())) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.BinaryFormatUtilities.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.BinaryFormatUtilities.cs index 03eb095aa1b..9cd2a56756b 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.BinaryFormatUtilities.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.BinaryFormatUtilities.cs @@ -1,11 +1,16 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Formats.Nrbf; +using System.Private.Windows.Core.BinaryFormat; +using System.Reflection.Metadata; +using System.Runtime.ExceptionServices; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters; using System.Runtime.Serialization.Formatters.Binary; using System.Windows.Forms.BinaryFormat; using System.Windows.Forms.Nrbf; +using System.Windows.Forms.Primitives; namespace System.Windows.Forms; @@ -37,34 +42,101 @@ internal static void WriteObjectToStream(MemoryStream stream, object data, bool throw new SerializationException(string.Format(SR.UnexpectedTypeForClipboardFormat, data.GetType().FullName)); } -#pragma warning disable SYSLIB0011 // Type or member is obsolete - // This check is to help in trimming scenarios with a trim warning on a call to BinaryFormatter.Serialize(), - // which has a RequiresUnreferencedCode annotation. - // If the flag is false, the trimmer will not generate a warning, since BinaryFormatter.Serialize(), will not be called, - // If the flag is true, the trimmer will generate a warning for calling a method that has a RequiresUnreferencedCode annotation. + // This check is to help in trimming scenarios with a trim warning on a call to + // BinaryFormatter.Serialize(), which has a RequiresUnreferencedCode annotation. + // If the flag is false, the trimmer will not generate a warning, since BinaryFormatter.Serialize(), + // will not be called, + // If the flag is true, the trimmer will generate a warning for calling a method that has a + // RequiresUnreferencedCode annotation. if (!EnableUnsafeBinaryFormatterInNativeObjectSerialization) { throw new NotSupportedException(SR.BinaryFormatterNotSupported); } + if (!LocalAppContextSwitches.ClipboardDragDropEnableUnsafeBinaryFormatterSerialization) + { + // TODO (TanyaSo): localize string + throw new NotSupportedException("BinaryFormatter is not supported in Clipboard or drag and drop scenarios."); + } + stream.Position = position; +#pragma warning disable SYSLIB0011 // Type or member is obsolete new BinaryFormatter().Serialize(stream, data); #pragma warning restore SYSLIB0011 } - internal static object ReadObjectFromStream(MemoryStream stream, bool restrictDeserialization) + internal static object? ReadObjectFromStream( + MemoryStream stream, + bool restrictDeserialization, + Func? resolver, + bool legacyMode) { long startPosition = stream.Position; + SerializationRecord? record; + + SerializationBinder binder = new Binder(typeof(T), resolver, legacyMode); + + IReadOnlyDictionary recordMap; try { - if (stream.Decode().TryGetCommonObject(out object? value)) + record = stream.Decode(out recordMap); + } + catch (Exception ex) when (!ex.IsCriticalException()) + { + // Couldn't parse for some reason, let BinaryFormatter handle the legacy invocation. + // The types APIs can't compare the specified type when the root record is not available. + if (legacyMode && LocalAppContextSwitches.ClipboardDragDropEnableUnsafeBinaryFormatterSerialization) + { + if (restrictDeserialization) + { + throw new RestrictedTypeDeserializationException(SR.UnexpectedClipboardType); + } + + stream.Position = startPosition; + return ReadObjectWithBinaryFormatter(stream, binder); + } + + // For example offset arrays throw from the decoder - + // https://learn.microsoft.com/dotnet/api/system.array.createinstance?#system-array-createinstance(system-type-system-int32()-system-int32()) + if (ex is NotSupportedException) + { + throw; + } + + throw ExceptionDispatchInfo.SetRemoteStackTrace( + new NotSupportedException(ex.Message, ex), ex.StackTrace ?? string.Empty); + } + + // For the new TryGet APIs, ensure that the stream contains the requested type, + // or type that can be assigned to the requested type. + if (!legacyMode && !typeof(T).MatchExceptAssemblyVersion(record.TypeName)) + { +#if false // TODO (TanyaSo): - modify TryGetObjectFromJson to take a resolver and rename to HasJsonData??? + // Return true if the payload contains valid JsonData struct, type matches or not + // run IsAssignable in the JSON method + if (record.TryGetObjectFromJson(binder.GetType, out object? data)) { - return value; + return data; + } +#endif + + if (!TypeNameIsAssignableToType(record.TypeName, typeof(T), (ITypeResolver)binder)) + { + // If clipboard contains an exception from SetData, we will get its message and throw. + if (record.TypeName.FullName == typeof(NotSupportedException).FullName + && record.TryGetNotSupportedException(out object? @object) + && @object is NotSupportedException exception) + { + throw new NotSupportedException(exception.Message); + } + + return null; } } - catch (Exception ex) when (!ex.IsCriticalException()) + + if (record.TryGetCommonObject(out object? value)) { - // Couldn't parse for some reason, let the BinaryFormatter try to handle it. + return value; } if (restrictDeserialization) @@ -72,6 +144,52 @@ internal static object ReadObjectFromStream(MemoryStream stream, bool restrictDe throw new RestrictedTypeDeserializationException(SR.UnexpectedClipboardType); } + if (!LocalAppContextSwitches.ClipboardDragDropEnableUnsafeBinaryFormatterSerialization) + { + // TODO (TanyaSo): localize string + throw new NotSupportedException(string.Format( + "BinaryFormatter is not supported in Clipboard or drag and drop scenarios." + + " Enable it and use 'TryGetData' API with a 'resolver'" + + " function that defines a set of allowed types, to deserialize '{0}'.", + typeof(T).FullName)); + } + + // NRBF deserializer is more secure than the BinaryFormatter is: + // 1. Doesn't allow arrays that have a non-zero base index (can't create these in C# or VB) + // 2. Only allows IObjectReference types that contain primitives (to avoid observable cycle + // dependencies to indeterminate state) + // But it usually requires a resolver. + if (LocalAppContextSwitches.ClipboardDragDropEnableNrbfSerialization) + { + try + { + return record.Deserialize(recordMap, (ITypeResolver)binder); + } + catch (Exception ex) when (!ex.IsCriticalException() && legacyMode) + { + } + } + + stream.Position = startPosition; + return ReadObjectWithBinaryFormatter(stream, binder); + } + + private static bool TypeNameIsAssignableToType(TypeName typeName, Type type, ITypeResolver resolver) + { + try + { + return resolver.GetType(typeName)?.IsAssignableTo(type) == true; + } + catch (Exception ex) when (!ex.IsCriticalException()) + { + // Clipboard contains a wrong type, we want the typed API to return false to the caller. + } + + return false; + } + + private static object? ReadObjectWithBinaryFormatter(MemoryStream stream, SerializationBinder binder) + { // This check is to help in trimming scenarios with a trim warning on a call to BinaryFormatter.Deserialize(), // which has a RequiresUnreferencedCode annotation. // If the flag is false, the trimmer will not generate a warning, since BinaryFormatter.Deserialize() will not be called, @@ -81,21 +199,18 @@ internal static object ReadObjectFromStream(MemoryStream stream, bool restrictDe throw new NotSupportedException(SR.BinaryFormatterNotSupported); } - stream.Position = startPosition; - -#pragma warning disable SYSLIB0011 // Type or member is obsolete -#pragma warning disable SYSLIB0050 // Type or member is obsolete +#pragma warning disable SYSLIB0011, SYSLIB0050 // Type or member is obsolete #pragma warning disable CA2300 // Do not use insecure deserializer BinaryFormatter -#pragma warning disable CA2301 // The method 'object BinaryFormatter.Deserialize(Stream serializationStream)' is insecure when deserializing untrusted data without a SerializationBinder to restrict the type of objects in the deserialized object graph. +#pragma warning disable CA2302 // Ensure BinaryFormatter.Binder is set before calling BinaryFormatter.Deserialize // cs/dangerous-binary-deserialization return new BinaryFormatter() { + Binder = binder, AssemblyFormat = FormatterAssemblyStyle.Simple }.Deserialize(stream); // CodeQL[SM03722] : BinaryFormatter is intended to be used as a fallback for unsupported types. Users must explicitly opt into this behavior. #pragma warning restore CA2300 -#pragma warning restore CA2301 -#pragma warning restore SYSLIB0050 -#pragma warning restore SYSLIB0011 +#pragma warning restore CA2302 +#pragma warning restore SYSLIB0050, SYSLIB0011 } } } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.Binder.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.Binder.cs new file mode 100644 index 00000000000..329632b8091 --- /dev/null +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.Binder.cs @@ -0,0 +1,237 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Private.Windows.Core.BinaryFormat; +using System.Reflection.Metadata; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters.Binary; +using Switches = System.Windows.Forms.Primitives.LocalAppContextSwitches; + +namespace System.Windows.Forms; + +public unsafe partial class DataObject +{ + internal unsafe partial class Composition + { + /// + /// A type resolver for use in the when processing binary formatted stream + /// contained in our class using the typed consumption side APIs, such as + /// . This class recognizes primitive types, exchange types from + /// System.Drawing.Primitives, s or arrays of primitive types, and common WinForms types. + /// The user can provide a custom resolver for additional types. If the resolver function is not provided, + /// the parameter specified by the user is resolved automatically. + /// + /// + /// + /// This class is used in and NRBF deserialization. + /// + /// + internal sealed class Binder : SerializationBinder, ITypeResolver + { + private readonly Func? _resolver; + private readonly bool _legacyMode; + + // These types are read from and written to serialized stream manually, accessing record field by field. + // Thus they are re-hydrated with no formatters and are safe. The default resolver should recognize them + // to resolve primitive types or fields of the specified type T. + private static readonly Type[] s_types = + [ + typeof(byte), + typeof(sbyte), + typeof(short), + typeof(ushort), + typeof(int), + typeof(uint), + typeof(long), + typeof(ulong), + typeof(double), + typeof(float), + typeof(char), + typeof(bool), + typeof(string), + typeof(decimal), + typeof(DateTime), + typeof(TimeSpan), + typeof(IntPtr), + typeof(UIntPtr), + typeof(NotSupportedException), + typeof(List), + typeof(List), + typeof(List), + typeof(List), + typeof(List), + typeof(List), + typeof(List), + typeof(List), + typeof(List), + typeof(List), + typeof(List), + typeof(List), + typeof(List), + typeof(List), + typeof(List), + typeof(List), + typeof(byte[]), + typeof(sbyte[]), + typeof(short[]), + typeof(ushort[]), + typeof(int[]), + typeof(uint[]), + typeof(long[]), + typeof(ulong[]), + typeof(float[]), + typeof(double[]), + typeof(char[]), + typeof(bool[]), + typeof(string[]), + typeof(decimal[]), + typeof(DateTime[]), + typeof(TimeSpan[]), + typeof(ImageListStreamer), + typeof(Drawing.Bitmap), + // The following are exchange types, they are serialized with the .NET Framework assembly name. + // In .NET they are located in System.Drawing.Primitives. + typeof(Drawing.RectangleF), + typeof(Drawing.PointF), + typeof(Drawing.SizeF), + typeof(Drawing.Rectangle), + typeof(Drawing.Point), + typeof(Drawing.Size), + typeof(Drawing.Color) + ]; + + private static Dictionary? s_knownTypes; + + private readonly Dictionary _userTypes = new(TypeNameComparer.Default); + + /// + /// Type resolver for use with and NRBF deserializers to restrict types + /// that can be instantiated. + /// + /// that the user expects to read from the binary formatted stream. + /// + /// Provides the list of custom allowed types that user considers safe to deserialize from the payload. + /// Resolver should recognize the closure of all non-primitive and not known types in the payload, + /// such as field types and types in the inheritance hierarchy and the code to match these types to the + /// s read from the deserialized stream. + /// + /// + /// if the user had not requested any specific type, i.e. the call originates from + /// API family, that returns an . + /// if the user had requested a specific type by calling API family. + /// + public Binder(Type type, Func? resolver, bool legacyMode) + { + Debug.Assert(!legacyMode || (legacyMode && resolver is null), "GetData methods should not provide a resolver."); + _resolver = resolver; + _legacyMode = legacyMode; + + if (resolver is null) + { + // Resolver was not provided by the user, we will match the T using our default method: + // 1. If the type is a Value type and nullable, unwrap it + // 2. Check if the type had been forwarded from another assembly + // 3. Match assembly name with no version + // 4. Match namespace and type name + type = Formatter.NullableUnwrap(type.OrThrowIfNull()); + + TypeName typeName = type.ToTypeName(); + + _userTypes.Add(typeName, type); + } + } + + [MemberNotNull(nameof(s_knownTypes))] + private static void InitializeCommonTypes() + { + if (s_knownTypes is not null) + { + return; + } + + s_knownTypes = new(TypeNameComparer.Default); + + foreach (Type type in s_types) + { + s_knownTypes.Add(type.ToTypeName(), type); + } + } + + public override Type? BindToType(string assemblyName, string typeName) + { + ArgumentException.ThrowIfNullOrWhiteSpace(assemblyName); + ArgumentException.ThrowIfNullOrWhiteSpace(typeName); + + if (GetCachedType(assemblyName, typeName, typeName: null) is Type type) + { + return type; + } + + if (_legacyMode) + { + // TODO (TanyaSo): localize string + return Switches.ClipboardDragDropEnableUnsafeBinaryFormatterSerialization + ? null + : throw new NotSupportedException(string.Format( + "BinaryFormatter is not supported in Clipboard or drag and drop scenarios." + + " Enable it and use 'TryGetData' API with a 'resolver'" + + " function that defines a set of allowed types, to deserialize '{0}'.", + $"{assemblyName}.{typeName}")); + } + + TypeName parsed = TypeName.Parse($"{typeName}, {assemblyName}"); + return UseResolver(parsed); + } + + [RequiresUnreferencedCode("Calls user-provided method that resolves types from names.")] + [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] + private Type UseResolver(TypeName typeName) + { + if (_resolver is null) + { + // TODO (TanyaSo): localize string + throw new NotSupportedException(string.Format( + "Use 'TryGetData' method with a 'resolver' function that defines a set of allowed types, to deserialize '{0}'.", + typeName.AssemblyQualifiedName)); + } + + // This helper method is called after we verified that _resolver is not null. + Type resolved = _resolver!(typeName) + ?? throw new NotSupportedException(string.Format( + "'resolver' function provided in 'TryGetData' method should not return a null. " + + "It should throw a 'System.NotSupportedException' when encountering unsupported types, " + + "unless type {0} is one of the allowed types, then the 'Type' should be returned.", + typeName.AssemblyQualifiedName)); + + _userTypes.Add(typeName, resolved); + return resolved; + } + + private Type? GetCachedType(string assemblyName, string fullTypeName, TypeName? typeName) + { + InitializeCommonTypes(); + + typeName ??= TypeName.Parse($"{fullTypeName}, {assemblyName}"); + + return s_knownTypes.TryGetValue(typeName, out Type? type) + ? type + : _userTypes.TryGetValue(typeName, out type) ? type : null; + } + + [RequiresUnreferencedCode("Calls System.Reflection.Assembly.GetType(String)")] + [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] + public Type GetType(TypeName typeName) + { + typeName.OrThrowIfNull(); + + if (typeName.AssemblyName is not AssemblyNameInfo info + || info.FullName is not string fullName) + { + throw new ArgumentException(message: null, nameof(typeName)); + } + + return GetCachedType(fullName, typeName.FullName, typeName) is Type type ? type : UseResolver(typeName); + } + } + } +} diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs index a858fac42eb..4b06049b562 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Drawing; +using System.Reflection.Metadata; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; using System.Text; @@ -16,7 +17,7 @@ internal unsafe partial class Composition /// /// Maps native pointer to . /// - private unsafe class NativeToWinFormsAdapter : IDataObject, Com.IDataObject.Interface + private unsafe class NativeToWinFormsAdapter : ITypedDataObject, Com.IDataObject.Interface { private readonly AgileComPointer _nativeDataObject; @@ -90,31 +91,49 @@ HRESULT Com.IDataObject.Interface.SetData(Com.FORMATETC* pformatetc, Com.STGMEDI /// /// Retrieves the specified format from the specified . /// - private static object? GetDataFromHGLOBAL(HGLOBAL hglobal, string format) + private static bool TryGetDataFromHGLOBAL( + HGLOBAL hglobal, + string format, + Func? resolver, + bool legacyMode, + [NotNullWhen(true)] out T? data) { + data = default; if (hglobal == 0) { - return null; + return false; } - return format switch + object? value = format switch { - DataFormats.TextConstant or DataFormats.RtfConstant or DataFormats.OemTextConstant - => ReadStringFromHGLOBAL(hglobal, unicode: false), + DataFormats.TextConstant or DataFormats.RtfConstant or DataFormats.OemTextConstant => + ReadStringFromHGLOBAL(hglobal, unicode: false), DataFormats.HtmlConstant => ReadUtf8StringFromHGLOBAL(hglobal), DataFormats.UnicodeTextConstant => ReadStringFromHGLOBAL(hglobal, unicode: true), DataFormats.FileDropConstant => ReadFileListFromHDROP((HDROP)(nint)hglobal), CF_DEPRECATED_FILENAME => new string[] { ReadStringFromHGLOBAL(hglobal, unicode: false) }, CF_DEPRECATED_FILENAMEW => new string[] { ReadStringFromHGLOBAL(hglobal, unicode: true) }, - _ => ReadObjectFromHGLOBAL(hglobal, RestrictDeserializationToSafeTypes(format)) + _ => ReadObjectOrStreamFromHGLOBAL(hglobal, RestrictDeserializationToSafeTypes(format), resolver, legacyMode) }; - static object ReadObjectFromHGLOBAL(HGLOBAL hglobal, bool restrictDeserialization) + if (value is T t) + { + data = t; + return true; + } + + return false; + + static object? ReadObjectOrStreamFromHGLOBAL( + HGLOBAL hglobal, + bool restrictDeserialization, + Func? resolver, + bool legacyMode) { MemoryStream stream = ReadByteStreamFromHGLOBAL(hglobal, out bool isSerializedObject); return !isSerializedObject ? stream - : BinaryFormatUtilities.ReadObjectFromStream(stream, restrictDeserialization); + : BinaryFormatUtilities.ReadObjectFromStream(stream, restrictDeserialization, resolver, legacyMode); } } @@ -215,144 +234,186 @@ private static unsafe string ReadUtf8StringFromHGLOBAL(HGLOBAL hglobal) /// /// A restricted type was encountered, do not continue trying to deserialize. /// - private static object? GetObjectFromDataObject(Com.IDataObject* dataObject, string format, out bool doNotContinue) + /// + /// + /// if the managed object of was successfully + /// created, if the payload does not contain the specified format or the specified type. + /// + /// + /// If contains that contains a serialized object, + /// we return that object cast to or null. If that is + /// not a serialized object, and a stream was requested, i.e. can be assigned to + /// we return that . + /// + /// + /// is deserialization failed. + private static bool TryGetObjectFromDataObject( + Com.IDataObject* dataObject, + string format, + Func? resolver, + bool legacyMode, + out bool doNotContinue, + [NotNullWhen(true)] out T? data) { - object? data = null; + data = default; doNotContinue = false; + bool result = false; + try { // Try to get the data as a bitmap first. - data = TryGetBitmapData(dataObject, format); - - // Check for one of our standard data types. - data ??= TryGetHGLOBALData(dataObject, format, out doNotContinue); + if ((typeof(Bitmap) == typeof(T) || typeof(Image) == typeof(T)) + && TryGetBitmapData(dataObject, format, out Bitmap? bitmap)) + { + data = (T)(object)bitmap; + return true; + } - if (data is null && !doNotContinue) + result = TryGetHGLOBALData(dataObject, format, resolver, legacyMode, out doNotContinue, out data); + if (!result && !doNotContinue) { // Lastly check to see if the data is an IStream. - data = TryGetIStreamData(dataObject, format); + result = TryGetIStreamData(dataObject, format, resolver, legacyMode, out data); } } - catch (Exception e) + catch (Exception e) when (e is not NotSupportedException) { Debug.Fail(e.ToString()); } - return data; + return result; + } - static object? TryGetHGLOBALData(Com.IDataObject* dataObject, string format, out bool doNotContinue) - { - doNotContinue = false; + private static bool TryGetHGLOBALData( + Com.IDataObject* dataObject, + string format, + Func? resolver, + bool legacyMode, + out bool doNotContinue, + [NotNullWhen(true)] out T? data) + { + data = default; + doNotContinue = false; - Com.FORMATETC formatetc = new() - { - cfFormat = (ushort)DataFormats.GetFormat(format).Id, - dwAspect = (uint)Com.DVASPECT.DVASPECT_CONTENT, - lindex = -1, - tymed = (uint)Com.TYMED.TYMED_HGLOBAL - }; + Com.FORMATETC formatetc = new() + { + cfFormat = (ushort)DataFormats.GetFormat(format).Id, + dwAspect = (uint)Com.DVASPECT.DVASPECT_CONTENT, + lindex = -1, + tymed = (uint)Com.TYMED.TYMED_HGLOBAL + }; - if (dataObject->QueryGetData(formatetc).Failed) - { - return null; - } + if (dataObject->QueryGetData(formatetc).Failed) + { + return false; + } - object? data = null; - HRESULT hr = dataObject->GetData(formatetc, out Com.STGMEDIUM medium); + HRESULT hr = dataObject->GetData(formatetc, out Com.STGMEDIUM medium); - // One of the ways this can happen is when we attempt to put binary formatted data onto the - // clipboard, which will succeed as Windows ignores all errors when putting data on the clipboard. - // The data state, however, is not good, and this error will be returned by Windows when asking to - // get the data out. - Debug.WriteLineIf(hr == HRESULT.CLIPBRD_E_BAD_DATA, "CLIPBRD_E_BAD_DATA returned when trying to get clipboard data."); - Debug.WriteLineIf(hr == HRESULT.DV_E_TYMED, "DV_E_TYMED returned when trying to get clipboard data."); - // This happens in copy == false case when the managed type does not have the [Serializable] attribute. - Debug.WriteLineIf(hr == HRESULT.E_UNEXPECTED, "E_UNEXPECTED returned when trying to get clipboard data."); - Debug.WriteLineIf(hr == HRESULT.COR_E_SERIALIZATION, - "COR_E_SERIALIZATION returned when trying to get clipboard data, for example, BinaryFormatter threw SerializationException."); + // One of the ways this can happen is when we attempt to put binary formatted data onto the + // clipboard, which will succeed as Windows ignores all errors when putting data on the clipboard. + // The data state, however, is not good, and this error will be returned by Windows when asking to + // get the data out. + Debug.WriteLineIf(hr == HRESULT.CLIPBRD_E_BAD_DATA, "CLIPBRD_E_BAD_DATA returned when trying to get clipboard data."); + Debug.WriteLineIf(hr == HRESULT.DV_E_TYMED, "DV_E_TYMED returned when trying to get clipboard data."); + // This happens in copy == false case when the managed type does not have the [Serializable] attribute. + Debug.WriteLineIf(hr == HRESULT.E_UNEXPECTED, "E_UNEXPECTED returned when trying to get clipboard data."); + Debug.WriteLineIf(hr == HRESULT.COR_E_SERIALIZATION, + "COR_E_SERIALIZATION returned when trying to get clipboard data, for example, BinaryFormatter threw SerializationException."); - try - { - if (medium.tymed == Com.TYMED.TYMED_HGLOBAL && !medium.hGlobal.IsNull && hr != HRESULT.COR_E_SERIALIZATION) - { - data = GetDataFromHGLOBAL(medium.hGlobal, format); - } - } - catch (RestrictedTypeDeserializationException) - { - doNotContinue = true; - } - catch - { - } - finally + bool result = false; + try + { + if (medium.tymed == Com.TYMED.TYMED_HGLOBAL && !medium.hGlobal.IsNull && hr != HRESULT.COR_E_SERIALIZATION) { - PInvoke.ReleaseStgMedium(ref medium); + result = TryGetDataFromHGLOBAL(medium.hGlobal, format, resolver, legacyMode, out data); } + } + catch (RestrictedTypeDeserializationException) + { + result = false; + data = default; + doNotContinue = true; + } + catch (Exception ex) when (ex is not NotSupportedException) + { + // Should we catch SerializationExceptions that wrap NotSupported when called from the typed API? + Debug.WriteLine(ex.ToString()); + } + finally + { + PInvoke.ReleaseStgMedium(ref medium); + } + + return result; + } - return data; + private static unsafe bool TryGetIStreamData( + Com.IDataObject* dataObject, + string format, + Func? resolver, + bool legacyMode, + [NotNullWhen(true)] out T? data) + { + data = default; + Com.FORMATETC formatEtc = new() + { + cfFormat = (ushort)DataFormats.GetFormat(format).Id, + dwAspect = (uint)Com.DVASPECT.DVASPECT_CONTENT, + lindex = -1, + tymed = (uint)Com.TYMED.TYMED_ISTREAM + }; + + // Limit the # of exceptions we may throw below. + if (dataObject->QueryGetData(formatEtc).Failed + || dataObject->GetData(formatEtc, out Com.STGMEDIUM medium).Failed) + { + return false; } - static unsafe object? TryGetIStreamData(Com.IDataObject* dataObject, string format) + HGLOBAL hglobal = default; + try { - Com.FORMATETC formatEtc = new() - { - cfFormat = (ushort)DataFormats.GetFormat(format).Id, - dwAspect = (uint)Com.DVASPECT.DVASPECT_CONTENT, - lindex = -1, - tymed = (uint)Com.TYMED.TYMED_ISTREAM - }; - - // Limit the # of exceptions we may throw below. - if (dataObject->QueryGetData(formatEtc).Failed - || dataObject->GetData(formatEtc, out Com.STGMEDIUM medium).Failed) + if (medium.tymed != Com.TYMED.TYMED_ISTREAM || medium.hGlobal.IsNull) { - return null; + return false; } - HGLOBAL hglobal = default; - try - { - if (medium.tymed != Com.TYMED.TYMED_ISTREAM || medium.hGlobal.IsNull) - { - return null; - } - - using ComScope pStream = new((Com.IStream*)medium.hGlobal); - pStream.Value->Stat(out Com.STATSTG sstg, (uint)Com.STATFLAG.STATFLAG_DEFAULT); + using ComScope pStream = new((Com.IStream*)medium.hGlobal); + pStream.Value->Stat(out Com.STATSTG sstg, (uint)Com.STATFLAG.STATFLAG_DEFAULT); - hglobal = PInvokeCore.GlobalAlloc(GLOBAL_ALLOC_FLAGS.GMEM_MOVEABLE | GLOBAL_ALLOC_FLAGS.GMEM_ZEROINIT, (uint)sstg.cbSize); + hglobal = PInvokeCore.GlobalAlloc(GLOBAL_ALLOC_FLAGS.GMEM_MOVEABLE | GLOBAL_ALLOC_FLAGS.GMEM_ZEROINIT, (uint)sstg.cbSize); - // Not throwing here because the other out of memory condition on GlobalAlloc - // happens inside innerData.GetData and gets turned into a null return value. - if (hglobal.IsNull) - { - return null; - } + // Not throwing here because the other out of memory condition on GlobalAlloc + // happens inside innerData.GetData and gets turned into a null return value. + if (hglobal.IsNull) + { + return false; + } - void* ptr = PInvokeCore.GlobalLock(hglobal); - pStream.Value->Read((byte*)ptr, (uint)sstg.cbSize, null); - PInvokeCore.GlobalUnlock(hglobal); + void* ptr = PInvokeCore.GlobalLock(hglobal); + pStream.Value->Read((byte*)ptr, (uint)sstg.cbSize, null); + PInvokeCore.GlobalUnlock(hglobal); - return GetDataFromHGLOBAL(hglobal, format); - } - finally + return TryGetDataFromHGLOBAL(hglobal, format, resolver, legacyMode, out data); + } + finally + { + if (!hglobal.IsNull) { - if (!hglobal.IsNull) - { - PInvokeCore.GlobalFree(hglobal); - } - - PInvoke.ReleaseStgMedium(ref medium); + PInvokeCore.GlobalFree(hglobal); } + + PInvoke.ReleaseStgMedium(ref medium); } } - private static Image? TryGetBitmapData(Com.IDataObject* dataObject, string format) + private static bool TryGetBitmapData(Com.IDataObject* dataObject, string format, [NotNullWhen(true)] out Bitmap? data) { + data = default; if (format != DataFormats.BitmapConstant) { - return null; + return false; } Com.FORMATETC formatEtc = new() @@ -375,18 +436,17 @@ private static unsafe string ReadUtf8StringFromHGLOBAL(HGLOBAL hglobal) Debug.WriteLineIf(hr == HRESULT.CLIPBRD_E_BAD_DATA, "CLIPBRD_E_BAD_DATA returned when trying to get clipboard data."); } - Image? data = null; - try { // GDI+ doesn't own this HBITMAP, but we can't delete it while the object is still around. So we // have to do the really expensive thing of cloning the image so we can release the HBITMAP. if ((uint)medium.tymed == (uint)TYMED.TYMED_GDI && !medium.hGlobal.IsNull - && Image.FromHbitmap(medium.hGlobal) is Image clipboardImage) + && Image.FromHbitmap(medium.hGlobal) is Bitmap clipboardBitmap) { - data = (Image)clipboardImage.Clone(); - clipboardImage.Dispose(); + data = (Bitmap)clipboardBitmap.Clone(); + clipboardBitmap.Dispose(); + return true; } } finally @@ -394,50 +454,116 @@ private static unsafe string ReadUtf8StringFromHGLOBAL(HGLOBAL hglobal) PInvoke.ReleaseStgMedium(ref medium); } - return data; + return false; } - #region IDataObject - public object? GetData(string format, bool autoConvert) + private static void ThrowIfFormatAndTypeRequireResolver(string format) { + // Restricted format is either read directly from the HGLOBAL or serialization record is read manually. + if (!IsRestrictedFormat(format) + // This check is a convenience for simple usages if TryGetData APIs that don't take the resolver. + && IsUnboundedType()) + { + // TODO (TanyaSo): localize string + throw new NotSupportedException(string.Format( + "'{0}' is not a concrete type, and could allow for unbounded deserialization. Use a concrete type" + + " or define a resolver function that supports types that you are retrieving from the Clipboard" + + " or being dragged and dropped.", + typeof(T).FullName)); + } + + static bool IsUnboundedType() + { + if (typeof(T) == typeof(object)) + { + return true; + } + + Type type = typeof(T); + // Image is a special case because we are reading Bitmaps directly from the SerializationRecord. + return type.IsInterface || (typeof(T) != typeof(Image) && type.IsAbstract); + } + + static bool IsRestrictedFormat(string format) => RestrictDeserializationToSafeTypes(format) + || format is DataFormats.TextConstant + or DataFormats.UnicodeTextConstant + or DataFormats.RtfConstant + or DataFormats.HtmlConstant + or DataFormats.OemTextConstant + or DataFormats.FileDropConstant + or CF_DEPRECATED_FILENAME + or CF_DEPRECATED_FILENAMEW; + } + + private bool TryGetDataInternal( + string format, + Func? resolver, + bool autoConvert, + bool legacyMode, + [NotNullWhen(true)] out T? data) + { + data = default; + if (!legacyMode && resolver is null) + { + // DataObject.GetData methods do not validate format string, but the typed methods do. + // This validation is specific to the WinForms DataObject implementation, it's not executed for + // overridden methods. + ThrowIfFormatAndTypeRequireResolver(format); + } + using var nativeDataObject = _nativeDataObject.GetInterface(); - object? data = GetObjectFromDataObject(nativeDataObject, format, out bool doNotContinue); - if (doNotContinue - || !autoConvert - || (data is not null && data is not MemoryStream) - || GetMappedFormats(format) is not { } mappedFormats) + bool result = TryGetObjectFromDataObject( + nativeDataObject, format, resolver, legacyMode, out bool doNotContinue, out data); + + if (doNotContinue) { - return data; + // Specified format is a restricted one, as only restricted formats set doNotContinue, + // but content required BinaryFormatter deserialization, as doNotContinue is set when + // BinaryFormatter fails, legacy methods return null. + data = default; + return false; } - object? originalData = data; + if (result || !autoConvert || GetMappedFormats(format) is not { } mappedFormats) + { + return result; + } // Try to find a mapped format that works better. foreach (string mappedFormat in mappedFormats) { - if (!format.Equals(mappedFormat)) + if (format.Equals(mappedFormat)) { - data = GetObjectFromDataObject(nativeDataObject, mappedFormat, out doNotContinue); - if (doNotContinue) - { - break; - } + continue; + } - if (data is not null and not MemoryStream) - { - return data; - } + result = TryGetObjectFromDataObject( + nativeDataObject, mappedFormat, resolver, legacyMode, out doNotContinue, out data); + if (doNotContinue) + { + Debug.Fail("All mapped formats must be either restricted or not restricted."); + break; + } + + if (result) + { + return result; } } - return originalData ?? data; + return result; } - public object? GetData(string format) => GetData(format, autoConvert: true); + #region IDataObject + public object? GetData(string format, bool autoConvert) + { + TryGetDataInternal(format, resolver: null, autoConvert, legacyMode: true, out object? data); + return data; + } + public object? GetData(string format) => GetData(format, autoConvert: true); public object? GetData(Type format) => GetData(format.FullName!); - public bool GetDataPresent(Type format) => GetDataPresent(format.FullName!); public bool GetDataPresent(string format, bool autoConvert) @@ -512,6 +638,30 @@ public void SetData(Type format, object? data) { } public void SetData(object? data) { } #endregion + #region ITypedDataObject + public bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + string format, + Func resolver, + bool autoConvert, + [NotNullWhen(true), MaybeNullWhen(false)] out T data) => + TryGetDataInternal(format, resolver, autoConvert, legacyMode: false, out data); + + public bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + string format, + bool autoConvert, + [NotNullWhen(true), MaybeNullWhen(false)] out T data) => + TryGetDataInternal(format, resolver: null!, autoConvert, legacyMode: false, out data); + + public bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + string format, + [NotNullWhen(true), MaybeNullWhen(false)] out T data) => + TryGetDataInternal(format, resolver: null!, autoConvert: false, legacyMode: false, out data); + + public bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + [NotNullWhen(true), MaybeNullWhen(false)] out T data) => + TryGetDataInternal(typeof(T).FullName!, resolver: null!, autoConvert: false, legacyMode: false, out data); + #endregion + private bool GetDataPresentInner(string format) { Com.FORMATETC formatEtc = new() diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.TypeNameComparer.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.TypeNameComparer.cs new file mode 100644 index 00000000000..c1a8f1e3857 --- /dev/null +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.TypeNameComparer.cs @@ -0,0 +1,89 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Reflection.Metadata; + +namespace System.Windows.Forms; +public unsafe partial class DataObject +{ + internal unsafe partial class Composition + { + /// + /// Match s by matching full namespace-qualified type names and full assembly names, + /// including the version. + /// + internal sealed class TypeNameComparer : IEqualityComparer + { + private TypeNameComparer() + { + } + + internal static IEqualityComparer Default { get; } = new TypeNameComparer(); + + public bool Equals(TypeName? x, TypeName? y) + { + if (x is null && y is null) + { + return true; + } + + if (x is null || y is null) + { + return false; + } + + return x.Matches(y); + } + + public int GetHashCode(TypeName obj) + { + if (obj is null) + { + return 0; + } + + if (obj.IsArray) + { + return true.GetHashCode() ^ obj.GetArrayRank() ^ GetHashCode(obj.GetElementType()); + } + + int hashCode; + if (obj.IsConstructedGenericType) + { + hashCode = "constructed".GetHashCode() ^ GetHashCode(obj.GetGenericTypeDefinition()); + foreach (TypeName genericName in obj.GetGenericArguments()) + { + hashCode ^= GetHashCode(genericName); + } + + return hashCode; + } + + hashCode = obj.FullName.GetHashCode(); + if (obj.AssemblyName is AssemblyNameInfo info) + { + hashCode ^= info.Name.GetHashCode(); + if (info.Version is not null) + { + hashCode ^= info.Version.GetHashCode(); + } + + if (info.CultureName is not null) + { + hashCode ^= info.CultureName.GetHashCode(); + } + + if (!info.PublicKeyOrToken.IsDefaultOrEmpty) + { + foreach (byte b in info.PublicKeyOrToken) + { + hashCode ^= b.GetHashCode(); + } + } + } + + return hashCode; + } + } + } +} diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.cs index 2e292aba765..0664661edae 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Reflection.Metadata; using System.Runtime.InteropServices.ComTypes; using Com = Windows.Win32.System.Com; using ComTypes = System.Runtime.InteropServices.ComTypes; @@ -13,7 +14,7 @@ public unsafe partial class DataObject /// Contains the logic to move between , , /// and calls. /// - internal unsafe partial class Composition : IDataObject, Com.IDataObject.Interface, ComTypes.IDataObject + internal unsafe partial class Composition : ITypedDataObject, Com.IDataObject.Interface, ComTypes.IDataObject { private const Com.TYMED AllowedTymeds = Com.TYMED.TYMED_HGLOBAL | Com.TYMED.TYMED_ISTREAM | Com.TYMED.TYMED_GDI; @@ -118,6 +119,30 @@ or DataFormats.PaletteConstant public void SetData(object? data) => _winFormsDataObject.SetData(data); #endregion + #region ITypedDataObject + public bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + string format, + Func resolver, + bool autoConvert, + [NotNullWhen(true), MaybeNullWhen(false)] out T data) => + _winFormsDataObject.TryGetData(format, resolver, autoConvert, out data); + + public bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + string format, + bool autoConvert, + [NotNullWhen(true), MaybeNullWhen(false)] out T data) => + _winFormsDataObject.TryGetData(format, resolver: null!, autoConvert, out data); + + public bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + string format, + [NotNullWhen(true), MaybeNullWhen(false)] out T data) => + _winFormsDataObject.TryGetData(format, resolver: null!, autoConvert: false, out data); + + public bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + [NotNullWhen(true), MaybeNullWhen(false)] out T data) => + _winFormsDataObject.TryGetData(typeof(T).FullName!, resolver: null!, autoConvert: false, out data); + #endregion + #region Com.IDataObject.Interface public HRESULT DAdvise(Com.FORMATETC* pformatetc, uint advf, Com.IAdviseSink* pAdvSink, uint* pdwConnection) => _nativeDataObject.DAdvise(pformatetc, advf, pAdvSink, pdwConnection); public HRESULT DUnadvise(uint dwConnection) => _nativeDataObject.DUnadvise(dwConnection); diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.DataStore.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.DataStore.cs index 67858579e99..00a26e8d327 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.DataStore.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.DataStore.cs @@ -3,58 +3,62 @@ using System.Collections.Specialized; using System.Drawing; +using System.Reflection.Metadata; using System.Runtime.Serialization; namespace System.Windows.Forms; public partial class DataObject { - private sealed partial class DataStore : IDataObject + private sealed partial class DataStore : ITypedDataObject { private readonly Dictionary _mappedData = new(BackCompatibleStringComparer.Default); - public object? GetData(string format, bool autoConvert) + private bool TryGetDataInternal( + string format, + bool autoConvert, + [NotNullWhen(true), MaybeNullWhen(false)] out T data) { + data = default; if (string.IsNullOrWhiteSpace(format)) { - return null; + return false; } - object? baseVar = null; - if (_mappedData.TryGetValue(format, out DataStoreEntry? dse)) + if (_mappedData.TryGetValue(format, out DataStoreEntry? dse) && dse.Data is T t) { - baseVar = dse.Data; + data = t; + return true; } - object? original = baseVar; + if (!autoConvert + || (dse is not null && !dse.AutoConvert) + || GetMappedFormats(format) is not { } mappedFormats) + { + return false; + } - if (autoConvert - && (dse is null || dse.AutoConvert) - && (baseVar is null || baseVar is MemoryStream)) + for (int i = 0; i < mappedFormats.Length; i++) { - string[]? mappedFormats = GetMappedFormats(format); - if (mappedFormats is not null) + if (format.Equals(mappedFormats[i])) { - for (int i = 0; i < mappedFormats.Length; i++) - { - if (!format.Equals(mappedFormats[i])) - { - if (_mappedData.TryGetValue(mappedFormats[i], out DataStoreEntry? found)) - { - baseVar = found.Data; - } - - if (baseVar is not null and not MemoryStream) - { - original = null; - break; - } - } - } + continue; + } + + if (_mappedData.TryGetValue(mappedFormats[i], out DataStoreEntry? found) && found.Data is T value) + { + data = value; + return true; } } - return original ?? baseVar; + return false; + } + + public object? GetData(string format, bool autoConvert) + { + TryGetDataInternal(format, autoConvert, out object? data); + return data; } public object? GetData(string format) => GetData(format, autoConvert: true); @@ -74,14 +78,7 @@ public void SetData(string format, bool autoConvert, object? data) // and let the system provide the conversion for us. if (data is Bitmap && format.Equals(DataFormats.Dib)) { - if (autoConvert) - { - format = DataFormats.Bitmap; - } - else - { - throw new NotSupportedException(SR.DataObjectDibNotSupported); - } + format = autoConvert ? DataFormats.Bitmap : throw new NotSupportedException(SR.DataObjectDibNotSupported); } _mappedData[format] = new DataStoreEntry(data, autoConvert); @@ -181,5 +178,27 @@ public string[] GetFormats(bool autoConvert) } public string[] GetFormats() => GetFormats(autoConvert: true); + + public bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + string format, + Func resolver, + bool autoConvert, + [NotNullWhen(true), MaybeNullWhen(false)] out T data) => + TryGetDataInternal(format, autoConvert, out data); + + public bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + string format, + bool autoConvert, + [NotNullWhen(true), MaybeNullWhen(false)] out T data) => + TryGetDataInternal(format, autoConvert, out data); + + public bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + string format, + [NotNullWhen(true), MaybeNullWhen(false)] out T data) => + TryGetDataInternal(format, autoConvert: false, out data); + + public bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + [NotNullWhen(true), MaybeNullWhen(false)] out T data) => + TryGetDataInternal(typeof(T).FullName!, autoConvert: false, out data); } } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs index fad22a38131..b1a303a99fe 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs @@ -3,6 +3,7 @@ using System.Collections.Specialized; using System.Drawing; +using System.Reflection.Metadata; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; using Com = Windows.Win32.System.Com; @@ -15,7 +16,7 @@ namespace System.Windows.Forms; /// [ClassInterface(ClassInterfaceType.None)] public unsafe partial class DataObject : - IDataObject, + ITypedDataObject, Com.IDataObject.Interface, ComTypes.IDataObject, Com.IManagedWrapper @@ -30,19 +31,27 @@ public unsafe partial class DataObject : /// Initializes a new instance of the class, with the raw /// and the managed data object the raw pointer is associated with. /// + /// internal DataObject(Com.IDataObject* data) => _innerData = Composition.CreateFromNativeDataObject(data); /// /// Initializes a new instance of the class, which can store arbitrary data. /// - public DataObject() - { - _innerData = Composition.CreateFromWinFormsDataObject(new DataStore()); - } + /// + public DataObject() => _innerData = Composition.CreateFromWinFormsDataObject(new DataStore()); /// /// Initializes a new instance of the class, containing the specified data. /// + /// + /// + /// If implements an interface, + /// we strongly recommend implementing interface to support the + /// `TryGetData{T}` API family that restricts deserialization to the requested and known types. + /// will throw + /// if is not implemented. + /// + /// public DataObject(object data) { if (data is DataObject dataObject) @@ -92,10 +101,25 @@ internal IDataObject TryUnwrapInnerIDataObject() internal IDataObject? OriginalIDataObject => _innerData.OriginalIDataObject; #region IDataObject + [Obsolete( + Obsoletions.DataObjectGetDataMessage, + error: false, + DiagnosticId = Obsoletions.ClipboardGetDataDiagnosticId, + UrlFormat = Obsoletions.SharedUrlFormat)] public virtual object? GetData(string format, bool autoConvert) => _innerData.GetData(format, autoConvert); + [Obsolete( + Obsoletions.DataObjectGetDataMessage, + error: false, + DiagnosticId = Obsoletions.ClipboardGetDataDiagnosticId, + UrlFormat = Obsoletions.SharedUrlFormat)] public virtual object? GetData(string format) => GetData(format, autoConvert: true); + [Obsolete( + Obsoletions.DataObjectGetDataMessage, + error: false, + DiagnosticId = Obsoletions.ClipboardGetDataDiagnosticId, + UrlFormat = Obsoletions.SharedUrlFormat)] public virtual object? GetData(Type format) => format is null ? null : GetData(format.FullName!); public virtual bool GetDataPresent(string format, bool autoConvert) => _innerData.GetDataPresent(format, autoConvert); @@ -118,6 +142,48 @@ public virtual void SetData(string format, bool autoConvert, object? data) => public virtual void SetData(object? data) => _innerData.SetData(data); #endregion + #region ITypedDataObject + [CLSCompliant(false)] + public bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + string format, + Func resolver, + bool autoConvert, + [NotNullWhen(true), MaybeNullWhen(false)] out T data) + { + data = default; + resolver.OrThrowIfNull(); + + return TryGetDataInternal(format, resolver, autoConvert, out data); + } + + public bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + string format, + bool autoConvert, + [NotNullWhen(true), MaybeNullWhen(false)] out T data) => + TryGetDataInternal(format, resolver: null, autoConvert, out data); + + public bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + string format, + [NotNullWhen(true), MaybeNullWhen(false)] out T data) => + TryGetDataInternal(format, resolver: null, autoConvert: false, out data); + + public bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + [NotNullWhen(true), MaybeNullWhen(false)] out T data) => + TryGetDataInternal(typeof(T).FullName!, resolver: null, autoConvert: false, out data); + #endregion + + /// + /// Override this method in the derived class to provide custom data retrieval logic using the typed APIs. + /// + /// + [CLSCompliant(false)] + protected virtual bool TryGetDataCore<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + string format, + Func? resolver, + bool autoConvert, + [NotNullWhen(true), MaybeNullWhen(false)] out T data) => + _innerData.TryGetData(format, resolver!, autoConvert, out data); + public virtual bool ContainsAudio() => GetDataPresent(DataFormats.WaveAudioConstant, autoConvert: false); public virtual bool ContainsFileDropList() => GetDataPresent(DataFormats.FileDropConstant, autoConvert: true); @@ -133,6 +199,7 @@ public virtual bool ContainsText(TextDataFormat format) return GetDataPresent(ConvertToDataFormats(format), autoConvert: false); } +#pragma warning disable WFDEV005 // Type or member is obsolete public virtual Stream? GetAudioStream() => GetData(DataFormats.WaveAudio, autoConvert: false) as Stream; public virtual StringCollection GetFileDropList() @@ -154,6 +221,7 @@ public virtual string GetText(TextDataFormat format) SourceGenerated.EnumValidator.Validate(format, nameof(format)); return GetData(ConvertToDataFormats(format), autoConvert: false) is string text ? text : string.Empty; } +#pragma warning restore WFDEV005 public virtual string GetText() => GetText(TextDataFormat.UnicodeText); @@ -183,6 +251,63 @@ public virtual void SetText(string textData, TextDataFormat format) SetData(ConvertToDataFormats(format), false, textData); } + private bool TryGetDataInternal<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + string format, + Func? resolver, + bool autoConvert, + [NotNullWhen(true), MaybeNullWhen(false)] out T data) + { + data = default; + + if (!IsValidFormatAndType(format)) + { + // Resolver implementation is specific to the overridden TryGetDataCore method, + // can't validate if a non-null resolver is required for unbounded types. + return false; + } + + return TryGetDataCore(format, resolver, autoConvert, out data); + } + + /// + /// Verify if the specified format is valid and compatible with the specified type . + /// + internal static bool IsValidFormatAndType(string format) + { + if (string.IsNullOrWhiteSpace(format)) + { + return false; + } + + if (IsValidPredefinedFormatTypeCombination(format)) + { + return true; + } + + // TODO (TanyaSo): localize string + throw new NotSupportedException(string.Format( + "Type '{0}' is not compatible with the specified format '{1}'.", + typeof(T).FullName, format)); + + static bool IsValidPredefinedFormatTypeCombination(string format) => format switch + { + DataFormats.TextConstant + or DataFormats.UnicodeTextConstant + or DataFormats.StringConstant + or DataFormats.RtfConstant + or DataFormats.HtmlConstant + or DataFormats.OemTextConstant => typeof(string) == typeof(T), + + DataFormats.FileDropConstant + or CF_DEPRECATED_FILENAME + or CF_DEPRECATED_FILENAMEW => typeof(string[]) == typeof(T), + + DataFormats.BitmapConstant or BitmapFullName => + typeof(Bitmap) == typeof(T) || typeof(Image) == typeof(T), + _ => true + }; + } + private static string ConvertToDataFormats(TextDataFormat format) => format switch { TextDataFormat.UnicodeText => DataFormats.UnicodeTextConstant, diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObjectExtensions.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObjectExtensions.cs new file mode 100644 index 00000000000..b9d43ef6948 --- /dev/null +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObjectExtensions.cs @@ -0,0 +1,64 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Windows.Forms; + +/// +/// Extension methods for data objects. +/// +public static class DataObjectExtensions +{ + private static ITypedDataObject GetTypedDataObjectOrThrow(IDataObject dataObject) + { + ArgumentNullException.ThrowIfNull(dataObject); + + if (dataObject is not ITypedDataObject typed) + { + // TODO (TanyaSo) : localize string + throw new NotSupportedException(string.Format( + "Data object({0}) should implement 'ITypedDataObject' interface to support 'TryGetData methods.", + dataObject.GetType().FullName)); + } + + return typed; + } + + /// + /// if the does not implement . + /// if the is + public static bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + this IDataObject dataObject, + [NotNullWhen(true), MaybeNullWhen(false)] out T data) => + GetTypedDataObjectOrThrow(dataObject).TryGetData(out data); + + /// + /// if the does not implement . + /// if the is + public static bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + this IDataObject dataObject, + string format, + [NotNullWhen(true), MaybeNullWhen(false)] out T data) => + GetTypedDataObjectOrThrow(dataObject).TryGetData(format, out data); + + /// + /// if the does not implement . + /// if the is + public static bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + this IDataObject dataObject, + string format, + bool autoConvert, + [NotNullWhen(true), MaybeNullWhen(false)] out T data) => + GetTypedDataObjectOrThrow(dataObject).TryGetData(format, autoConvert, out data); + + /// + /// if the does not implement . + /// if the is + [CLSCompliant(false)] + public static bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + this IDataObject dataObject, + string format, + Func resolver, + bool autoConvert, + [NotNullWhen(true), MaybeNullWhen(false)] out T data) => + GetTypedDataObjectOrThrow(dataObject).TryGetData(format, resolver, autoConvert, out data); +} diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/IDataObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/IDataObject.cs index 33ba57a45f8..a52c8699d4a 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/IDataObject.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/IDataObject.cs @@ -6,6 +6,15 @@ namespace System.Windows.Forms; /// /// Provides a format-independent mechanism for transferring data. /// +/// +/// +/// When implementing a , consider implementing +/// interface instead. This interface will ensure that only data of a specified +/// is exchanged. If is not implemented by a data object exchanged +/// in the clipboard or drag and drop scenarios, the APIs that specify a , +/// such as , will throw a . +/// +/// public interface IDataObject { /// diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/ITypedDataObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/ITypedDataObject.cs new file mode 100644 index 00000000000..a76ae50dc70 --- /dev/null +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/ITypedDataObject.cs @@ -0,0 +1,86 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Reflection.Metadata; +using System.Runtime.Serialization.Formatters.Binary; + +namespace System.Windows.Forms; + +/// +/// Provides a format-independent mechanism for reading data of a specified . +/// +/// +/// +/// Implement this interface to use your data object with +/// family of methods as well as in the drag and drop operations. This interface will ensure that only +/// data of the specified is exchanged. Otherwise the APIs that specify a parameter +/// will throw a .This is replacement of +/// interface, implement this interface as well. Otherwise the APIs that specify a parameter +/// will throw a . +/// +/// +public interface ITypedDataObject : IDataObject +{ + /// + /// Retrieves data associated with data format named after , + /// if that data is of type . + /// + /// + bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + [NotNullWhen(true), MaybeNullWhen(false)] out T data); + + /// + /// Retrieves data associated with the specified format if that data is of type . + /// + /// + bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + string format, + [NotNullWhen(true), MaybeNullWhen(false)] out T data); + + /// + /// Retrieves data in a specified format if that data is of type , + /// optionally converting the data to the specified format. + /// + /// + bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + string format, + bool autoConvert, + [NotNullWhen(true), MaybeNullWhen(false)] out T data); + + /// + /// compatible overload that retrieves typed data associated with the specified data format. + /// + /// + /// A user-provided function that defines a closure of s that can be retrieved from + /// the exchange medium. + /// + /// + /// A string that specifies what format to retrieve the data as. See the class for + /// a set of predefined data formats. + /// + /// + /// to attempt to automatically convert the data to the specified format; + /// for no data format conversion. + /// + /// + /// A data object with the data in the specified format, or if the data is not available + /// in the specified format or is of a wrong type. + /// + /// + /// if the data of this format is present and the value is + /// of a matching type and that value can be successfully retrieved, or + /// if the format is not present or the value is not of the right type. + /// + /// + /// + /// Implement this method for backward compatibility with binary formatted data when binary formatters are enabled. + /// + /// + bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( + string format, +#pragma warning disable CS3001 // Argument type is not CLS-compliant + Func resolver, +#pragma warning restore CS3001 + bool autoConvert, + [NotNullWhen(true), MaybeNullWhen(false)] out T data); +} diff --git a/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/DesignBehaviorsTests.cs b/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/DesignBehaviorsTests.cs index d424fc81e23..d0d268ac6b0 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/DesignBehaviorsTests.cs +++ b/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/DesignBehaviorsTests.cs @@ -183,7 +183,9 @@ public ToolboxItem DeserializeToolboxItem(object serializedObject) public ToolboxItem DeserializeToolboxItem(object serializedObject, IDesignerHost? host) { +#pragma warning disable WFDEV005 // Type or member is obsolete ToolboxItem? item = ((DataObject)serializedObject)?.GetData(typeof(ToolboxItem)) as ToolboxItem; +#pragma warning restore WFDEV005 return item!; } diff --git a/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/runtimeconfig.template.json b/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/runtimeconfig.template.json index 6054a7041d9..9437717726b 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/runtimeconfig.template.json +++ b/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/runtimeconfig.template.json @@ -1,6 +1,8 @@ { "configProperties": { "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false, + "Windows.ClipboardDragDrop.EnableUnsafeBinaryFormatterSerialization": false, + "Windows.ClipboardDragDrop.EnableNrbfSerialization": true, "System.Windows.Forms.AnchorLayoutV2": false, "System.Windows.Forms.ApplyParentFontToMenus": true, "System.Windows.Forms.DataGridViewUIAStartRowCountAtZero": false, diff --git a/src/System.Windows.Forms/tests/UnitTests/System.Windows.Forms.Tests.csproj b/src/System.Windows.Forms/tests/UnitTests/System.Windows.Forms.Tests.csproj index 9852774b838..a493260991c 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System.Windows.Forms.Tests.csproj +++ b/src/System.Windows.Forms/tests/UnitTests/System.Windows.Forms.Tests.csproj @@ -5,6 +5,7 @@ $(TargetFramework)-windows7.0 true System.Windows.Forms.Tests + true true diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormat/WinFormsBinaryFormattedObjectTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormat/WinFormsBinaryFormattedObjectTests.cs index 143f7b6b6ae..e548248d552 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormat/WinFormsBinaryFormattedObjectTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormat/WinFormsBinaryFormattedObjectTests.cs @@ -21,11 +21,11 @@ public void BinaryFormattedObject_Bitmap_FromBinaryFormatter() { using Bitmap bitmap = new(10, 10); SerializationRecord rootRecord = bitmap.SerializeAndDecode(); - Formats.Nrbf.ClassRecord root = rootRecord.Should().BeAssignableTo().Subject; + ClassRecord root = rootRecord.Should().BeAssignableTo().Subject; root.TypeNameMatches(typeof(Bitmap)).Should().BeTrue(); root.TypeName.FullName.Should().Be(typeof(Bitmap).FullName); root.TypeName.AssemblyName!.FullName.Should().Be(AssemblyRef.SystemDrawing); - Formats.Nrbf.ArrayRecord arrayRecord = root.GetArrayRecord("Data")!; + ArrayRecord arrayRecord = root.GetArrayRecord("Data")!; arrayRecord.Should().BeAssignableTo>(); rootRecord.TryGetBitmap(out object? result).Should().BeTrue(); using Bitmap deserialized = result.Should().BeOfType().Which; diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.BinaryFormatterFullCompatScope.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.BinaryFormatterFullCompatScope.cs new file mode 100644 index 00000000000..5f49ec6c898 --- /dev/null +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.BinaryFormatterFullCompatScope.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Windows.Forms.Tests; + +public partial class BinaryFormatUtilitiesTests +{ + internal readonly ref struct BinaryFormatterFullCompatScope : IDisposable + { + private readonly BinaryFormatterScope _binaryFormatterScope; + private readonly BinaryFormatterInClipboardDragDropScope _binaryFormatterInClipboardDragDropScope; + private readonly NrbfSerializerInClipboardDragDropScope _nrbfSerializerInClipboardDragDropScope; + + public BinaryFormatterFullCompatScope() + { + _binaryFormatterScope = new(enable: true); + _binaryFormatterInClipboardDragDropScope = new(enable: true); + _nrbfSerializerInClipboardDragDropScope = new(enable: false); + } + + public void Dispose() + { + _binaryFormatterScope.Dispose(); + _binaryFormatterInClipboardDragDropScope.Dispose(); + _nrbfSerializerInClipboardDragDropScope.Dispose(); + } + } +} diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.cs index 7489136aa2d..8bd378171ad 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.cs @@ -5,6 +5,7 @@ using System.Collections; using System.Drawing; +using System.Reflection.Metadata; using System.Runtime.Serialization; using Utilities = System.Windows.Forms.DataObject.Composition.BinaryFormatUtilities; @@ -24,7 +25,13 @@ private void WriteObjectToStream(object value, bool restrictSerialization = fals private object? ReadObjectFromStream(bool restrictDeserialization = false) { _stream.Position = 0; - return Utilities.ReadObjectFromStream(_stream, restrictDeserialization); + return Utilities.ReadObjectFromStream(_stream, restrictDeserialization, resolver: null, legacyMode: true); + } + + private object? ReadObjectFromStream(bool restrictDeserialization, Func? resolver) + { + _stream.Position = 0; + return Utilities.ReadObjectFromStream(_stream, restrictDeserialization, resolver, legacyMode: false); } private object? RoundTripObject(object value) @@ -37,12 +44,35 @@ private void WriteObjectToStream(object value, bool restrictSerialization = fals private object? RoundTripObject_RestrictedFormat(object value) { - // This is equivalent to SetData/GetData methods using registered OLE formats and thus the BitmapBinder, - // and works with the BinaryFormat AppCompat switches. + // This is equivalent to SetData/GetData methods using registered OLE formats, resolves only the known types WriteObjectToStream(value, restrictSerialization: true); return ReadObjectFromStream(restrictDeserialization: true); } + private object? RoundTripOfType(object value) + { + // This is equivalent to SetData/TryGetData methods using unbounded OLE formats, + // and works with the BinaryFormat AppContext switches. + WriteObjectToStream(value); + return ReadObjectFromStream(restrictDeserialization: false, NotSupportedResolver); + } + + private object? RoundTripOfType_RestrictedFormat(object value) + { + // This is equivalent to SetData/TryGetData methods using OLE formats. Deserialization is restricted + // to known types. + WriteObjectToStream(value, restrictSerialization: true); + return ReadObjectFromStream(restrictDeserialization: true, NotSupportedResolver); + } + + private object? RoundTripOfType(object value, Func? resolver) + { + // This is equivalent to SetData/TryGetData methods using unbounded formats, + // serialization is restricted by the resolver and BinaryFormat AppContext switches. + WriteObjectToStream(value); + return ReadObjectFromStream(restrictDeserialization: false, resolver); + } + // Primitive types as defined by the NRBF spec. // https://learn.microsoft.com/dotnet/api/system.formats.nrbf.primitivetyperecord public static TheoryData PrimitiveObjects_TheoryData => @@ -120,24 +150,24 @@ private void WriteObjectToStream(object value, bool restrictSerialization = fals public static TheoryData PrimitiveArrayListObjects_TheoryData => [ - new ArrayList { null }, - new ArrayList { null, "something" }, - new ArrayList { false, true }, - new ArrayList { char.MinValue, char.MaxValue }, - new ArrayList { byte.MinValue, byte.MaxValue }, - new ArrayList { sbyte.MinValue, sbyte.MaxValue }, - new ArrayList { short.MinValue, short.MaxValue }, - new ArrayList { ushort.MinValue, ushort.MaxValue }, - new ArrayList { int.MinValue, int.MaxValue }, - new ArrayList { uint.MinValue, uint.MaxValue }, - new ArrayList { long.MinValue, long.MaxValue }, - new ArrayList { ulong.MinValue, ulong.MaxValue }, - new ArrayList { float.MinValue, float.MaxValue }, - new ArrayList { double.MinValue, double.MaxValue }, - new ArrayList { decimal.MinValue, decimal.MaxValue }, - new ArrayList { DateTime.MinValue, DateTime.MaxValue }, - new ArrayList { TimeSpan.MinValue, TimeSpan.MaxValue }, - new ArrayList { "a", "b", "c" } + [null], + [null, "something"], + [false, true], + [char.MinValue, char.MaxValue], + [byte.MinValue, byte.MaxValue], + [sbyte.MinValue, sbyte.MaxValue], + [short.MinValue, short.MaxValue], + [ushort.MinValue, ushort.MaxValue], + [int.MinValue, int.MaxValue], + [uint.MinValue, uint.MaxValue], + [long.MinValue, long.MaxValue], + [ulong.MinValue, ulong.MaxValue], + [float.MinValue, float.MaxValue], + [double.MinValue, double.MaxValue], + [decimal.MinValue, decimal.MaxValue], + [DateTime.MinValue, DateTime.MaxValue], + [TimeSpan.MinValue, TimeSpan.MaxValue], + ["a", "b", "c"] ]; public static TheoryData PrimitiveTypeHashtables_TheoryData => @@ -162,9 +192,9 @@ private void WriteObjectToStream(object value, bool restrictSerialization = fals public static TheoryData NotSupportedException_TestData => [ - new NotSupportedException(), - new NotSupportedException("Error message"), - new NotSupportedException(null) + new(), + new("Error message"), + new(null) ]; public static TheoryData Lists_UnsupportedTestData => @@ -300,12 +330,21 @@ public void RoundTrip_Unsupported(IList value) writer.Should().Throw(); - using (BinaryFormatterScope scope = new(enable: true)) + using (NrbfSerializerInClipboardDragDropScope nrbfScope = new(enable: false)) { - WriteObjectToStream(value); - ReadObjectFromStream().Should().BeEquivalentTo(value); + using (BinaryFormatterScope scope = new(enable: true)) + { + writer.Should().Throw(); + + using BinaryFormatterInClipboardDragDropScope clipboardDragDropScope = new(enable: true); + WriteObjectToStream(value); + ReadObjectFromStream().Should().BeEquivalentTo(value); + } + + reader.Should().Throw(); } + // Binary format deserializers in Clipboard/DragDrop scenarios are not opted in. reader.Should().Throw(); } @@ -316,7 +355,7 @@ public void RoundTrip_RestrictedFormat_Unsupported(IList value) Action writer = () => WriteObjectToStream(value, restrictSerialization: true); writer.Should().Throw(); - using BinaryFormatterScope scope = new(enable: true); + using BinaryFormatterFullCompatScope scope = new(); writer.Should().Throw(); } @@ -332,7 +371,7 @@ public void RoundTrip_OffsetArray() value.SetValue(203u, 2, 4); // Can read offset array with the BinaryFormatter. - using BinaryFormatterScope scope = new(enable: true); + using BinaryFormatterFullCompatScope scope = new(); var result = RoundTripObject(value).Should().BeOfType().Subject; result.Rank.Should().Be(2); @@ -347,4 +386,647 @@ public void RoundTrip_OffsetArray() result.GetValue(2, 3).Should().Be(202u); result.GetValue(2, 4).Should().Be(203u); } + + [Fact] + public void RoundTripOfType_Unsupported() + { + // Not a known type, while 'List' is resolved by default, 'object' requires a custom resolver. + List value = ["text"]; + using (BinaryFormatterFullCompatScope scope = new()) + { + WriteObjectToStream(value); + + ReadAndValidate(); + + using NrbfSerializerInClipboardDragDropScope nrbfScope = new(enable: true); + ReadAndValidate(); + } + + Action read = () => ReadObjectFromStream>(restrictDeserialization: false, ObjectListResolver); + read.Should().Throw(); + + void ReadAndValidate() + { + var result = ReadObjectFromStream>(restrictDeserialization: false, ObjectListResolver) + .Should().BeOfType>().Subject; + result.Count.Should().Be(1); + result[0].Should().Be("text"); + } + + static Type ObjectListResolver(TypeName typeName) + { + (string name, Type type)[] allowedTypes = + [ + ("System.Object", typeof(object)), + ("System.Collections.Generic.List`1[[System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]", typeof(List)) + ]; + + string fullName = typeName.FullName; + foreach (var (name, type) in allowedTypes) + { + // Namespace-qualified type name. + if (name == fullName) + { + return type; + } + } + + throw new NotSupportedException($"Can't resolve {typeName.AssemblyQualifiedName}"); + } + } + + [Fact] + public void RoundTripOfType_AsUnmatchingType_Simple() + { + List value = [1, 2, 3]; + RoundTripOfType(value).Should().BeNull(); + } + + [Fact] + public void RoundTripOfType_RestrictedFormat_AsUnmatchingType_Simple() + { + Rectangle value = new(1, 1, 2, 2); + // We are setting up an invalid content scenario, Rectangle type can't be read as a restricted format, + // but in this case requested type will not match the payload type. + WriteObjectToStream(value); + + ReadObjectFromStream(restrictDeserialization: true, NotSupportedResolver).Should().BeNull(); + + using BinaryFormatterFullCompatScope scope = new(); + ReadObjectFromStream(restrictDeserialization: true, NotSupportedResolver).Should().BeNull(); + } + + [Fact] + public void RoundTripOfType_intNullable() => + RoundTripOfType(101, NotSupportedResolver).Should().Be(101); + + [Fact] + public void RoundTripOfType_RestrictedFormat_intNullable() => + RoundTripOfType_RestrictedFormat(101).Should().Be(101); + + [Fact] + public void RoundTripOfType_RestrictedFormat_intNullableArray_NotSupportedResolver() + { + int?[] value = [101, null, 303]; + + using BinaryFormatterFullCompatScope scope = new(); + WriteObjectToStream(value); + Action read = () => ReadObjectFromStream(restrictDeserialization: true, NotSupportedResolver); + + // nullable struct requires a custom resolver. + // RestrictedTypeDeserializationException + read.Should().Throw(); + } + + [Fact] + public void RoundTripOfType_intNullableArray_NotSupportedResolver() + { + int?[] value = [101, null, 303]; + + using BinaryFormatterFullCompatScope scope = new(); + WriteObjectToStream(value); + Action read = () => ReadObjectFromStream(restrictDeserialization: false, NotSupportedResolver); + + // nullable struct requires a custom resolver. + read.Should().Throw(); + } + + [Theory] + [BoolData] + public void RoundTripOfType_OffsetArray_NotSupportedResolver(bool restrictDeserialization) + { + Array value = Array.CreateInstance(typeof(uint), lengths: [2, 3], lowerBounds: [1, 2]); + value.SetValue(101u, 1, 2); + value.SetValue(102u, 1, 3); + value.SetValue(103u, 1, 4); + value.SetValue(201u, 2, 2); + value.SetValue(202u, 2, 3); + value.SetValue(203u, 2, 4); + + using BinaryFormatterFullCompatScope scope = new(); + WriteObjectToStream(value); + Action read = () => ReadObjectFromStream(restrictDeserialization, NotSupportedResolver); + + read.Should().Throw(); + } + + [Fact] + public void RoundTripOfType_intNullableArray_CustomResolver() + { + int?[] value = [101, null, 303]; + + using BinaryFormatterFullCompatScope scope = new(); + RoundTripOfType(value, NullableIntArrayResolver).Should().BeEquivalentTo(value); + } + + private static Type NullableIntArrayResolver(TypeName typeName) + { + (string name, Type type)[] allowedTypes = + [ + ("System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]][]", typeof(int?[])), + ("System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]", typeof(int?)) + ]; + + string fullName = typeName.FullName; + foreach (var (name, type) in allowedTypes) + { + // Namespace-qualified type name. + if (name == fullName) + { + return type; + } + } + + throw new NotSupportedException($"Can't resolve {typeName.AssemblyQualifiedName}"); + } + + [Fact] + public void RoundTripOfType_TestData_TestDataResolver() + { + TestData value = new(new(10, 10), 2); + + using BinaryFormatterFullCompatScope scope = new(); + var result = RoundTripOfType(value, TestDataResolver).Should().BeOfType().Subject; + + result.Equals(value, value.Bitmap.Size); + + static Type TestDataResolver(TypeName typeName) + { + (string name, Type type)[] allowedTypes = + [ + (typeof(TestData).FullName!, typeof(TestData)), + (typeof(TestDataBase.InnerData).FullName!, typeof(TestDataBase.InnerData)), + ("System.Nullable`1[[System.Decimal, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]", typeof(decimal?)), + ("System.Collections.Generic.List`1[[System.Nullable`1[[System.Decimal, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]", typeof(List)) + ]; + + string fullName = typeName.FullName; + foreach (var (name, type) in allowedTypes) + { + // Namespace-qualified type name. + if (name == fullName) + { + return type; + } + } + + throw new NotSupportedException($"Can't resolve {typeName.AssemblyQualifiedName}"); + } + } + + [Fact] + public void RoundTripOfType_TestData_InvalidResolver() + { + TestData value = new(new(10, 10), 2); + + using BinaryFormatterFullCompatScope scope = new(); + WriteObjectToStream(value); + + // Resolver that returns a null is blocked in our SerializationBinder wrapper. + Action read = () => ReadObjectFromStream(restrictDeserialization: false, InvalidResolver); + + read.Should().Throw(); + + static Type InvalidResolver(TypeName typeName) => null!; + } + + private static Type FontResolver(TypeName typeName) + { + (string? name, Type type)[] allowedTypes = + [ + (typeof(Font).FullName, typeof(Font)), + (typeof(FontStyle).FullName, typeof(FontStyle)), + (typeof(FontFamily).FullName, typeof(FontFamily)), + (typeof(GraphicsUnit).FullName, typeof(GraphicsUnit)), + ]; + + string fullName = typeName.FullName; + foreach (var (name, type) in allowedTypes) + { + // Namespace-qualified type name. + if (name == fullName) + { + return type; + } + } + + throw new NotSupportedException($"Can't resolve {typeName.AssemblyQualifiedName}"); + } + + [Fact] + public void RoundTripOfType_Font_FontResolver() + { + using Font value = new("Microsoft Sans Serif", emSize: 10); + + using BinaryFormatterFullCompatScope scope = new(); + + using Font result = RoundTripOfType(value, FontResolver).Should().BeOfType().Subject; + result.Should().Be(value); + } + + [Fact] + public void ReadFontSerializedOnNet481() + { + // This string was generated on net481. + // Clipboard.SetData("TestData", new Font("Microsoft Sans Serif", 10)); + // And the resulting stream was saved as a string + // string text = Convert.ToBase64String(stream.ToArray()); + string font = + "AAEAAAD/////AQAAAAAAAAAMAgAAAFFTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJl" + + "PW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABNTeXN0ZW0uRHJhd2luZy5G" + + "b250BAAAAAROYW1lBFNpemUFU3R5bGUEVW5pdAEABAQLGFN5c3RlbS5EcmF3aW5nLkZvbnRTdHlsZQIAAAAb" + + "U3lzdGVtLkRyYXdpbmcuR3JhcGhpY3NVbml0AgAAAAIAAAAGAwAAABRNaWNyb3NvZnQgU2FucyBTZXJpZgAA" + + "IEEF/P///xhTeXN0ZW0uRHJhd2luZy5Gb250U3R5bGUBAAAAB3ZhbHVlX18ACAIAAAAAAAAABfv///8bU3lz" + + "dGVtLkRyYXdpbmcuR3JhcGhpY3NVbml0AQAAAAd2YWx1ZV9fAAgCAAAAAwAAAAs="; + + byte[] bytes = Convert.FromBase64String(font); + using MemoryStream stream = new(bytes); + + // Default deserialization with the NRBF deserializer. + using (BinaryFormatterInClipboardDragDropScope binaryFormatScope = new(enable: true)) + { + // GetData case. + stream.Position = 0; + Action getData = () => Utilities.ReadObjectFromStream( + stream, + restrictDeserialization: false, + resolver: null, + legacyMode: true); + + getData.Should().Throw(); + + TryGetData(stream); + } + + // Deserialize using the binary formatter. + using BinaryFormatterFullCompatScope scope = new(); + // GetData case. + stream.Position = 0; + var result = Utilities.ReadObjectFromStream( + stream, + restrictDeserialization: false, + resolver: null, + legacyMode: true).Should().BeOfType().Subject; + + result.Name.Should().Be("Microsoft Sans Serif"); + result.Size.Should().Be(10); + + TryGetData(stream); + + static void TryGetData(MemoryStream stream) + { + // TryGetData case. + stream.Position = 0; + var result = Utilities.ReadObjectFromStream( + stream, + restrictDeserialization: false, + resolver: FontResolver, + legacyMode: false).Should().BeOfType().Subject; + + result.Name.Should().Be("Microsoft Sans Serif"); + result.Size.Should().Be(10); + } + } + + [Fact] + public void RoundTripOfType_FlatData_NoResolver() + { + TestDataBase.InnerData value = new("simple class"); + + using BinaryFormatterFullCompatScope scope = new(); + + RoundTripOfType(value, resolver: null) + .Should().BeOfType().Which.Should().BeEquivalentTo(value); + } + + [Fact] + public void RoundTripOfType_FlatData_NrbfDeserializer_NoResolver() + { + TestDataBase.InnerData value = new("simple class"); + + using BinaryFormatterScope scope = new(enable: true); + using BinaryFormatterInClipboardDragDropScope clipboardScope = new(enable: true); + + RoundTripOfType(value, resolver: null) + .Should().BeOfType().Which.Should().BeEquivalentTo(value); + } + + [Fact] + public void Sample_GetData_UseBinaryFormatter() + { + MyClass1 value = new(value: 1); + + using BinaryFormatterFullCompatScope scope = new(); + WriteObjectToStream(value); + + // legacyMode == true follows the GetData path. + _stream.Position = 0; + Utilities.ReadObjectFromStream(_stream, restrictDeserialization: false, resolver: null, legacyMode: true) + .Should().BeEquivalentTo(value); + } + + [Fact] + public void Sample_GetData_UseNrbfDeserialize() + { + MyClass1 value = new(value: 1); + + using BinaryFormatterScope scope = new(enable: true); + using BinaryFormatterInClipboardDragDropScope clipboardScope = new(enable: true); + WriteObjectToStream(value); + + // This works because GetData falls back to the BinaryFormatter deserializer, NRBF deserializer fails because it requires a resolver. + _stream.Position = 0; + Utilities.ReadObjectFromStream(_stream, restrictDeserialization: false, resolver: null, legacyMode: true) + .Should().BeEquivalentTo(value); + } + + [Theory] + [BoolData] + public void Sample_TryGetData_NoResolver_UseBinaryFormatter(bool restrictDeserialization) + { + MyClass1 value = new(value: 1); + + using BinaryFormatterFullCompatScope scope = new(); + WriteObjectToStream(value); + + // RestrictedTypeDeserializationException will be swallowed up the call stack, when reading HGLOBAL. + // Fails to resolve MyClass2 or both MyClass1 and MyClass2 in the case of restricted formats. + Action read = () => ReadObjectFromStream(restrictDeserialization, resolver: null); + read.Should().Throw(); + } + + [Theory] + [BoolData] + public void Sample_TryGetData_NoResolver_UseNrbfDeserializer(bool restrictDeserialization) + { + MyClass1 value = new(value: 1); + + using BinaryFormatterScope scope = new(enable: true); + using BinaryFormatterInClipboardDragDropScope clipboardScope = new(enable: true); + WriteObjectToStream(value); + + Action read = () => ReadObjectFromStream(restrictDeserialization, resolver: null); + read.Should().Throw(); + } + + [Fact] + public void Sample_TryGetData_UseBinaryFormatter() + { + MyClass1 value = new(value: 1); + + using BinaryFormatterFullCompatScope scope = new(); + WriteObjectToStream(value); + + ReadObjectFromStream(restrictDeserialization: false, MyClass1.MyExactMatchResolver) + .Should().BeEquivalentTo(value); + } + + [Fact] + public void Sample_TryGetData_RestrictedFormat_UseBinaryFormatter() + { + MyClass1 value = new(value: 1); + + using BinaryFormatterFullCompatScope scope = new(); + WriteObjectToStream(value); + + Action read = () => ReadObjectFromStream(restrictDeserialization: true, MyClass1.MyExactMatchResolver); + read.Should().Throw(); + } + + [Fact] + public void Sample_TryGetData_RestrictedFormat_UseNrbfDeserializer() + { + MyClass1 value = new(value: 1); + + using BinaryFormatterScope scope = new(enable: true); + using BinaryFormatterInClipboardDragDropScope clipboardScope = new(enable: true); + WriteObjectToStream(value); + + Action read = () => ReadObjectFromStream(restrictDeserialization: true, MyClass1.MyExactMatchResolver); + read.Should().Throw(); + } + + [Fact] + public void Sample_TryGetData_UseNrbfDeserializer() + { + MyClass1 value = new(value: 1); + + using BinaryFormatterScope scope = new(enable: true); + using BinaryFormatterInClipboardDragDropScope clipboardScope = new(enable: true); + WriteObjectToStream(value); + + ReadObjectFromStream(restrictDeserialization: false, MyClass1.MyExactMatchResolver) + .Should().BeEquivalentTo(value); + } + + private static Type NotSupportedResolver(TypeName typeName) => + throw new NotSupportedException($"Can't resolve {typeName.AssemblyQualifiedName}"); + + [Serializable] + private class TestDataBase + { + public TestDataBase(Bitmap bitmap) + { + Bitmap = bitmap; + Inner = new("inner"); + } + + public Bitmap Bitmap; + public InnerData? Inner; + + [Serializable] + internal class InnerData + { + public InnerData(string text) + { + Text = text; + Location = new Point(1, 2); + } + + public string Text; + public Point Location; + } + } + + [Serializable] + private class TestData : TestDataBase + { + public TestData(Bitmap bitmap, int count) + : base(bitmap) + { + Count = count; + } + + private const float Delta = 0.0003f; + + // BinaryFormatter resolves primitive types or arrays of primitive types with no resolver. + public int? Count; + public DateTime? Today = DateTime.Now; + + public byte[] ByteArray = [8, 9]; + public sbyte[] SbyteArray = [8, 9]; + public short[] ShortArray = [8, 9]; + public ushort[] UshortArray = [8, 9]; + public int[] IntArray = [8, 9]; + public uint[] UintArray = [8, 9]; + public long[] LongArray = [8, 9]; + public ulong[] UlongArray = [8, 9]; + public float[] FloatArray = [1.0f, 2.0f, 3.0f]; + public double[] DoubleArray = [1.0, 2.0, 3.0]; + public char[] CharArray = ['a', 'b', 'c']; + public bool[] BoolArray = [true, false]; + public string[] StringArray = ["a", "b", "c"]; + public decimal[] DecimalArray = [1.0m, 2.0m, 3.0m]; + public TimeSpan[] TimeSpanArray = [TimeSpan.FromHours(1)]; + public DateTime[] DateTimeArray = [DateTime.Now]; + + // Common WinForms types are resolved using the intrinsic binder. + public NotSupportedException Exception = new(); + public Point Point = new(1, 2); + public Rectangle Rectangle = new(1, 2, 3, 4); + public Size? Size = new(1, 2); + public SizeF SizeF = new(1, 2); + public Color Color = Color.Red; + public PointF PointF = new(1, 2); + public RectangleF RectangleF = new(1, 2, 3, 4); + public ImageListStreamer ImageList = new(new ImageList()); + + public List Bytes = [1]; + public List Sbytes = [1]; + public List Shorts = [1]; + public List Ushorts = [1]; + public List Ints = [1, 2, 3]; + public List Uints = [1, 2, 3]; + public List Longs = [1, 2, 3]; + public List Ulongs = [1, 2, 3]; + public List Floats = [1.0f, 2.0f, 3.0f]; + public List Doubles = [1.0, 2.0, 3.0]; + public List Decimals = [1.0m, 2.0m, 3.0m]; + public List NullableDecimals = [null, 2.0m, 3.0m]; + public List DateTimes = [DateTime.Now]; + // System.Runtime.Serialization.SerializationException : Invalid BinaryFormatter stream. + // System.NotSupportedException : Can't resolve System.Collections.Generic.List`1[[System.TimeSpan, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] + // Even though when serialized as a root record, TimeSpan is normalized to the framework assembly. + // public List TimeSpans = new() { TimeSpan.FromHours(1) }; + public List Strings = ["a", "b", "c"]; + + public void Equals(TestData other, Size bitmapSize) + { + Bitmap.Size.Should().Be(bitmapSize); + Inner.Should().BeEquivalentTo(other.Inner); + Count.Should().Be(other.Count); + Today.Should().Be(other.Today); + + ByteArray.Should().BeEquivalentTo(other.ByteArray); + SbyteArray.Should().BeEquivalentTo(other.SbyteArray); + ShortArray.Should().BeEquivalentTo(other.ShortArray); + UshortArray.Should().BeEquivalentTo(other.UshortArray); + IntArray.Should().BeEquivalentTo(other.IntArray); + UintArray.Should().BeEquivalentTo(other.UintArray); + LongArray.Should().BeEquivalentTo(other.LongArray); + UlongArray.Should().BeEquivalentTo(other.UlongArray); + FloatArray.Should().BeEquivalentTo(other.FloatArray); + DoubleArray.Should().BeEquivalentTo(other.DoubleArray); + CharArray.Should().BeEquivalentTo(other.CharArray); + BoolArray.Should().BeEquivalentTo(other.BoolArray); + StringArray.Should().BeEquivalentTo(other.StringArray); + DecimalArray.Should().BeEquivalentTo(other.DecimalArray); + TimeSpanArray.Should().BeEquivalentTo(other.TimeSpanArray); + DateTimeArray.Should().BeEquivalentTo(other.DateTimeArray); + + Exception.Should().BeEquivalentTo(other.Exception); + Point.Should().Be(other.Point); + Rectangle.Should().Be(other.Rectangle); + Size.Should().Be(other.Size); + SizeF.Should().Be(other.SizeF); + Color.Should().Be(other.Color); + PointF.Should().BeApproximately(other.PointF, Delta); + RectangleF.Should().BeApproximately(other.RectangleF, Delta); + using ImageList newList = new(); + newList.ImageStream = ImageList; + newList.Images.Count.Should().Be(0); + Bytes.Should().BeEquivalentTo(other.Bytes); + Sbytes.Should().BeEquivalentTo(other.Sbytes); + Shorts.Should().BeEquivalentTo(other.Shorts); + Ushorts.Should().BeEquivalentTo(other.Ushorts); + Ints.Should().BeEquivalentTo(other.Ints); + Uints.Should().BeEquivalentTo(other.Uints); + Longs.Should().BeEquivalentTo(other.Longs); + Ulongs.Should().BeEquivalentTo(other.Ulongs); + Floats.Should().BeEquivalentTo(other.Floats); + Doubles.Should().BeEquivalentTo(other.Doubles); + Decimals.Should().BeEquivalentTo(other.Decimals); + NullableDecimals.Should().BeEquivalentTo(other.NullableDecimals); + DateTimes.Should().BeEquivalentTo(other.DateTimes); + // TimeSpans.Should().BeEquivalentTo(other.TimeSpans); + Strings.Should().BeEquivalentTo(other.Strings); + } + } + + [Serializable] + private class MyClass1 + { + public MyClass1(int value) + { + Value = value; + MyClass2 = new(); + } + + public int Value { get; set; } + public MyClass2 MyClass2 { get; set; } + + internal static Type MyExactMatchResolver(TypeName typeName) + { + // The preferred approach is to resolve types at build time to avoid assembly loading at runtime. + (Type type, TypeName typeName)[] allowedTypes = + [ + (typeof(MyClass1), TypeName.Parse(typeof(MyClass1).AssemblyQualifiedName)), + (typeof(MyClass2), TypeName.Parse(typeof(MyClass2).AssemblyQualifiedName)) + ]; + + foreach (var (type, name) in allowedTypes) + { + // Namespace-qualified type name, using case-sensitive comparison for C#. + if (name.FullName != typeName.FullName) + { + continue; + } + + AssemblyNameInfo? info1 = typeName.AssemblyName; + AssemblyNameInfo? info2 = name.AssemblyName; + + if (info1 is null && info2 is null) + { + return type; + } + + if (info1 is null || info2 is null) + { + continue; + } + + // Full assembly name comparison, case sensitive. + if (info1.Name == info2.Name + && info1.Version == info2.Version + && ((info1.CultureName ?? string.Empty) == info2.CultureName) + && info1.PublicKeyOrToken.AsSpan().SequenceEqual(info2.PublicKeyOrToken.AsSpan())) + { + return type; + } + } + + throw new NotSupportedException($"Can't resolve {typeName.AssemblyQualifiedName}"); + } + } + + [Serializable] + public class MyClass2 + { + public MyClass2() + { + Point = new(1, 2); + } + + public Point Point { get; set; } = new(1, 2); + } } diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ClipboardTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ClipboardTests.cs index 8816a9d3435..09d4ff46d9b 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ClipboardTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ClipboardTests.cs @@ -7,8 +7,11 @@ using System.ComponentModel; using System.Drawing; using System.Drawing.Imaging; +using System.Reflection.Metadata; using System.Runtime.InteropServices; +using System.Windows.Forms.Primitives; using Windows.Win32.System.Ole; +using static System.Windows.Forms.Tests.BinaryFormatUtilitiesTests; using Com = Windows.Win32.System.Com; using ComTypes = System.Runtime.InteropServices.ComTypes; @@ -20,6 +23,8 @@ namespace System.Windows.Forms.Tests; [UISettings(MaxAttempts = 3)] // Try up to 3 times before failing. public class ClipboardTests { +#pragma warning disable WFDEV005 // Type or member is obsolete + [WinFormsFact] public void Clipboard_SetText_InvokeString_GetReturnsExpected() { @@ -111,8 +116,9 @@ public void Clipboard_GetData_NullOrEmptyFormat_Returns_Null(string? format) [WinFormsFact] public void Clipboard_GetDataObject_InvokeMultipleTimes_Success() { - IDataObject? result = Clipboard.GetDataObject(); - (result == Clipboard.GetDataObject()).Should().BeFalse(); + DataObject result1 = Clipboard.GetDataObject().Should().BeOfType().Subject; + DataObject result2 = Clipboard.GetDataObject().Should().BeOfType().Subject; + result1.GetFormats().Should().BeEquivalentTo(result2.GetFormats()); } [WinFormsFact] @@ -247,6 +253,7 @@ public void Clipboard_SetData_null_NotThrow() // GetData will hit "Data on clipboard is invalid (0x800401D3 (CLIPBRD_E_BAD_DATA))" Clipboard.ContainsData("MyData").Should().BeTrue(); Clipboard.GetData("MyData").Should().BeNull(); + Clipboard.TryGetData("MyData", out string? data).Should().BeFalse(); } finally { @@ -261,8 +268,7 @@ public void Clipboard_SetDataObject_InvokeObjectNotIComDataObject_GetReturnsExpe { Clipboard.SetDataObject(data); - var dataObject = Clipboard.GetDataObject(); - Assert.NotNull(dataObject); + DataObject dataObject = Clipboard.GetDataObject().Should().BeOfType().Subject; dataObject.GetData(data.GetType()).Should().Be(data); Clipboard.ContainsData(data.GetType().FullName).Should().BeTrue(); } @@ -304,7 +310,7 @@ public void Clipboard_SetDataObject_InvokeObjectBoolIComDataObject_GetReturnsExp DataObject dataObject = new(data); Clipboard.SetDataObject(dataObject, copy, retryTimes, retryDelay); - DataObject actual = Clipboard.GetDataObject().Should().BeOfType().Which; + DataObject actual = Clipboard.GetDataObject().Should().BeOfType().Subject; actual.GetData(data.GetType()).Should().Be(data); Clipboard.ContainsData(data.GetType().FullName).Should().BeTrue(); } @@ -318,7 +324,7 @@ public void Clipboard_SetDataObject_InvokeObjectBoolIntIntNotIComDataObject_GetR { Clipboard.SetDataObject(data, copy, retryTimes, retryDelay); - DataObject dataObject = Clipboard.GetDataObject().Should().BeOfType().Which; + DataObject dataObject = Clipboard.GetDataObject().Should().BeOfType().Subject; dataObject.GetData(data.GetType()).Should().Be(data); Clipboard.ContainsData(data.GetType().FullName).Should().BeTrue(); } @@ -433,7 +439,8 @@ public void Clipboard_SetImage_InvokeBitmap_GetReturnsExpected() using Bitmap bitmap = new(10, 10); bitmap.SetPixel(1, 2, Color.FromArgb(0x01, 0x02, 0x03, 0x04)); Clipboard.SetImage(bitmap); - Bitmap result = Assert.IsType(Clipboard.GetImage()); + + var result = Clipboard.GetImage().Should().BeOfType().Subject; result.Size.Should().Be(bitmap.Size); result.GetPixel(1, 2).Should().Be(Color.FromArgb(0xFF, 0xD2, 0xD2, 0xD2)); Clipboard.ContainsImage().Should().BeTrue(); @@ -445,6 +452,10 @@ public void Clipboard_SetImage_InvokeMetafile_GetReturnsExpected() try { using Metafile metafile = new("bitmaps/telescope_01.wmf"); + using BinaryFormatterScope scope = new(enable: true); + using BinaryFormatterInClipboardDragDropScope clipboardScope = new(enable: true); + + // SetImage fails silently and corrupts the clipboard state for anything other than a bitmap. Clipboard.SetImage(metafile); Clipboard.GetImage().Should().BeNull(); @@ -462,6 +473,10 @@ public void Clipboard_SetImage_InvokeEnhancedMetafile_GetReturnsExpected() try { using Metafile metafile = new("bitmaps/milkmateya01.emf"); + using BinaryFormatterScope scope = new(enable: true); + using BinaryFormatterInClipboardDragDropScope clipboardScope = new(enable: true); + + // SetImage fails silently and corrupts the clipboard for everything other than a bitmap. Clipboard.SetImage(metafile); Clipboard.GetImage().Should().BeNull(); @@ -523,9 +538,13 @@ public void Clipboard_SetData_CustomFormat_Exception_BinaryFormatterDisabled_Ser using BinaryFormatterScope scope = new(enable: false); string format = nameof(Clipboard_SetData_CustomFormat_Exception_BinaryFormatterDisabled_SerializesException); - // This will fail and NotSupportedException will be put on the Clipboard instead. + // This will fail because BinaryFormatter is disabled in the clipboard APIs, thus NotSupportedException + // will be put on the Clipboard instead. Clipboard.SetData(format, new FileNotFoundException()); Clipboard.ContainsData(format).Should().BeTrue(); + // However we don't need binary formatter to read this exception off of the clipboard. + Clipboard.TryGetData(format, out NotSupportedException? exception).Should().BeTrue(); + exception.Should().NotBeNull(); Clipboard.GetData(format).Should().BeOfType(); } @@ -558,7 +577,7 @@ public void Clipboard_Set_DoesNotWrapTwice() Clipboard.SetDataObject(realDataObject); IDataObject? clipboardDataObject = Clipboard.GetDataObject(); - var dataObject = clipboardDataObject.Should().BeOfType().Which; + var dataObject = clipboardDataObject.Should().BeOfType().Subject; dataObject.IsWrappedForClipboard.Should().BeTrue(); Clipboard.SetDataObject(clipboardDataObject!); @@ -640,7 +659,220 @@ public unsafe void Clipboard_RawClipboard_SetClipboardData_ReturnsExpected() SetClipboardData((uint)CLIPBOARD_FORMAT.CF_UNICODETEXT, (HANDLE)Marshal.StringToHGlobalUni(testString)); CloseClipboard().Should().BeTrue(); - DataObject dataObject = Clipboard.GetDataObject().Should().BeOfType().Which; + DataObject dataObject = Clipboard.GetDataObject().Should().BeOfType().Subject; dataObject.GetData(DataFormats.Text).Should().Be(testString); } + + [WinFormsFact] + public void Clipboard_BinaryFormatter_AppContextSwitch() + { + // Test the switch to ensure it works as expected in the context of this test assembly. + LocalAppContextSwitches.ClipboardDragDropEnableUnsafeBinaryFormatterSerialization.Should().BeFalse(); + + using (BinaryFormatterInClipboardDragDropScope scope = new(enable: true)) + { + LocalAppContextSwitches.ClipboardDragDropEnableUnsafeBinaryFormatterSerialization.Should().BeTrue(); + } + + LocalAppContextSwitches.ClipboardDragDropEnableUnsafeBinaryFormatterSerialization.Should().BeFalse(); + + using (BinaryFormatterInClipboardDragDropScope scope = new(enable: false)) + { + LocalAppContextSwitches.ClipboardDragDropEnableUnsafeBinaryFormatterSerialization.Should().BeFalse(); + } + + LocalAppContextSwitches.ClipboardDragDropEnableUnsafeBinaryFormatterSerialization.Should().BeFalse(); + } + + [WinFormsFact] + public void Clipboard_NrbfSerializer_AppContextSwitch() + { + // Test the switch to ensure it works as expected in the context of this test assembly. + LocalAppContextSwitches.ClipboardDragDropEnableNrbfSerialization.Should().BeTrue(); + + using (NrbfSerializerInClipboardDragDropScope scope = new(enable: false)) + { + LocalAppContextSwitches.ClipboardDragDropEnableNrbfSerialization.Should().BeFalse(); + } + + LocalAppContextSwitches.ClipboardDragDropEnableNrbfSerialization.Should().BeTrue(); + + using (NrbfSerializerInClipboardDragDropScope scope = new(enable: true)) + { + LocalAppContextSwitches.ClipboardDragDropEnableNrbfSerialization.Should().BeTrue(); + } + + LocalAppContextSwitches.ClipboardDragDropEnableNrbfSerialization.Should().BeTrue(); + } + + [WinFormsFact] + public void Clipboard_TryGetInt_ReturnsExpected() + { + int expected = 101; + using (BinaryFormatterScope scope = new(enable: true)) + { + Clipboard.SetData("TestData", expected); + } + + Clipboard.TryGetData("TestData", out int? data).Should().BeTrue(); + data.Should().Be(expected); + } + + [WinFormsFact] + public void Clipboard_TryGetTestData() + { + TestData expected = new(DateTime.Now); + string format = "TestData"; + using BinaryFormatterFullCompatScope scope = new(); + Clipboard.SetData(format, expected); + + Clipboard.TryGetData(format, TestData.TestDataResolver, out TestData? data).Should().BeTrue(); + var result = data.Should().BeOfType().Subject; + expected.Equals(result); + + // We are still in the less safe switch configuration, but now we prefer the + // NRBF deserialization over the BinaryFormatter full compatibility mode. + using NrbfSerializerInClipboardDragDropScope nrbfScope = new(enable: true); + Clipboard.TryGetData(format, TestData.TestDataResolver, out TestData? testData).Should().BeTrue(); + expected.Equals(testData.Should().BeOfType().Subject); + // Resolver is required to read this type. + Action tryGetData = () => Clipboard.TryGetData(format, out testData); + tryGetData.Should().Throw(); + + // This is the safe switch configuration, custom types can't be resolved + using NrbfSerializerInClipboardDragDropScope nrbfScope2 = new(enable: false); + using BinaryFormatterInClipboardDragDropScope binaryScope2 = new(enable: false); + Action tryGetDataWithResolver = () => Clipboard.TryGetData(format, TestData.TestDataResolver, out testData); + tryGetDataWithResolver.Should().Throw(); + } + + [Serializable] + private class TestData + { + public TestData(DateTime dateTime) + { + _count = 2; + _dateTime = dateTime; + } + + private readonly int _count; + private readonly DateTime _dateTime; + private readonly TestData1 _testData1 = new(); + + public void Equals(TestData actual) + { + _count.Should().Be(actual._count); + _dateTime.Should().Be(actual._dateTime); + _testData1.Text.Should().Be(actual._testData1.Text); + } + + public static Type TestDataResolver(TypeName typeName) + { + string fullName = typeName.FullName; + if (typeof(TestData).FullName == fullName) + { + return typeof(TestData); + } + + if (typeof(TestData1).FullName == fullName) + { + return typeof(TestData1); + } + + throw new NotSupportedException($"Can't resolve {typeName.AssemblyQualifiedName}"); + } + } + + [Serializable] + public class TestData1 + { + public string Text { get; } = "a"; + } + + [WinFormsFact] + public void Clipboard_TryGetObject_Throws() + { + object expected = new(); + string format = "TestData"; + Action tryGetData = () => Clipboard.TryGetData(format, out object? data); + + using BinaryFormatterScope scope = new(enable: true); + + using (BinaryFormatterInClipboardDragDropScope binaryFormatterScope = new(enable: true)) + { + Clipboard.SetData(format, expected); + + tryGetData.Should().Throw(); + } + + tryGetData.Should().Throw(); + } + + [WinFormsFact] + public void Clipboard_TryGetRectangleAsObject_Throws() + { + Rectangle expected = new(1, 1, 2, 2); + string format = "TestData"; + using BinaryFormatterScope scope = new(enable: true); + Clipboard.SetData(format, expected); + + Action tryGetData = () => Clipboard.TryGetData(format, out object? data); + tryGetData.Should().Throw(); + + using BinaryFormatterInClipboardDragDropScope binaryFormatterScope = new(enable: true); + tryGetData.Should().Throw(); + } + + [WinFormsFact] + public void Clipboard_TryGetNotSupportedException() + { + object expected = new(); + string format = "TestData"; + Action tryGetData = () => Clipboard.TryGetData(format, out object? data); + + using BinaryFormatterScope scope = new(enable: true); + // BinaryFormatterInClipboardDragDropScope is off, the NotSupportedException is written to the clipboard. + Clipboard.SetData(format, expected); + + using (BinaryFormatterInClipboardDragDropScope clipboardScope = new(enable: true)) + { + Clipboard.SetData(format, expected); + + tryGetData.Should().Throw(); + } + + tryGetData.Should().Throw(); + } + + [WinFormsFact] + public void Clipboard_TryGetOffsetArray() + { + Array value = Array.CreateInstance(typeof(uint), lengths: [2, 3], lowerBounds: [1, 2]); + value.SetValue(101u, 1, 2); + value.SetValue(102u, 1, 3); + value.SetValue(103u, 1, 4); + value.SetValue(201u, 2, 2); + value.SetValue(202u, 2, 3); + value.SetValue(203u, 2, 4); + + using BinaryFormatterFullCompatScope scope = new(); + Clipboard.SetData("test", value); + + var result = Clipboard.GetData("test").Should().BeOfType().Subject; + result.Rank.Should().Be(2); + result.GetLength(0).Should().Be(2); + result.GetLength(1).Should().Be(3); + result.GetLowerBound(0).Should().Be(1); + result.GetLowerBound(1).Should().Be(2); + result.GetValue(1, 2).Should().Be(101u); + result.GetValue(1, 3).Should().Be(102u); + result.GetValue(1, 4).Should().Be(103u); + result.GetValue(2, 2).Should().Be(201u); + result.GetValue(2, 3).Should().Be(202u); + result.GetValue(2, 4).Should().Be(203u); + + Action tryGetData = () => Clipboard.TryGetData("test", out uint[,]? data); + // Can't decode the root record, thus can't validate the T. + tryGetData.Should().Throw(); + } } diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectExtensionsTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectExtensionsTests.cs new file mode 100644 index 00000000000..7581acb0776 --- /dev/null +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectExtensionsTests.cs @@ -0,0 +1,261 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using System.Diagnostics.CodeAnalysis; +using System.Drawing; +using System.Reflection.Metadata; + +namespace System.Windows.Forms.Tests; + +public class DataObjectExtensionsTests +{ + [Fact] + public void TryGetData_Throws_ArgumentNullException() + { + // 'this' is null. + Action tryGetData1 = () => DataObjectExtensions.TryGetData(dataObject: null!, out _); + tryGetData1.Should().Throw(); + Action tryGetData2 = () => DataObjectExtensions.TryGetData(dataObject: null!, DataFormats.Text, out _); + tryGetData2.Should().Throw(); + Action tryGetData3 = () => DataObjectExtensions.TryGetData(dataObject: null!, DataFormats.Dib, autoConvert: true, out _); + tryGetData3.Should().Throw(); + Action tryGetData4 = () => DataObjectExtensions.TryGetData(dataObject: null!, DataFormats.EmfConstant, autoConvert: false, out _); + tryGetData4.Should().Throw(); + Action tryGetData5 = () => DataObjectExtensions.TryGetData(dataObject: null!, DataFormats.UnicodeText, Resolver, autoConvert: true, out _); + tryGetData5.Should().Throw(); + Action tryGetData6 = () => DataObjectExtensions.TryGetData(dataObject: null!, DataFormats.Serializable, Resolver, autoConvert: false, out _); + tryGetData6.Should().Throw(); + } + + private static Type Resolver(TypeName typeName) => typeof(string); + + [Fact] + public void TryGetData_Throws_NotSupportedException() + { + UntypedDataObject dataObject = new(); + Action tryGetData = () => dataObject.TryGetData(out _); + tryGetData.Should().Throw(); + dataObject.VerifyGetDataWasNotCalled(); + } + + [Fact] + public void TryGetData_String_Throws_NotSupportedException() + { + UntypedDataObject dataObject = new(); + Action tryGetData = () => dataObject.TryGetData(DataFormats.Text, out _); + tryGetData.Should().Throw(); + dataObject.VerifyGetDataWasNotCalled(); + } + + [Theory] + [BoolData] + public void TryGetData_StringBool_Throws_NotSupportedException(bool autoConvert) + { + UntypedDataObject dataObject = new(); + Action tryGetData = () => dataObject.TryGetData(DataFormats.CommaSeparatedValue, autoConvert, out _); + tryGetData.Should().Throw(); + dataObject.VerifyGetDataWasNotCalled(); + } + + [Theory] + [BoolData] + public void TryGetData_StringFuncBool_Throws_NotSupportedException(bool autoConvert) + { + UntypedDataObject dataObject = new(); + Action tryGetData = () => dataObject.TryGetData(DataFormats.UnicodeText, Resolver, autoConvert, out _); + tryGetData.Should().Throw(); + dataObject.VerifyGetDataWasNotCalled(); + } + + [Fact] + public void DataObject_ReturnFalse() + { + DataObject dataObject = new(); + dataObject.TryGetData(out string? text).Should().BeFalse(); + text.Should().BeNull(); + } + + [Fact] + public void DataObject_String_ReturnsFalse() + { + DataObject dataObject = new(); + dataObject.TryGetData(DataFormats.Dib, out Bitmap? bitmap).Should().BeFalse(); + bitmap.Should().BeNull(); + } + + [Theory] + [BoolData] + public void DataObject_StringBool_ReturnFalse(bool autoConvert) + { + DataObject dataObject = new(); + dataObject.TryGetData(DataFormats.Serializable, autoConvert, out Font? font).Should().BeFalse(); + font.Should().BeNull(); + } + + [Theory] + [BoolData] + public void DataObject_StringFuncBool_ReturnFalse(bool autoConvert) + { + DataObject dataObject = new(); + dataObject.TryGetData(DataFormats.SymbolicLink, Resolver, autoConvert, out DateTime? date).Should().BeFalse(); + date.Should().BeNull(); + } + + [Fact] + public void TypedDataObject_CallsITypedDataObject() + { + TypedDataObject dataObject = new(); + dataObject.TryGetData(out string? _).Should().BeFalse(); + dataObject.VerifyTryGetDataCalled(); + } + + [Fact] + public void TypedDataObject_String_CallsITypedDataObject() + { + TypedDataObject dataObject = new(); + dataObject.TryGetData(DataFormats.Dib, out Bitmap? _).Should().BeFalse(); + dataObject.VerifyTryGetDataStringCalled(); + } + + [Theory] + [BoolData] + public void TypedDataObject_StringBool_CallsITypedDataObject(bool autoConvert) + { + TypedDataObject dataObject = new(); + dataObject.TryGetData(DataFormats.FileDrop, autoConvert, out int? _).Should().BeFalse(); + dataObject.VerifyTryGetDataStringBoolCalled(); + } + + [Theory] + [BoolData] + public void TypedDataObject_StringFuncBool_CallsITypedDataObject(bool autoConvert) + { + TypedDataObject dataObject = new(); + dataObject.TryGetData(DataFormats.SymbolicLink, Resolver, autoConvert, out DateTime? date).Should().BeFalse(); + dataObject.VerifyTryGetDataStringFuncBoolCalled(); + } + + internal class UntypedDataObject : IDataObject + { + public void VerifyGetDataWasNotCalled() + { + GetDataType_Count.Should().Be(0); + GetDataString_Count.Should().Be(0); + GetDataStringBool_Count.Should().Be(0); + } + + private int GetDataStringBool_Count { get; set; } + public object? GetData(string format, bool autoConvert) + { + GetDataStringBool_Count++; + return null; + } + + private int GetDataString_Count { get; set; } + public object? GetData(string format) + { + GetDataString_Count++; + return null; + } + + private int GetDataType_Count { get; set; } + public object? GetData(Type format) + { + GetDataType_Count++; + return null; + } + + public bool GetDataPresent(string format, bool autoConvert) => throw new NotImplementedException(); + public bool GetDataPresent(string format) => throw new NotImplementedException(); + public bool GetDataPresent(Type format) => throw new NotImplementedException(); + public string[] GetFormats(bool autoConvert) => throw new NotImplementedException(); + public string[] GetFormats() => throw new NotImplementedException(); + public void SetData(string format, bool autoConvert, object? data) => throw new NotImplementedException(); + public void SetData(string format, object? data) => throw new NotImplementedException(); + public void SetData(Type format, object? data) => throw new NotImplementedException(); + public void SetData(object? data) => throw new NotImplementedException(); + } + + internal class TypedDataObject : ITypedDataObject + { + public object? GetData(string format, bool autoConvert) => throw new NotImplementedException(); + public object? GetData(string format) => throw new NotImplementedException(); + public object? GetData(Type format) => throw new NotImplementedException(); + public bool GetDataPresent(string format, bool autoConvert) => throw new NotImplementedException(); + public bool GetDataPresent(string format) => throw new NotImplementedException(); + public bool GetDataPresent(Type format) => throw new NotImplementedException(); + public string[] GetFormats(bool autoConvert) => throw new NotImplementedException(); + public string[] GetFormats() => throw new NotImplementedException(); + public void SetData(string format, bool autoConvert, object? data) => throw new NotImplementedException(); + public void SetData(string format, object? data) => throw new NotImplementedException(); + public void SetData(Type format, object? data) => throw new NotImplementedException(); + public void SetData(object? data) => throw new NotImplementedException(); + + private int _tryGetDataCalledCount; + private int _tryGetDataStringCalledCount; + private int _tryGetDataStringBoolCalledCount; + private int _tryGetDataStringFuncBoolCalledCount; + + public void VerifyTryGetDataCalled() + { + _tryGetDataCalledCount.Should().Be(1); + _tryGetDataStringCalledCount.Should().Be(0); + _tryGetDataStringBoolCalledCount.Should().Be(0); + _tryGetDataStringFuncBoolCalledCount.Should().Be(0); + } + + public void VerifyTryGetDataStringCalled() + { + _tryGetDataCalledCount.Should().Be(0); + _tryGetDataStringCalledCount.Should().Be(1); + _tryGetDataStringBoolCalledCount.Should().Be(0); + _tryGetDataStringFuncBoolCalledCount.Should().Be(0); + } + + public void VerifyTryGetDataStringBoolCalled() + { + _tryGetDataCalledCount.Should().Be(0); + _tryGetDataStringCalledCount.Should().Be(0); + _tryGetDataStringBoolCalledCount.Should().Be(1); + _tryGetDataStringFuncBoolCalledCount.Should().Be(0); + } + + public void VerifyTryGetDataStringFuncBoolCalled() + { + _tryGetDataCalledCount.Should().Be(0); + _tryGetDataStringCalledCount.Should().Be(0); + _tryGetDataStringBoolCalledCount.Should().Be(0); + _tryGetDataStringFuncBoolCalledCount.Should().Be(1); + } + + public bool TryGetData([MaybeNullWhen(false), NotNullWhen(true)] out T data) + { + _tryGetDataCalledCount++; + data = default; + return false; + } + + public bool TryGetData(string format, [MaybeNullWhen(false), NotNullWhen(true)] out T data) + { + _tryGetDataStringCalledCount++; + data = default; + return false; + } + + public bool TryGetData(string format, bool autoConvert, [MaybeNullWhen(false), NotNullWhen(true)] out T data) + { + _tryGetDataStringBoolCalledCount++; + data = default; + return false; + } + + public bool TryGetData(string format, Func resolver, bool autoConvert, [MaybeNullWhen(false), NotNullWhen(true)] out T data) + { + _tryGetDataStringFuncBoolCalledCount++; + data = default; + return false; + } + } +} diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.ClipboardTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.ClipboardTests.cs index a0a83e48aa5..c59959829a0 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.ClipboardTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.ClipboardTests.cs @@ -13,6 +13,7 @@ public partial class DataObjectTests // we should not run this test at the same time as other tests using the same format. [Collection("Sequential")] [UISettings(MaxAttempts = 3)] // Try up to 3 times before failing. + #pragma warning disable WFDEV005 // Type or member is obsolete public class ClipboardTests { public static TheoryData GetData_StringBool_TheoryData() diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.cs index 42941bc5973..200fa76e625 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.cs @@ -3,7 +3,9 @@ using System.Collections.Specialized; using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; using System.Drawing; +using System.Reflection.Metadata; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; using System.Runtime.Serialization; @@ -18,6 +20,7 @@ namespace System.Windows.Forms.Tests; // NB: doesn't require thread affinity public partial class DataObjectTests { +#pragma warning disable WFDEV005 // Type or member is obsolete private static readonly string[] s_restrictedClipboardFormats = [ DataFormats.CommaSeparatedValue, @@ -363,6 +366,143 @@ public void DataObject_GetData_InvokeTypeMocked_CallsGetData(Type format, object mockDataObject.Verify(o => o.GetData(formatName), Times.Exactly(expectedCallCount)); } + #nullable enable + internal class DataObjectOverridesTryGetDataCore : DataObject + { + private readonly string _format; + private readonly Func? _resolver; + private readonly bool _autoConvert; + + public DataObjectOverridesTryGetDataCore(string format, Func? resolver, bool autoConvert) : base() + { + _format = format; + _resolver = resolver; + _autoConvert = autoConvert; + } + + public int Count { get; private set; } + public static Type Resolver(TypeName _) => typeof(string); + + protected override bool TryGetDataCore( + string format, + Func? resolver, + bool autoConvert, + [NotNullWhen(true), MaybeNullWhen(false)] out T data) + { + format.Should().Be(_format); + resolver.Should().BeEquivalentTo(_resolver); + autoConvert.Should().Be(_autoConvert); + typeof(T).Should().Be(typeof(string)); + + Count++; + data = default; + return false; + } + } + + [Fact] + public void DataObject_TryGetData_InvokeString_CallsTryGetDataCore() + { + DataObjectOverridesTryGetDataCore dataObject = new(typeof(string).FullName!, resolver: null, autoConvert: false); + dataObject.Count.Should().Be(0); + + dataObject.TryGetData(out string? data).Should().BeFalse(); + data.Should().BeNull(); + dataObject.Count.Should().Be(1); + } + + public static TheoryData RestrictedAndUnrestrictedFormat => + [ + DataFormats.CommaSeparatedValue, + "something custom" + ]; + + [Theory] + [MemberData(nameof(RestrictedAndUnrestrictedFormat))] + public void TryGetData_InvokeStringString_CallsTryGetDataCore(string format) + { + DataObjectOverridesTryGetDataCore dataObject = new(format, null, autoConvert: false); + dataObject.Count.Should().Be(0); + + dataObject.TryGetData(format, out string? data).Should().BeFalse(); + data.Should().BeNull(); + dataObject.Count.Should().Be(1); + } + + [Fact] + public void TryGetData_InvokeStringString_ValidationFails() + { + string format = DataFormats.Bitmap; + DataObjectOverridesTryGetDataCore dataObject = new(format, null, autoConvert: false); + dataObject.Count.Should().Be(0); + + // Incompatible format and type. + Action tryGetData = () => dataObject.TryGetData(format, out string? data); + tryGetData.Should().Throw(); + dataObject.Count.Should().Be(0); + } + + public static TheoryData FormatAndAutoConvert => new() + { + { DataFormats.CommaSeparatedValue, true }, + { "something custom", true }, + { DataFormats.CommaSeparatedValue, false }, + { "something custom", false } + }; + + [Theory] + [MemberData(nameof(FormatAndAutoConvert))] + public void TryGetData_InvokeStringBoolString_CallsTryGetDataCore(string format, bool autoConvert) + { + DataObjectOverridesTryGetDataCore dataObject = new(format, resolver: null, autoConvert); + dataObject.Count.Should().Be(0); + + dataObject.TryGetData(format, autoConvert, out string? data).Should().BeFalse(); + data.Should().BeNull(); + dataObject.Count.Should().Be(1); + } + + private static Type NotSupportedResolver(TypeName typeName) => throw new NotSupportedException(); + + [Theory] + [BoolData] + public void TryGetData_InvokeStringBoolString_ValidationFails(bool autoConvert) + { + string format = DataFormats.Bitmap; + DataObjectOverridesTryGetDataCore dataObject = new(format, NotSupportedResolver, autoConvert); + dataObject.Count.Should().Be(0); + + Action tryGetData = () => dataObject.TryGetData(format, autoConvert, out string? data); + tryGetData.Should().Throw(); + dataObject.Count.Should().Be(0); + } + + [Theory] + [MemberData(nameof(FormatAndAutoConvert))] + public void DataObject_TryGetData_InvokeStringFuncBoolString_CallsTryGetDataCore(string format, bool autoConvert) + { + DataObjectOverridesTryGetDataCore dataObject = new(format, DataObjectOverridesTryGetDataCore.Resolver, autoConvert); + dataObject.Count.Should().Be(0); + + dataObject.TryGetData(format, DataObjectOverridesTryGetDataCore.Resolver, autoConvert, out string? data).Should().BeFalse(); + data.Should().BeNull(); + dataObject.Count.Should().Be(1); + } + + [Theory] + [BoolData] + public void TryGetData_InvokeStringFuncBoolString_ValidationFails(bool autoConvert) + { + string format = DataFormats.Bitmap; + DataObjectOverridesTryGetDataCore dataObject = new(format, DataObjectOverridesTryGetDataCore.Resolver, autoConvert); + dataObject.Count.Should().Be(0); + + Action tryGetData = () => dataObject.TryGetData(format, DataObjectOverridesTryGetDataCore.Resolver, autoConvert, out string? data); + tryGetData.Should().Throw(); + dataObject.Count.Should().Be(0); + } + #nullable disable + [Theory] [MemberData(nameof(GetData_String_TheoryData))] [MemberData(nameof(GetData_String_UnboundedFormat_TheoryData))] @@ -1011,6 +1151,58 @@ public void DataObject_SetData_NullData_ThrowsArgumentNullException() ((Action)(() => dataObject.SetData(null))).Should().Throw().WithParameterName("data"); } + public static TheoryData SetData_StringObject_TheoryData() + { + TheoryData theoryData = new(); + foreach (string format in s_restrictedClipboardFormats) + { + if (string.IsNullOrWhiteSpace(format) || format == typeof(Bitmap).FullName || format.StartsWith("FileName", StringComparison.Ordinal)) + { + continue; + } + + theoryData.Add(format, null, format == DataFormats.FileDrop, format == DataFormats.Bitmap); + theoryData.Add(format, "input", format == DataFormats.FileDrop, format == DataFormats.Bitmap); + } + + theoryData.Add(typeof(Bitmap).FullName, null, false, true); + theoryData.Add(typeof(Bitmap).FullName, "input", false, true); + + theoryData.Add("FileName", null, true, false); + theoryData.Add("FileName", "input", true, false); + + theoryData.Add("FileNameW", null, true, false); + theoryData.Add("FileNameW", "input", true, false); + + return theoryData; + } + + [Theory] + [MemberData(nameof(SetData_StringObject_TheoryData))] + private void DataObject_SetData_InvokeStringObject_GetReturnsExpected(string format, string input, bool expectedContainsFileDropList, bool expectedContainsImage) + { + DataObject dataObject = new(); + dataObject.SetData(format, input); + + dataObject.GetDataPresent(format).Should().BeTrue(); + dataObject.GetDataPresent(format, autoConvert: false).Should().BeTrue(); + dataObject.GetDataPresent(format, autoConvert: true).Should().BeTrue(); + + dataObject.GetData(format).Should().Be(input); + dataObject.GetData(format, autoConvert: false).Should().Be(input); + dataObject.GetData(format, autoConvert: true).Should().Be(input); + + dataObject.ContainsAudio().Should().Be(format == DataFormats.WaveAudio); + dataObject.ContainsFileDropList().Should().Be(expectedContainsFileDropList); + dataObject.ContainsImage().Should().Be(expectedContainsImage); + dataObject.ContainsText().Should().Be(format == DataFormats.UnicodeText); + dataObject.ContainsText(TextDataFormat.Text).Should().Be(format == DataFormats.UnicodeText); + dataObject.ContainsText(TextDataFormat.UnicodeText).Should().Be(format == DataFormats.UnicodeText); + dataObject.ContainsText(TextDataFormat.Rtf).Should().Be(format == DataFormats.Rtf); + dataObject.ContainsText(TextDataFormat.Html).Should().Be(format == DataFormats.Html); + dataObject.ContainsText(TextDataFormat.CommaSeparatedValue).Should().Be(format == DataFormats.CommaSeparatedValue); + } + [Theory] [InlineData(DataFormats.SerializableConstant, null)] [InlineData(DataFormats.SerializableConstant, "input")] @@ -1029,6 +1221,17 @@ private void DataObject_SetData_InvokeStringObject_Unbounded_GetReturnsExpected( dataObject.GetData(format, autoConvert: false).Should().Be(input); dataObject.GetData(format, autoConvert: true).Should().Be(input); + _ = dataObject.TryGetData(format, out object _).Should().Be(input is not null); + _ = dataObject.TryGetData(format, autoConvert: false, out object _).Should().Be(input is not null); + _ = dataObject.TryGetData(format, autoConvert: true, out object _).Should().Be(input is not null); + _ = dataObject.TryGetData(format, NotSupportedResolver, autoConvert: true, out object _).Should().Be(input is not null); + _ = dataObject.TryGetData(format, NotSupportedResolver, autoConvert: false, out object _).Should().Be(input is not null); + + dataObject.TryGetData(format, NotSupportedResolver, autoConvert: false, out string data).Should().Be(input is not null); + data.Should().Be(input); + dataObject.TryGetData(format, NotSupportedResolver, autoConvert: true, out data).Should().Be(input is not null); + data.Should().Be(input); + dataObject.ContainsAudio().Should().BeFalse(); dataObject.ContainsFileDropList().Should().BeFalse(); dataObject.ContainsImage().Should().BeFalse(); @@ -1089,6 +1292,66 @@ public void DataObject_SetData_InvokeStringObjectIDataObject_CallsSetData(string mockDataObject.Verify(o => o.SetData(format, data), Times.Once()); } + public static TheoryData SetData_StringBoolObject_TheoryData() + { + TheoryData theoryData = new(); + + foreach (string format in s_restrictedClipboardFormats) + { + if (string.IsNullOrWhiteSpace(format) || format == typeof(Bitmap).FullName || format.StartsWith("FileName", StringComparison.Ordinal)) + { + continue; + } + + foreach (bool autoConvert in new bool[] { true, false }) + { + theoryData.Add(format, autoConvert, null, format == DataFormats.FileDrop, format == DataFormats.Bitmap); + theoryData.Add(format, autoConvert, "input", format == DataFormats.FileDrop, format == DataFormats.Bitmap); + } + } + + theoryData.Add(typeof(Bitmap).FullName, false, null, false, false); + theoryData.Add(typeof(Bitmap).FullName, false, "input", false, false); + theoryData.Add(typeof(Bitmap).FullName, true, null, false, true); + theoryData.Add(typeof(Bitmap).FullName, true, "input", false, true); + + theoryData.Add("FileName", false, null, false, false); + theoryData.Add("FileName", false, "input", false, false); + theoryData.Add("FileName", true, null, true, false); + theoryData.Add("FileName", true, "input", true, false); + + theoryData.Add("FileNameW", false, null, false, false); + theoryData.Add("FileNameW", false, "input", false, false); + theoryData.Add("FileNameW", true, null, true, false); + theoryData.Add("FileNameW", true, "input", true, false); + + return theoryData; + } + + [Theory] + [MemberData(nameof(SetData_StringBoolObject_TheoryData))] + private void DataObject_SetData_InvokeStringBoolObject_GetReturnsExpected(string format, bool autoConvert, string input, bool expectedContainsFileDropList, bool expectedContainsImage) + { + DataObject dataObject = new(); + dataObject.SetData(format, autoConvert, input); + + dataObject.GetData(format, autoConvert: false).Should().Be(input); + dataObject.GetData(format, autoConvert: true).Should().Be(input); + + dataObject.GetDataPresent(format, autoConvert: true).Should().BeTrue(); + dataObject.GetDataPresent(format, autoConvert: false).Should().BeTrue(); + + dataObject.ContainsAudio().Should().Be(format == DataFormats.WaveAudio); + dataObject.ContainsFileDropList().Should().Be(expectedContainsFileDropList); + dataObject.ContainsImage().Should().Be(expectedContainsImage); + dataObject.ContainsText().Should().Be(format == DataFormats.UnicodeText); + dataObject.ContainsText(TextDataFormat.Text).Should().Be(format == DataFormats.UnicodeText); + dataObject.ContainsText(TextDataFormat.UnicodeText).Should().Be(format == DataFormats.UnicodeText); + dataObject.ContainsText(TextDataFormat.Rtf).Should().Be(format == DataFormats.Rtf); + dataObject.ContainsText(TextDataFormat.Html).Should().Be(format == DataFormats.Html); + dataObject.ContainsText(TextDataFormat.CommaSeparatedValue).Should().Be(format == DataFormats.CommaSeparatedValue); + } + [Theory] [InlineData("something custom", false, "input")] [InlineData("something custom", false, null)] @@ -1098,7 +1361,7 @@ public void DataObject_SetData_InvokeStringObjectIDataObject_CallsSetData(string [InlineData(DataFormats.SerializableConstant, false, null)] [InlineData(DataFormats.SerializableConstant, true, "input")] [InlineData(DataFormats.SerializableConstant, true, null)] - private void DataObject_SetData_InvokeStringBoolObject_Unbounded_GetReturnsExpected(string format, bool autoConvert, string input) + private void DataObject_SetData_InvokeStringBoolObject_Unbounded(string format, bool autoConvert, string input) { DataObject dataObject = new(); dataObject.SetData(format, autoConvert, input); @@ -1106,6 +1369,19 @@ private void DataObject_SetData_InvokeStringBoolObject_Unbounded_GetReturnsExpec dataObject.GetData(format, autoConvert: false).Should().Be(input); dataObject.GetData(format, autoConvert: true).Should().Be(input); + dataObject.TryGetData(format, out string data).Should().Be(input is not null); + data.Should().Be(input); + + dataObject.TryGetData(format, autoConvert: false, out data).Should().Be(input is not null); + data.Should().Be(input); + dataObject.TryGetData(format, autoConvert: true, out data).Should().Be(input is not null); + data.Should().Be(input); + + dataObject.TryGetData(format, NotSupportedResolver, autoConvert: false, out data).Should().Be(input is not null); + data.Should().Be(input); + dataObject.TryGetData(format, NotSupportedResolver, autoConvert: true, out data).Should().Be(input is not null); + data.Should().Be(input); + dataObject.GetDataPresent(format, autoConvert: true).Should().BeTrue(); dataObject.GetDataPresent(format, autoConvert: false).Should().BeTrue(); @@ -1574,7 +1850,7 @@ public void GetData(ref FORMATETC format, out STGMEDIUM medium) public int QueryGetData(ref FORMATETC format) { - // do not check the requested storage medium, we always return a metafile handle, thats what Office does + // do not check the requested storage medium, we always return a metafile handle, that's what Office does if (format.cfFormat != (short)CLIPBOARD_FORMAT.CF_ENHMETAFILE || format.dwAspect != DVASPECT.DVASPECT_CONTENT || format.lindex != -1) return (int)HRESULT.DV_E_FORMATETC; diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DragDropHelperTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DragDropHelperTests.cs index d7bca506f90..113f5684ed2 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DragDropHelperTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DragDropHelperTests.cs @@ -108,7 +108,9 @@ public unsafe void SetDragImage_DataObject_Bitmap_Point_bool_ReturnsExpected(Dat try { DragDropHelper.SetDragImage(dataObject, dragImage, cursorOffset, useDefaultDragImage); - DragDropFormat dragDropFormat = (DragDropFormat)dataObject.GetData(DragDropHelper.DRAGIMAGEBITS); + // This DataObject is backed up by the DataStore. + dataObject.TryGetData(DragDropHelper.DRAGIMAGEBITS, out DragDropFormat dragDropFormat).Should().BeTrue(); + dragDropFormat.Should().NotBeNull(); void* basePtr = PInvokeCore.GlobalLock(dragDropFormat.Medium.hGlobal); SHDRAGIMAGE* pDragImage = (SHDRAGIMAGE*)basePtr; bool isDragImageNull = BitOperations.LeadingZeroCount((uint)(nint)pDragImage->hbmpDragImage).Equals(32); @@ -132,7 +134,9 @@ public unsafe void SetDragImage_DataObject_GiveFeedbackEventArgs_ReturnsExpected try { DragDropHelper.SetDragImage(dataObject, e); - DragDropFormat dragDropFormat = (DragDropFormat)dataObject.GetData(DragDropHelper.DRAGIMAGEBITS); + // This DataObject is backed up by the DataStore. + dataObject.TryGetData(DragDropHelper.DRAGIMAGEBITS, out DragDropFormat dragDropFormat).Should().BeTrue(); + dragDropFormat.Should().NotBeNull(); void* basePtr = PInvokeCore.GlobalLock(dragDropFormat.Medium.hGlobal); SHDRAGIMAGE* pDragImage = (SHDRAGIMAGE*)basePtr; bool isDragImageNull = BitOperations.LeadingZeroCount((uint)(nint)pDragImage->hbmpDragImage).Equals(32); @@ -181,7 +185,8 @@ public unsafe void SetDropDescription_ClearDropDescription_ReturnsExpected(DataO { DragDropHelper.SetDropDescription(dataObject, dropImageType, message, messageReplacementToken); DragDropHelper.ClearDropDescription(dataObject); - DragDropFormat dragDropFormat = (DragDropFormat)dataObject.GetData(PInvoke.CFSTR_DROPDESCRIPTION); + dataObject.TryGetData(PInvoke.CFSTR_DROPDESCRIPTION, autoConvert: false, out DragDropFormat dragDropFormat).Should().BeTrue(); + dragDropFormat.Should().NotBeNull(); void* basePtr = PInvokeCore.GlobalLock(dragDropFormat.Medium.hGlobal); DROPDESCRIPTION* pDropDescription = (DROPDESCRIPTION*)basePtr; DROPIMAGETYPE type = pDropDescription->type; @@ -247,7 +252,7 @@ public unsafe void SetDropDescription_ReleaseDragDropFormats_ReturnsExpected(Dat foreach (string format in dataObject.GetFormats()) { - if (dataObject.GetData(format) is DragDropFormat dragDropFormat) + if (dataObject.TryGetData(format, out DragDropFormat dragDropFormat)) { Assert.Equal(nint.Zero, (nint)dragDropFormat.Medium.pUnkForRelease); Assert.Equal(Com.TYMED.TYMED_NULL, dragDropFormat.Medium.tymed); @@ -263,7 +268,7 @@ public unsafe void SetDropDescription_DragEventArgs_ReturnsExpected(DragEventArg try { DragDropHelper.SetDropDescription(e); - DragDropFormat dragDropFormat = (DragDropFormat)e.Data.GetData(PInvoke.CFSTR_DROPDESCRIPTION); + e.Data.TryGetData(PInvoke.CFSTR_DROPDESCRIPTION, out DragDropFormat dragDropFormat).Should().BeTrue(); void* basePtr = PInvokeCore.GlobalLock(dragDropFormat.Medium.hGlobal); DROPDESCRIPTION* pDropDescription = (DROPDESCRIPTION*)basePtr; DROPIMAGETYPE type = pDropDescription->type; @@ -290,7 +295,7 @@ public unsafe void SetDropDescription_DataObject_DropImageType_string_string_Ret try { DragDropHelper.SetDropDescription(dataObject, dropImageType, message, messageReplacementToken); - DragDropFormat dragDropFormat = (DragDropFormat)dataObject.GetData(PInvoke.CFSTR_DROPDESCRIPTION); + dataObject.TryGetData(PInvoke.CFSTR_DROPDESCRIPTION, autoConvert: false, out DragDropFormat dragDropFormat).Should().BeTrue(); void* basePtr = PInvokeCore.GlobalLock(dragDropFormat.Medium.hGlobal); DROPDESCRIPTION* pDropDescription = (DROPDESCRIPTION*)basePtr; DROPIMAGETYPE type = pDropDescription->type; @@ -321,7 +326,7 @@ public unsafe void SetInDragLoop_ReturnsExpected(DataObject dataObject, bool inD try { DragDropHelper.SetInDragLoop(dataObject, inDragLoop); - DragDropFormat dragDropFormat = (DragDropFormat)dataObject.GetData(PInvoke.CFSTR_INDRAGLOOP); + dataObject.TryGetData(PInvoke.CFSTR_INDRAGLOOP, out DragDropFormat dragDropFormat).Should().BeTrue(); void* basePtr = PInvokeCore.GlobalLock(dragDropFormat.Medium.hGlobal); bool inShellDragLoop = (basePtr is not null) && (*(BOOL*)basePtr == true); PInvokeCore.GlobalUnlock(dragDropFormat.Medium.hGlobal); diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/NativeToWinFormsAdapterTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/NativeToWinFormsAdapterTests.cs new file mode 100644 index 00000000000..c8bfb13e52f --- /dev/null +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/NativeToWinFormsAdapterTests.cs @@ -0,0 +1,533 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using System.Drawing; +using System.Reflection.Metadata; +using Com = Windows.Win32.System.Com; + +namespace System.Windows.Forms.Tests; + +public unsafe class NativeToWinFormsAdapterTests +{ + public static TheoryData UnboundedFormat() => + [ + DataFormats.Serializable, + "something custom" + ]; + + // These formats contain only known types. + public static TheoryData UndefinedRestrictedFormat() => + [ + DataFormats.CommaSeparatedValue, + DataFormats.Dib, + DataFormats.Dif, + DataFormats.PenData, + DataFormats.Riff, + DataFormats.Tiff, + DataFormats.WaveAudio, + DataFormats.SymbolicLink, + DataFormats.EnhancedMetafile, + DataFormats.MetafilePict, + DataFormats.Palette + ]; + + public static TheoryData BitmapFormat() => + [ + DataFormats.Bitmap, + "System.Drawing.Bitmap" + ]; + + // These formats set and get strings by accessing HGLOBAL directly. + public static TheoryData StringFormat() => + [ + DataFormats.Text, + DataFormats.UnicodeText, + DataFormats.StringConstant, + DataFormats.Rtf, + DataFormats.Html, + DataFormats.OemText, + DataFormats.FileDrop, + "FileName", + "FileNameW" + ]; + + private const string InvalidTypeFormatCombinationMessage = "Type '*' is not compatible with the specified format '*'."; + private const string RequiresResolverMessage = + $"'*' is not a concrete type, and could allow for unbounded deserialization. Use a concrete type or" + + $" define a resolver function that supports types that you are retrieving from the Clipboard or being dragged and dropped."; + private const string UseTryGetDataWithResolver = + "Use 'TryGetData' method with a 'resolver' function that defines a set of allowed types, to deserialize '*'."; + private const string FormatterDisabledMessage = + "BinaryFormatter serialization and deserialization are disabled within this application. See https://aka.ms/binaryformatter for more information."; + + [WinFormsTheory] + [MemberData(nameof(UndefinedRestrictedFormat))] + public void TryGetData_AsObject_Primitive_Success(string format) + { + DataObject native = new(); + // Primitive type is serialized by generating the record field by field. + native.SetData(format, 1); + DataObject dataObject = new(ComHelpers.GetComPointer(native)); + + // Format is compatible with `object` type, validation passed. + // The `int` type can be assigned to an `object`, thus record type matched the requested type. + // The primitive type is read from the serialization record field by field. + dataObject.TryGetData(format, out object? value).Should().BeTrue(); + value.Should().Be(1); + } + + [WinFormsTheory] + [MemberData(nameof(UnboundedFormat))] + public void TryGetData_AsObject_Primitive_RequiresResolver(string format) + { + DataObject native = new(); + // Primitive type is serialized by generating the record field by field. + native.SetData(format, 1); + DataObject dataObject = new(ComHelpers.GetComPointer(native)); + + Action tryGetData = () => dataObject.TryGetData(format, out object? value); + tryGetData.Should().Throw().WithMessage(expectedWildcardPattern: RequiresResolverMessage); + + dataObject.TryGetData(format, Resolver, autoConvert: false, out object? value).Should().BeTrue(); + value.Should().Be(1); + + static Type Resolver(TypeName typeName) => typeof(int); + } + + [WinFormsTheory] + [MemberData(nameof(StringFormat))] + [MemberData(nameof(BitmapFormat))] + public void TryGetData_AsObject_Primitive_InvalidTypeFormatCombination(string format) + { + DataObject native = new(); + native.SetData(format, 1); + DataObject dataObject = new(ComHelpers.GetComPointer(native)); + + // Throw when validating arguments, as these formats allow exactly strings or bitmaps only. + Action tryGetData = () => dataObject.TryGetData(format, out object? _); + tryGetData.Should().Throw() + .WithMessage(expectedWildcardPattern: InvalidTypeFormatCombinationMessage); + } + + private static (DataObject dataObject, TestData value) SetDataObject(string format) + { + DataObject native = new(); + TestData value = new(new(6, 7)); + // This code does not flush the data. + native.SetData(format, value); + DataObject dataObject = new(ComHelpers.GetComPointer(native)); + + return (dataObject, value); + } + + [WinFormsTheory] + [MemberData(nameof(UnboundedFormat))] + public void TryGetData_AsObject_Custom_RequiresResolver(string format) + { + (DataObject dataObject, TestData _) = SetDataObject(format); + Action tryGetData = () => dataObject.TryGetData(format, out object? _); + + tryGetData.Should().Throw().WithMessage(expectedWildcardPattern: RequiresResolverMessage); + } + + [WinFormsTheory] + [MemberData(nameof(UnboundedFormat))] + public void TryGetData_AsObject_Custom_FormatterEnabled_RequiresResolver(string format) + { + (DataObject dataObject, TestData _) = SetDataObject(format); + Action tryGetData = () => dataObject.TryGetData(format, out object? _); + + using BinaryFormatterScope scope = new(enable: true); + using BinaryFormatterInClipboardDragDropScope clipboardScope = new(enable: true); + + tryGetData.Should().Throw().WithMessage(expectedWildcardPattern: RequiresResolverMessage); + } + + [WinFormsTheory] + [MemberData(nameof(StringFormat))] + [MemberData(nameof(BitmapFormat))] + public void TryGetData_AsObject_Custom_InvalidTypeFormatCombination(string format) + { + (DataObject dataObject, TestData _) = SetDataObject(format); + Action tryGetData = () => dataObject.TryGetData(format, out object? _); + + // Type-Format combination is validated before the we attempt to serialize data. + tryGetData.Should().Throw() + .WithMessage(expectedWildcardPattern: InvalidTypeFormatCombinationMessage); + } + + [WinFormsTheory] + [MemberData(nameof(UndefinedRestrictedFormat))] + public void TryGetData_AsObject_Custom_ReturnsNotSupportedException(string format) + { + (DataObject dataObject, TestData _) = SetDataObject(format); + + // SetData writes NotSupportedException to HGLOBAL to indicate that formatters are disabled, + // but the restricted format can't read it. + dataObject.TryGetData(format, out object? result).Should().BeFalse(); + result.Should().BeNull(); + } + + [WinFormsTheory] + [MemberData(nameof(UndefinedRestrictedFormat))] + public void TryGetData_AsObject_Custom_FormatterEnabled_ReturnsFalse(string format) + { + (DataObject dataObject, TestData _) = SetDataObject(format); + + using BinaryFormatterScope scope = new(enable: true); + using BinaryFormatterInClipboardDragDropScope clipboardScope = new(enable: true); + + dataObject.TryGetData(format, out object? result).Should().BeFalse(); + result.Should().BeNull(); + } + + [WinFormsTheory] + [MemberData(nameof(UndefinedRestrictedFormat))] + public void TryGetData_AsInterface_ListOfPrimitives_Success(string format) + { + DataObject native = new(); + List value = [1]; + native.SetData(format, value); + DataObject dataObject = new(ComHelpers.GetComPointer(native)); + + dataObject.TryGetData(format, out IList? list).Should().BeTrue(); + list.Should().BeEquivalentTo(value); + } + + [WinFormsTheory] + [MemberData(nameof(UnboundedFormat))] + public void TryGetData_AsInterface_ListOfPrimitives_RequiresResolver(string format) + { + DataObject native = new(); + List value = [1]; + native.SetData(format, value); + DataObject dataObject = new(ComHelpers.GetComPointer(native)); + + // Theoretically we don't require a resolver here, but this is an exception. In the more common cases resolver + // is required to instantiate non-concrete types. + Action tryGetData = () => dataObject.TryGetData(format, out IList? _); + tryGetData.Should().Throw().WithMessage(expectedWildcardPattern: RequiresResolverMessage); + } + + [WinFormsTheory] + [MemberData(nameof(StringFormat))] + [MemberData(nameof(BitmapFormat))] + public void TryGetData_AsInterface_ListOfPrimitives_InvalidTypeFormatCombination(string format) + { + DataObject native = new(); + List value = [1]; + native.SetData(format, value); + DataObject dataObject = new(ComHelpers.GetComPointer(native)); + + Action tryGetData = () => dataObject.TryGetData(format, out IList? _); + tryGetData.Should().Throw() + .WithMessage(expectedWildcardPattern: InvalidTypeFormatCombinationMessage); + } + + [WinFormsTheory] + [MemberData(nameof(UnboundedFormat))] + [MemberData(nameof(UndefinedRestrictedFormat))] + public void TryGetData_AsConcreteType_ListOfPrimitives_Success(string format) + { + DataObject native = new(); + List value = [1]; + native.SetData(format, value); + DataObject dataObject = new(ComHelpers.GetComPointer(native)); + + dataObject.TryGetData(format, out List? list).Should().BeTrue(); + list.Should().BeEquivalentTo(value); + } + + [WinFormsTheory] + [MemberData(nameof(StringFormat))] + [MemberData(nameof(BitmapFormat))] + public void TryGetData_AsConcreteType_ListOfPrimitives_InvalidTypeFormatCombination(string format) + { + DataObject native = new(); + List value = [1]; + native.SetData(format, value); + DataObject dataObject = new(ComHelpers.GetComPointer(native)); + + Action tryGetData = () => dataObject.TryGetData(format, out List? _); + tryGetData.Should().Throw() + .WithMessage(expectedWildcardPattern: InvalidTypeFormatCombinationMessage); + } + + [WinFormsTheory] + [MemberData(nameof(UnboundedFormat))] + public void TryGetData_AsConcreteType_Custom_FormatterEnabled_RequiresResolver(string format) + { + (DataObject dataObject, TestData _) = SetDataObject(format); + Action tryGetData = () => dataObject.TryGetData(format, out TestData? _); + + using BinaryFormatterScope scope = new(enable: true); + using BinaryFormatterInClipboardDragDropScope clipboardScope = new(enable: true); + + tryGetData.Should().Throw().WithMessage(expectedWildcardPattern: UseTryGetDataWithResolver); + } + + [WinFormsTheory] + [MemberData(nameof(UndefinedRestrictedFormat))] + public void TryGetData_AsConcreteType_Custom_FormatterEnabled_ReturnsFalse(string format) + { + (DataObject dataObject, TestData _) = SetDataObject(format); + + using BinaryFormatterScope scope = new(enable: true); + using BinaryFormatterInClipboardDragDropScope clipboardScope = new(enable: true); + + // Format-type combination is invalid, serialization threw an exception. + dataObject.TryGetData(format, out TestData? testData).Should().BeFalse(); + testData.Should().BeNull(); + } + + [WinFormsTheory] + [MemberData(nameof(UndefinedRestrictedFormat))] + public void TryGetData_AsConcreteType_Custom_FormattersDisabled_ReturnFalse(string format) + { + (DataObject dataObject, TestData _) = SetDataObject(format); + + // Formatters are not supported, HGLOBAL contains NotSupportedException + // but these formats are not compatible with this type on the clipboard. + dataObject.TryGetData(format, out TestData? testData).Should().BeFalse(); + testData.Should().BeNull(); + } + + [WinFormsTheory] + [MemberData(nameof(StringFormat))] + [MemberData(nameof(BitmapFormat))] + public void TryGetData_AsConcreteType_Custom_InvalidTypeFormatCombination(string format) + { + (DataObject dataObject, TestData _) = SetDataObject(format); + + Action tryGetData = () => dataObject.TryGetData(format, out TestData? _); + tryGetData.Should().Throw() + .WithMessage(expectedWildcardPattern: InvalidTypeFormatCombinationMessage); + } + + [WinFormsTheory] + [MemberData(nameof(UnboundedFormat))] + public void TryGetData_WithResolver_AsConcreteType_Custom_FormatterEnabled_Success(string format) + { + (DataObject dataObject, TestData value) = SetDataObject(format); + + using BinaryFormatterScope scope = new(enable: true); + using BinaryFormatterInClipboardDragDropScope clipboardScope = new(enable: true); + + dataObject.TryGetData(format, TestData.Resolver, autoConvert: true, out TestData? testData).Should().BeTrue(); + testData.Should().BeEquivalentTo(value); + } + + [WinFormsTheory] + [MemberData(nameof(StringFormat))] + [MemberData(nameof(BitmapFormat))] + public void TryGetData_WithResolver_AsConcreteType_Custom_InvalidTypeFormatCombination(string format) + { + (DataObject dataObject, TestData _) = SetDataObject(format); + Action tryGetData = () => dataObject.TryGetData(format, TestData.Resolver, autoConvert: true, out TestData? _); + + tryGetData.Should().Throw() + .WithMessage(expectedWildcardPattern: InvalidTypeFormatCombinationMessage); + } + + [WinFormsTheory] + [MemberData(nameof(StringFormat))] + [MemberData(nameof(BitmapFormat))] + public void TryGetData_WithResolver_AsConcreteType_Custom_FormatterEnabled_InvalidTypeFormatCombination(string format) + { + (DataObject dataObject, TestData _) = SetDataObject(format); + Action tryGetData = () => dataObject.TryGetData(format, TestData.Resolver, autoConvert: true, out TestData? _); + + using BinaryFormatterScope scope = new(enable: true); + using BinaryFormatterInClipboardDragDropScope clipboardScope = new(enable: true); + + tryGetData.Should().Throw() + .WithMessage(expectedWildcardPattern: InvalidTypeFormatCombinationMessage); + } + + [WinFormsTheory] + [MemberData(nameof(UndefinedRestrictedFormat))] + public void TryGetData_WithResolver_AsConcreteType_Custom_FormatterDisabledException(string format) + { + (DataObject dataObject, TestData _) = SetDataObject(format); + + // Formatter is not enabled, HGLOBAL contains NotSupportedException, we can't read it, assume wrong type on the clipboard. + dataObject.TryGetData(format, TestData.Resolver, autoConvert: true, out TestData? testData).Should().BeFalse(); + testData.Should().BeNull(); + } + + [WinFormsTheory] + [MemberData(nameof(UndefinedRestrictedFormat))] + public void TryGetData_AsAbstract_Custom_FormatterEnabled_ReturnFalse(string format) + { + (DataObject dataObject, TestData _) = SetDataObject(format); + + using BinaryFormatterScope scope = new(enable: true); + using BinaryFormatterInClipboardDragDropScope clipboardScope = new(enable: true); + + // Format-type combination is invalid, serialization threw an exception. + dataObject.TryGetData(format, out AbstractBase? testData).Should().BeFalse(); + testData.Should().BeNull(); + } + + [WinFormsTheory] + [MemberData(nameof(StringFormat))] + [MemberData(nameof(BitmapFormat))] + public void TryGetData_AsAbstract_Custom_InvalidTypeFormatCombination(string format) + { + (DataObject dataObject, TestData _) = SetDataObject(format); + + Action tryGetData = () => dataObject.TryGetData(format, out AbstractBase? _); + tryGetData.Should().Throw() + .WithMessage(expectedWildcardPattern: InvalidTypeFormatCombinationMessage); + } + + [WinFormsTheory] + [MemberData(nameof(UnboundedFormat))] + public void TryGetData_AsAbstract_Custom_RequiresResolver(string format) + { + (DataObject dataObject, TestData _) = SetDataObject(format); + Action tryGetData = () => dataObject.TryGetData(format, out AbstractBase? _); + + tryGetData.Should().Throw().WithMessage(expectedWildcardPattern: RequiresResolverMessage); + + dataObject.TryGetData(format, out NotSupportedException? ex).Should().BeTrue(); + ex.Should().BeOfType().Which.Message.Should().Be(FormatterDisabledMessage); + } + + [WinFormsTheory] + [MemberData(nameof(UnboundedFormat))] + public void TryGetData_AsAbstract_Custom_FormatterEnabled_RequiresResolver(string format) + { + (DataObject dataObject, TestData _) = SetDataObject(format); + Action tryGetData = () => dataObject.TryGetData(format, out AbstractBase? _); + + using BinaryFormatterScope scope = new(enable: true); + using BinaryFormatterInClipboardDragDropScope clipboardScope = new(enable: true); + + tryGetData.Should().Throw().WithMessage(expectedWildcardPattern: RequiresResolverMessage); + } + + [WinFormsTheory] + [MemberData(nameof(UndefinedRestrictedFormat))] + public void TryGetData_WithResolver_AsAbstract_Custom_FormatterEnabled_ReturnFalse(string format) + { + (DataObject dataObject, TestData _) = SetDataObject(format); + + using BinaryFormatterScope scope = new(enable: true); + using BinaryFormatterInClipboardDragDropScope clipboardScope = new(enable: true); + + // Format-type combination is validated, but serialization threw an exception + dataObject.TryGetData(format, TestData.Resolver, autoConvert: true, out AbstractBase? testData).Should().BeFalse(); + testData.Should().BeNull(); + } + + [WinFormsTheory] + [MemberData(nameof(UnboundedFormat))] + public void TryGetData_WithResolver_AsAbstract_Custom_FormatterEnabled_Success(string format) + { + (DataObject dataObject, TestData value) = SetDataObject(format); + + using BinaryFormatterScope scope = new(enable: true); + using BinaryFormatterInClipboardDragDropScope clipboardScope = new(enable: true); + + dataObject.TryGetData(format, TestData.Resolver, autoConvert: true, out AbstractBase? testData).Should().BeTrue(); + testData.Should().BeEquivalentTo(value); + } + + [WinFormsTheory] + [MemberData(nameof(StringFormat))] + [MemberData(nameof(BitmapFormat))] + public void TryGetData_WithResolver_AsAbstract_Custom_InvalidTypeFormatCombination(string format) + { + (DataObject dataObject, TestData _) = SetDataObject(format); + + // Nothing is written to HGLOBAL in this test because format-type combination is invalid. + Action tryGetData = () => dataObject.TryGetData(format, TestData.Resolver, autoConvert: true, out AbstractBase? _); + tryGetData.Should().Throw() + .WithMessage(expectedWildcardPattern: InvalidTypeFormatCombinationMessage); + } + + [WinFormsTheory] + [MemberData(nameof(UnboundedFormat))] + public void TryGetData_AsConcrete_NotSerializable_FormatterEnabled_ReturnFalse(string format) + { + DataObject native = new(); + NotSerializableData value = new(1); + native.SetData(format, value); + DataObject dataObject = new(ComHelpers.GetComPointer(native)); + + using BinaryFormatterScope scope = new(enable: true); + using BinaryFormatterInClipboardDragDropScope clipboardScope = new(enable: true); + + // E_UNEXPECTED and a NULL HGLOBAL is returned from the COM GetData, we have no stream to deserialize. + dataObject.TryGetData(format, out NotSerializableData? data).Should().BeFalse(); + data.Should().BeNull(); + } + + // This class does not have [Serializable] attribute, serialization stream will be corrupt. + private class NotSerializableData + { + public NotSerializableData(int value) + { + Value = value; + } + + public int Value; + } + + [Serializable] + private class TestData : AbstractBase + { + public TestData(Point point) + { + Location = point; + Inner = new InnerData("inner"); + } + + public Point Location; + public InnerData? Inner; + + public override void DoStuff() { } + + [Serializable] + internal class InnerData + { + public InnerData(string text) + { + Text = text; + } + + public string Text; + } + + public static Type Resolver(TypeName typeName) + { + (string name, Type type)[] allowedTypes = + [ + (typeof(TestData).FullName!, typeof(TestData)), + (typeof(InnerData).FullName!, typeof(InnerData)), + (typeof(AbstractBase).FullName!, typeof(AbstractBase)), + ]; + + string fullName = typeName.FullName; + foreach (var (name, type) in allowedTypes) + { + // Namespace-qualified type name. + if (name == fullName) + { + return type; + } + } + + throw new NotSupportedException($"Can't resolve {fullName}"); + } + } + + [Serializable] + internal abstract class AbstractBase + { + public abstract void DoStuff(); + } +} diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/RichTextBoxTests.ClipboardTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/RichTextBoxTests.ClipboardTests.cs index 3bc7c7d8b5f..d08ea124193 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/RichTextBoxTests.ClipboardTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/RichTextBoxTests.ClipboardTests.cs @@ -20,7 +20,9 @@ public void RichTextBox_OleObject_IncompleteOleObject_DoNothing() using MemoryStream memoryStream = new(); using Bitmap bitmap = new(100, 100); bitmap.Save(memoryStream, Drawing.Imaging.ImageFormat.Png); +#pragma warning disable WFDEV005 // Type or member is obsolete Clipboard.SetData("Embed Source", memoryStream); +#pragma warning restore WFDEV005 control.Text.Should().BeEmpty(); } diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ToolStripItemTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ToolStripItemTests.cs index c7be29dee26..e46aabffb17 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ToolStripItemTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ToolStripItemTests.cs @@ -4,8 +4,8 @@ using System.ComponentModel; using System.Drawing; using System.Runtime.InteropServices.ComTypes; -using Moq; using System.Windows.Forms.TestUtilities; +using Moq; using IComDataObject = System.Runtime.InteropServices.ComTypes.IDataObject; using Size = System.Drawing.Size; diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/TypeExtensionsTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/TypeExtensionsTests.cs new file mode 100644 index 00000000000..9950c8399ec --- /dev/null +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/TypeExtensionsTests.cs @@ -0,0 +1,138 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using System.Drawing; +using System.Private.Windows.Core.BinaryFormat; +using System.Reflection.Metadata; +using System.Runtime.CompilerServices; + +namespace System.Windows.Forms.Tests; + +public class TypeExtensionsTests +{ + public static TheoryData MatchesNameAndAssemblyLessVersionData() => new() + { + // int type is forwarded to mscorlib, type name with CoreLib will not match. + { typeof(int), TypeName.Parse(typeof(int).AssemblyQualifiedName), false }, + { typeof(int), TypeName.Parse($"System.Int32, {Mscorlib}"), true }, + { typeof(int?), TypeName.Parse($"System.Int32, {Mscorlib}"), true }, + { typeof(int?[]), TypeName.Parse($"System.Nullable`1[[System.Int32, {Mscorlib}]][], {Mscorlib}"), true}, + { typeof(DayOfWeek), TypeName.Parse($"System.Nullable`1[[System.DayOfWeek, {Mscorlib}]], {Mscorlib}"), false }, + { typeof(Bitmap), TypeName.Parse("System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), true }, + // Assembly version is incorrect. + { typeof(Bitmap), TypeName.Parse("System.Drawing.Bitmap, System.Drawing, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), true }, + // Public key token is incorrect. + { typeof(Bitmap), TypeName.Parse("System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f1AAAAAAA"), false }, + // Culture is incorrect. + { typeof(Bitmap), TypeName.Parse("System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=en-US, PublicKeyToken=b03f5f7f11d50a3a"), false }, + // Namespace name is incorrect. + { typeof(Bitmap), TypeName.Parse("System.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), false }, + { typeof(Bitmap), TypeName.Parse("System.Drawing.MyBitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), false }, + { typeof(Bitmap?[]), TypeName.Parse("System.Drawing.Bitmap[], System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), true }, + { typeof(Dictionary), TypeName.Parse($"System.Collections.Generic.Dictionary`2[[System.String, {Mscorlib}],[System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], {Mscorlib}"), true }, + { typeof(Dictionary), TypeName.Parse($"System.Collections.Generic.Dictionary`2[[System.String, {Mscorlib}],[System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], {Mscorlib}"), true }, + { typeof(NonForwardedType), TypeName.Parse("System.Windows.Forms.Tests.TypeExtensionsTests.NonForwardedType"), false }, + // Namespace name is cased differently. + { typeof(NonForwardedType), TypeName.Parse("System.Windows.Forms.Tests.TypeExtensionstests+NonForwardedType"), false }, + // Assembly information is missing. + { typeof(NonForwardedType), TypeName.Parse("System.Windows.Forms.Tests.TypeExtensionsTests+NonForwardedType"), false }, + { typeof(NonForwardedType), TypeName.Parse("System.Windows.Forms.Tests.TypeExtensionsTests+NonForwardedType, System.Windows.Forms.Tests"), false }, + // Assembly name is cased differently. + { typeof(NonForwardedType), TypeName.Parse("System.Windows.Forms.Tests.TypeExtensionsTests+NonForwardedType, System.windows.Forms.Tests, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"), true }, + // Namespace name is incorrect. + { typeof(NonForwardedType), TypeName.Parse("System.Windows.Forms.Tests.typeExtensionsTests+NonForwardedType, System.Windows.Forms.Tests"), false }, + { typeof(ForwardedType), TypeName.Parse("System.Windows.Forms.Tests.TypeExtensionsTests+ForwardedType, Abc"), true }, + }; + + [Theory] + [MemberData(nameof(MatchesNameAndAssemblyLessVersionData))] + public void MatchesLessAssemblyVersion(Type type, TypeName typeName, bool matches) => + // Match full type names and assembly names without version. + type.MatchExceptAssemblyVersion(typeName).Should().Be(matches); + + public static TheoryData MatchesTypeNameData() => new() + { + { TypeName.Parse($"System.Int32, {Mscorlib}"), TypeName.Parse($"System.Int32, {Mscorlib}"), true }, + { TypeName.Parse($"System.Int32, {Mscorlib}"), TypeName.Parse($"System.String, {Mscorlib}"), false }, + { TypeName.Parse($"System.Collections.Generic.Dictionary`2[[System.String, {Mscorlib}],[System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], {Mscorlib}"), TypeName.Parse($"System.Collections.Generic.Dictionary`2[[System.String, {Mscorlib}],[System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], {Mscorlib}"), true }, + { TypeName.Parse($"System.Collections.Generic.Dictionary`2[[System.String, {Mscorlib}],[System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], {Mscorlib}"), TypeName.Parse($"System.Collections.Generic.Dictionary`2[[System.String, {Mscorlib}],[System.Drawing.Bitmap, System.Drawing, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], {Mscorlib}"), false }, + { TypeName.Parse($"System.Collections.Generic.Dictionary`2[[System.String, {Mscorlib}],[System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], {Mscorlib}"), TypeName.Parse($"System.Collections.Generic.Dictionary`2[[System.String, {Mscorlib}],[System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], mscorlib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"), false }, + { TypeName.Parse($"System.Drawing.Bitmap[], System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), TypeName.Parse($"System.Drawing.Bitmap[], System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), true }, + { TypeName.Parse($"System.Drawing.Bitmap[], System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), TypeName.Parse($"System.Drawing.Bitmap[], System.Drawing, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), false }, + { TypeName.Parse($"System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), TypeName.Parse($"System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), true }, + { TypeName.Parse($"System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), TypeName.Parse($"System.Drawing.Bitmap, System.Drawing, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), false }, + }; + + [Theory] + [MemberData(nameof(MatchesTypeNameData))] + public void Matches_TypeName(TypeName x, TypeName y, bool matches) => + // Match TypeName objects including assembly version. + x.Matches(y).Should().Be(matches); + + [Fact] + public void TryGetForwardedFromName_ReturnsTrue() + { + typeof(int?).TryGetForwardedFromName(out string? name).Should().BeTrue(); + name.Should().Be(Mscorlib); + typeof(int).TryGetForwardedFromName(out name).Should().BeTrue(); + name.Should().Be(Mscorlib); + typeof(ForwardedType).TryGetForwardedFromName(out name).Should().BeTrue(); + name.Should().Be("Abc"); + typeof(ForwardedType[]).TryGetForwardedFromName(out name).Should().BeTrue(); + name.Should().Be("Abc"); + typeof(ForwardedType?[]).TryGetForwardedFromName(out name).Should().BeTrue(); + name.Should().Be("Abc"); + } + + [Fact] + public void TryGetForwardedFromName_ReturnsFalse() + { + typeof(NonForwardedType).TryGetForwardedFromName(out string? name).Should().BeFalse(); + name.Should().BeNull(); + typeof(NonForwardedType[]).TryGetForwardedFromName(out name).Should().BeFalse(); + name.Should().BeNull(); + typeof(NonForwardedType?[]).TryGetForwardedFromName(out name).Should().BeFalse(); + name.Should().BeNull(); + } + + private const string Mscorlib = TypeInfo.MscorlibAssemblyName; + + [Fact] + public void ForwardedTypeToTypeName() + { + TypeName name = typeof(ForwardedType).ToTypeName(); + name.FullName.Should().Be("System.Windows.Forms.Tests.TypeExtensionsTests+ForwardedType"); + name.AssemblyName!.FullName.Should().Be("Abc"); + + name = typeof(ForwardedType[]).ToTypeName(); + name.FullName.Should().Be("System.Windows.Forms.Tests.TypeExtensionsTests+ForwardedType[]"); + name.AssemblyName!.FullName.Should().Be("Abc"); + + name = typeof(ForwardedType?[]).ToTypeName(); + name.FullName.Should().Be("System.Windows.Forms.Tests.TypeExtensionsTests+ForwardedType[]"); + name.AssemblyName!.FullName.Should().Be("Abc"); + + name = typeof(List).ToTypeName(); + name.FullName.Should().Be($"System.Collections.Generic.List`1[[System.Windows.Forms.Tests.TypeExtensionsTests+ForwardedType, Abc]]"); + name.AssemblyName!.FullName.Should().Be(Mscorlib); + + name = typeof(List>).ToTypeName(); + name.FullName.Should().Be($"System.Collections.Generic.List`1[[System.Collections.Generic.Dictionary`2[[System.Int32, {Mscorlib}],[System.String, {Mscorlib}]], {Mscorlib}]]"); + name.AssemblyName!.FullName.Should().Be(Mscorlib); + + name = typeof(List>).ToTypeName(); + name.FullName.Should().Be($"System.Collections.Generic.List`1[[System.Collections.Generic.Dictionary`2[[System.String, {Mscorlib}],[System.Nullable`1[[System.Int32, {Mscorlib}]], {Mscorlib}]], {Mscorlib}]]"); + name.AssemblyName!.FullName.Should().Be(Mscorlib); + + name = typeof(List>).ToTypeName(); + name.FullName.Should().Be($"System.Collections.Generic.List`1[[System.Collections.Generic.Dictionary`2[[System.Int32, {Mscorlib}],[System.String, {Mscorlib}]], {Mscorlib}]]"); + name.AssemblyName!.FullName.Should().Be(Mscorlib); + } + + [TypeForwardedFrom("Abc")] + private class ForwardedType { } + + private class NonForwardedType { } +} diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/TypeNameComparerTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/TypeNameComparerTests.cs new file mode 100644 index 00000000000..17233b09e25 --- /dev/null +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/TypeNameComparerTests.cs @@ -0,0 +1,106 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using System.Reflection.Metadata; + +namespace System.Windows.Forms.Tests; + +public class TypeNameComparerTests +{ + private class TestType { } + + public static TheoryData TypeNameComparerSuccess() => new() + { + { TypeName.Parse(typeof(int).AssemblyQualifiedName), typeof(int) }, + { TypeName.Parse($"{typeof(int).FullName}, {typeof(int).Assembly.FullName}"), typeof(int) }, + { TypeName.Parse(typeof(int[]).AssemblyQualifiedName), typeof(int[]) }, + { TypeName.Parse($"{typeof(int[]).FullName}, {typeof(int[]).Assembly.FullName}"), typeof(int[]) }, + { TypeName.Parse(typeof(List).AssemblyQualifiedName), typeof(List) }, + { TypeName.Parse($"{typeof(List).FullName}, {typeof(List).Assembly.FullName}"), typeof(List) }, + { TypeName.Parse(typeof(TestType).AssemblyQualifiedName), typeof(TestType) }, + { TypeName.Parse($"{typeof(TestType).FullName}, {typeof(TestType).Assembly.FullName}"), typeof(TestType) }, + }; + + [Theory] + [MemberData(nameof(TypeNameComparerSuccess))] + public void DictionaryLookupSucceeds(TypeName name, Type expected) + { + Dictionary types = new(DataObject.Composition.TypeNameComparer.Default) + { + { TypeName.Parse(typeof(int).AssemblyQualifiedName), typeof(int) }, + { TypeName.Parse(typeof(int[]).AssemblyQualifiedName), typeof(int[]) }, + { TypeName.Parse(typeof(List).AssemblyQualifiedName), typeof(List) }, + { TypeName.Parse(typeof(TestType).AssemblyQualifiedName), typeof(TestType) }, + }; + + types.TryGetValue(name, out Type? resolvedType).Should().BeTrue(); + resolvedType.Should().Be(expected); + } + + public static TheoryData TypeNameComparerFail() => + [ + TypeName.Parse("System.Int32[], System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e"), + TypeName.Parse("System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e"), + TypeName.Parse("System.Int32, System.Private.CoreLib, Culture=neutral, PublicKeyToken=7cec85d7bea7798e"), + TypeName.Parse($"System.Collections.Generic.List`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], {typeof(List).Assembly.FullName}"), + TypeName.Parse($"{typeof(TestType).FullName}, {typeof(int).Assembly.FullName}") + ]; + + [Theory] + [MemberData(nameof(TypeNameComparerFail))] + public void DictionaryLookupVersionMismatch(TypeName name) + { + Dictionary types = new(DataObject.Composition.TypeNameComparer.Default) + { + { TypeName.Parse(typeof(int).AssemblyQualifiedName), typeof(int) }, + { TypeName.Parse(typeof(int[]).AssemblyQualifiedName), typeof(int[]) }, + { TypeName.Parse(typeof(List).AssemblyQualifiedName), typeof(List) }, + { TypeName.Parse(typeof(TestType).AssemblyQualifiedName), typeof(TestType) }, + }; + + types.TryGetValue(name, out Type? _).Should().BeFalse(); + } + + [Fact] + public void DictionaryLookupFails() + { + Dictionary types = new(DataObject.Composition.TypeNameComparer.Default) + { + { TypeName.Parse(typeof(int).AssemblyQualifiedName), typeof(int) }, + { TypeName.Parse(typeof(int[]).AssemblyQualifiedName), typeof(int[]) }, + { TypeName.Parse(typeof(List).AssemblyQualifiedName), typeof(List) }, + { TypeName.Parse(typeof(TestType).AssemblyQualifiedName), typeof(TestType) }, + }; + + TypeName name = TypeName.Parse(typeof(int).AssemblyQualifiedName); + AssemblyNameInfo info = name.AssemblyName!; + string testName = $"{name.FullName}, {info.Name}, Version={info.Version!}, Culture=neutral, PublicKeyToken=null"; + name = TypeName.Parse(testName); + types.TryGetValue(name, out Type? _).Should().BeFalse(); + } + + [Fact] + public void TypeNameComparer_Null() + { + var comparer = DataObject.Composition.TypeNameComparer.Default; + + comparer.Equals(null, null).Should().BeTrue(); + comparer.Equals(null, TypeName.Parse(typeof(int).AssemblyQualifiedName)).Should().BeFalse(); + comparer.Equals(TypeName.Parse(typeof(int).AssemblyQualifiedName), null).Should().BeFalse(); + comparer.Equals( + TypeName.Parse(typeof(int).AssemblyQualifiedName), + TypeName.Parse($"{typeof(int).FullName}, {typeof(int).Assembly.FullName}")).Should().BeTrue(); + } + + [Fact] + public void TypeNameComparer_GetHashCode() + { + var comparer = DataObject.Composition.TypeNameComparer.Default; + + int hash = comparer.GetHashCode(TypeName.Parse(typeof(int).AssemblyQualifiedName)); + comparer.GetHashCode(TypeName.Parse(typeof(int).AssemblyQualifiedName)).Should().Be(hash); + comparer.GetHashCode(TypeName.Parse($"{typeof(int).FullName}, {typeof(int).Assembly.FullName}")).Should().Be(hash); + } +} From d6aeb7a257061b4c50b3f3f194b2f93a479f03f2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 13:42:08 +0000 Subject: [PATCH 100/106] [main] Update dependencies from dotnet/arcade (#12630) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 24 ++++++++++++------------ eng/Versions.props | 6 +++--- eng/common/cross/build-rootfs.sh | 14 +++----------- eng/common/cross/toolchain.cmake | 11 +++++++++-- global.json | 6 +++--- 5 files changed, 30 insertions(+), 31 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e8a0ed3a6ee..9d35af37798 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -191,29 +191,29 @@ Note: if the Uri is a new place, you will need to add a subscription from that p - + https://github.com/dotnet/arcade - d5c8bb8726b46b5867961f5d8f56f1b13e72dcb9 + b9e1dd7c1e1d05679831467cd3c051b9f8f84460 - + https://github.com/dotnet/arcade - d5c8bb8726b46b5867961f5d8f56f1b13e72dcb9 + b9e1dd7c1e1d05679831467cd3c051b9f8f84460 - + https://github.com/dotnet/arcade - d5c8bb8726b46b5867961f5d8f56f1b13e72dcb9 + b9e1dd7c1e1d05679831467cd3c051b9f8f84460 - + https://github.com/dotnet/arcade - d5c8bb8726b46b5867961f5d8f56f1b13e72dcb9 + b9e1dd7c1e1d05679831467cd3c051b9f8f84460 - + https://github.com/dotnet/arcade - d5c8bb8726b46b5867961f5d8f56f1b13e72dcb9 + b9e1dd7c1e1d05679831467cd3c051b9f8f84460 - + https://github.com/dotnet/arcade - d5c8bb8726b46b5867961f5d8f56f1b13e72dcb9 + b9e1dd7c1e1d05679831467cd3c051b9f8f84460 diff --git a/eng/Versions.props b/eng/Versions.props index fca8e412072..e0cc3f76749 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -56,9 +56,9 @@ - 10.0.0-beta.24610.2 - 10.0.0-beta.24610.2 - 10.0.0-beta.24610.2 + 10.0.0-beta.24611.4 + 10.0.0-beta.24611.4 + 10.0.0-beta.24611.4 17.4.0-preview-20220707-01 diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 096bfe51f15..de980729790 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -52,14 +52,12 @@ __UbuntuPackages+=" symlinks" __UbuntuPackages+=" libicu-dev" __UbuntuPackages+=" liblttng-ust-dev" __UbuntuPackages+=" libunwind8-dev" -__UbuntuPackages+=" libnuma-dev" __AlpinePackages+=" gettext-dev" __AlpinePackages+=" icu-dev" __AlpinePackages+=" libunwind-dev" __AlpinePackages+=" lttng-ust-dev" __AlpinePackages+=" compiler-rt" -__AlpinePackages+=" numactl-dev" # runtime libraries' dependencies __UbuntuPackages+=" libcurl4-openssl-dev" @@ -424,13 +422,12 @@ case "$__AlpineVersion" in elif [[ "$__AlpineArch" == "riscv64" ]]; then __AlpineLlvmLibsLookup=1 __AlpineVersion=edge # minimum version with APKINDEX.tar.gz (packages archive) + elif [[ -n "$__AlpineVersion" ]]; then + # use whichever alpine version is provided and select the latest toolchain libs + __AlpineLlvmLibsLookup=1 else __AlpineVersion=3.13 # 3.13 to maximize compatibility __AlpinePackages+=" llvm10-libs" - - if [[ "$__AlpineArch" == "armv7" ]]; then - __AlpinePackages="${__AlpinePackages//numactl-dev/}" - fi fi esac @@ -444,11 +441,6 @@ if [[ "$__BuildArch" == "armel" ]]; then __LLDB_Package="lldb-3.5-dev" fi -if [[ "$__CodeName" == "xenial" && "$__UbuntuArch" == "armhf" ]]; then - # libnuma-dev is not available on armhf for xenial - __UbuntuPackages="${__UbuntuPackages//libnuma-dev/}" -fi - __UbuntuPackages+=" ${__LLDB_Package:-}" if [[ -z "$__UbuntuRepo" ]]; then diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake index deac538e690..0ff85cf0367 100644 --- a/eng/common/cross/toolchain.cmake +++ b/eng/common/cross/toolchain.cmake @@ -67,6 +67,13 @@ elseif(TARGET_ARCH_NAME STREQUAL "armv6") else() set(TOOLCHAIN "arm-linux-gnueabihf") endif() +elseif(TARGET_ARCH_NAME STREQUAL "loongarch64") + set(CMAKE_SYSTEM_PROCESSOR "loongarch64") + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/loongarch64-alpine-linux-musl) + set(TOOLCHAIN "loongarch64-alpine-linux-musl") + else() + set(TOOLCHAIN "loongarch64-linux-gnu") + endif() elseif(TARGET_ARCH_NAME STREQUAL "ppc64le") set(CMAKE_SYSTEM_PROCESSOR ppc64le) if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/powerpc64le-alpine-linux-musl) @@ -118,7 +125,7 @@ elseif(TARGET_ARCH_NAME STREQUAL "x86") set(TIZEN_TOOLCHAIN "i586-tizen-linux-gnu") endif() else() - message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only arm, arm64, armel, armv6, ppc64le, riscv64, s390x, x64 and x86 are supported!") + message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only arm, arm64, armel, armv6, loongarch64, ppc64le, riscv64, s390x, x64 and x86 are supported!") endif() if(DEFINED ENV{TOOLCHAIN}) @@ -284,7 +291,7 @@ endif() # Specify compile options -if((TARGET_ARCH_NAME MATCHES "^(arm|arm64|armel|armv6|ppc64le|riscv64|s390x|x64|x86)$" AND NOT ANDROID AND NOT FREEBSD) OR ILLUMOS OR HAIKU) +if((TARGET_ARCH_NAME MATCHES "^(arm|arm64|armel|armv6|loongarch64|ppc64le|riscv64|s390x|x64|x86)$" AND NOT ANDROID AND NOT FREEBSD) OR ILLUMOS OR HAIKU) set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN}) set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN}) set(CMAKE_ASM_COMPILER_TARGET ${TOOLCHAIN}) diff --git a/global.json b/global.json index 11d25b7fa99..26b5ca2da05 100644 --- a/global.json +++ b/global.json @@ -14,9 +14,9 @@ "version": "10.0.100-alpha.1.24573.1" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24610.2", - "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24610.2", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24610.2", + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24611.4", + "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24611.4", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24611.4", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24611.1" }, From f4fa13e96fe2dc9c2f2a115bad67a93fff608183 Mon Sep 17 00:00:00 2001 From: Tanya Solyanik Date: Thu, 12 Dec 2024 11:06:43 -0800 Subject: [PATCH 101/106] Fixed the autoConvert default values in DataObject.TryGetData (#12632) Fixed the autoConvert default values in DataObject.TryGetData to match default values from DataObject.GetData --- .../OLE/DataObject.Composition.NativeToWinFormsAdapter.cs | 4 ++-- .../src/System/Windows/Forms/OLE/DataObject.Composition.cs | 6 +++--- .../src/System/Windows/Forms/OLE/DataObject.cs | 4 ++-- .../UnitTests/System/Windows/Forms/DataObjectTests.cs | 7 ++++--- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs index 4b06049b562..9201482e8f5 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs @@ -655,11 +655,11 @@ public void SetData(object? data) { } public bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( string format, [NotNullWhen(true), MaybeNullWhen(false)] out T data) => - TryGetDataInternal(format, resolver: null!, autoConvert: false, legacyMode: false, out data); + TryGetDataInternal(format, resolver: null!, autoConvert: true, legacyMode: false, out data); public bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( [NotNullWhen(true), MaybeNullWhen(false)] out T data) => - TryGetDataInternal(typeof(T).FullName!, resolver: null!, autoConvert: false, legacyMode: false, out data); + TryGetDataInternal(typeof(T).FullName!, resolver: null!, autoConvert: true, legacyMode: false, out data); #endregion private bool GetDataPresentInner(string format) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.cs index 0664661edae..878bec806d4 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.cs @@ -131,16 +131,16 @@ or DataFormats.PaletteConstant string format, bool autoConvert, [NotNullWhen(true), MaybeNullWhen(false)] out T data) => - _winFormsDataObject.TryGetData(format, resolver: null!, autoConvert, out data); + _winFormsDataObject.TryGetData(format, autoConvert, out data); public bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( string format, [NotNullWhen(true), MaybeNullWhen(false)] out T data) => - _winFormsDataObject.TryGetData(format, resolver: null!, autoConvert: false, out data); + _winFormsDataObject.TryGetData(format, out data); public bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( [NotNullWhen(true), MaybeNullWhen(false)] out T data) => - _winFormsDataObject.TryGetData(typeof(T).FullName!, resolver: null!, autoConvert: false, out data); + _winFormsDataObject.TryGetData(typeof(T).FullName!, out data); #endregion #region Com.IDataObject.Interface diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs index b1a303a99fe..5be490b1201 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs @@ -165,11 +165,11 @@ public virtual void SetData(string format, bool autoConvert, object? data) => public bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( string format, [NotNullWhen(true), MaybeNullWhen(false)] out T data) => - TryGetDataInternal(format, resolver: null, autoConvert: false, out data); + TryGetDataInternal(format, resolver: null, autoConvert: true, out data); public bool TryGetData<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>( [NotNullWhen(true), MaybeNullWhen(false)] out T data) => - TryGetDataInternal(typeof(T).FullName!, resolver: null, autoConvert: false, out data); + TryGetDataInternal(typeof(T).FullName!, resolver: null, autoConvert: true, out data); #endregion /// diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.cs index 200fa76e625..91b20cba277 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataObjectTests.cs @@ -371,6 +371,7 @@ internal class DataObjectOverridesTryGetDataCore : DataObject { private readonly string _format; private readonly Func? _resolver; + // true is the default value for general purpose APIs (GetData). private readonly bool _autoConvert; public DataObjectOverridesTryGetDataCore(string format, Func? resolver, bool autoConvert) : base() @@ -403,7 +404,7 @@ protected override bool TryGetDataCore( [Fact] public void DataObject_TryGetData_InvokeString_CallsTryGetDataCore() { - DataObjectOverridesTryGetDataCore dataObject = new(typeof(string).FullName!, resolver: null, autoConvert: false); + DataObjectOverridesTryGetDataCore dataObject = new(typeof(string).FullName!, resolver: null, autoConvert: true); dataObject.Count.Should().Be(0); dataObject.TryGetData(out string? data).Should().BeFalse(); @@ -421,7 +422,7 @@ public void DataObject_TryGetData_InvokeString_CallsTryGetDataCore() [MemberData(nameof(RestrictedAndUnrestrictedFormat))] public void TryGetData_InvokeStringString_CallsTryGetDataCore(string format) { - DataObjectOverridesTryGetDataCore dataObject = new(format, null, autoConvert: false); + DataObjectOverridesTryGetDataCore dataObject = new(format, null, autoConvert: true); dataObject.Count.Should().Be(0); dataObject.TryGetData(format, out string? data).Should().BeFalse(); @@ -433,7 +434,7 @@ public void TryGetData_InvokeStringString_CallsTryGetDataCore(string format) public void TryGetData_InvokeStringString_ValidationFails() { string format = DataFormats.Bitmap; - DataObjectOverridesTryGetDataCore dataObject = new(format, null, autoConvert: false); + DataObjectOverridesTryGetDataCore dataObject = new(format, null, autoConvert: true); dataObject.Count.Should().Be(0); // Incompatible format and type. From 8cea3f36c304a752bc257979401729b0aa92fcd7 Mon Sep 17 00:00:00 2001 From: Tanya Solyanik Date: Thu, 12 Dec 2024 17:01:29 -0800 Subject: [PATCH 102/106] Added resource to SR file for the clipboard APIs (#12629) * Added resource to SR file --- .../TestUtilities/AppContextSwitchNames.cs | 4 +-- .../src/Resources/SR.resx | 21 +++++++++++ .../src/Resources/xlf/SR.cs.xlf | 35 +++++++++++++++++++ .../src/Resources/xlf/SR.de.xlf | 35 +++++++++++++++++++ .../src/Resources/xlf/SR.es.xlf | 35 +++++++++++++++++++ .../src/Resources/xlf/SR.fr.xlf | 35 +++++++++++++++++++ .../src/Resources/xlf/SR.it.xlf | 35 +++++++++++++++++++ .../src/Resources/xlf/SR.ja.xlf | 35 +++++++++++++++++++ .../src/Resources/xlf/SR.ko.xlf | 35 +++++++++++++++++++ .../src/Resources/xlf/SR.pl.xlf | 35 +++++++++++++++++++ .../src/Resources/xlf/SR.pt-BR.xlf | 35 +++++++++++++++++++ .../src/Resources/xlf/SR.ru.xlf | 35 +++++++++++++++++++ .../src/Resources/xlf/SR.tr.xlf | 35 +++++++++++++++++++ .../src/Resources/xlf/SR.zh-Hans.xlf | 35 +++++++++++++++++++ .../src/Resources/xlf/SR.zh-Hant.xlf | 35 +++++++++++++++++++ .../src/System/Windows/Forms/OLE/Clipboard.cs | 7 ++-- ...bject.Composition.BinaryFormatUtilities.cs | 8 ++--- .../OLE/DataObject.Composition.Binder.cs | 15 +++----- ...ect.Composition.NativeToWinFormsAdapter.cs | 5 +-- .../System/Windows/Forms/OLE/DataObject.cs | 3 +- .../Windows/Forms/OLE/DataObjectExtensions.cs | 3 +- .../Windows/Forms/OLE/ITypedDataObject.cs | 2 +- .../WinformsControlsTest/CloneTestListView.cs | 1 + .../ScrollableControls.cs | 1 + .../Forms/NativeToWinFormsAdapterTests.cs | 29 ++++++++------- 25 files changed, 508 insertions(+), 46 deletions(-) diff --git a/src/Common/tests/TestUtilities/AppContextSwitchNames.cs b/src/Common/tests/TestUtilities/AppContextSwitchNames.cs index bf75119eb07..65b93fbacd7 100644 --- a/src/Common/tests/TestUtilities/AppContextSwitchNames.cs +++ b/src/Common/tests/TestUtilities/AppContextSwitchNames.cs @@ -22,14 +22,14 @@ public const string LocalAppContext_DisableCaching /// /// The switch that controls whether or not the is enabled in the - /// Clipboard or drag and drop scenarios + /// Clipboard or drag-and-drop operations. /// public const string ClipboardDragDropEnableUnsafeBinaryFormatterSerializationSwitchName = "Windows.ClipboardDragDrop.EnableUnsafeBinaryFormatterSerialization"; /// /// The switch that controls whether or not the System.Windows.Forms.BinaryFormat.Deserializer - /// is enabled in the Clipboard or drag and drop scenarios. + /// is enabled in the Clipboard or drag-and-drop operations. /// public const string ClipboardDragDropEnableNrbfSerializationSwitchName = "Windows.ClipboardDragDrop.EnableNrbfSerialization"; diff --git a/src/System.Windows.Forms/src/Resources/SR.resx b/src/System.Windows.Forms/src/Resources/SR.resx index a456df22368..ce9389b6ab6 100644 --- a/src/System.Windows.Forms/src/Resources/SR.resx +++ b/src/System.Windows.Forms/src/Resources/SR.resx @@ -7015,4 +7015,25 @@ Stack trace where the illegal operation occurred was: Failed to retrieve the Synchronization Context for showing the Form asynchronously. + + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + + + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + + + The specified type '{0}' is not compatible with the specified format '{1}'. + diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.cs.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.cs.xlf index 717c0e67a6d..b4ef4f50050 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.cs.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.cs.xlf @@ -292,6 +292,16 @@ Serializace a deserializace BinaryFormatter jsou v této aplikaci zakázané. Další informace najdete na https://aka.ms/binaryformatter. + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + + + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Occurs when the binding context has changed. Vyvolá se při změně kontextu vazby. @@ -957,6 +967,26 @@ Požadovaná operace se schránkou se nezdařila. + + The specified type '{0}' is not compatible with the specified format '{1}'. + The specified type '{0}' is not compatible with the specified format '{1}'. + + + + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + + + + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + + + + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Due to security restrictions on clipboard, the specified clipboard format cannot be set. Z důvodu omezení zabezpečení schránky nelze zadaný formát schránky nastavit. @@ -5775,6 +5805,11 @@ Chcete jej nahradit? Určuje podporu pro provedenou inicializaci. + + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + + Cross-thread operation not valid: Control '{0}' accessed from a thread other than the thread it was created on. Operace mezi vlákny není platná: Přístup k ovládacímu prvku {0} proběhl z jiného vlákna než z vlákna, v rámci kterého byl vytvořen. diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.de.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.de.xlf index e0f9ff4b307..e90fbea9383 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.de.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.de.xlf @@ -292,6 +292,16 @@ Die Serialisierung und Deserialisierung von BinaryFormatter sind in dieser Anwendung deaktiviert. Weitere Informationen finden Sie unter https://aka.ms/binaryformatter. + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + + + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Occurs when the binding context has changed. Tritt auf, wenn sich der Bindungskontext geändert hat. @@ -957,6 +967,26 @@ Der angeforderte Clipboard-Vorgang war nicht erfolgreich. + + The specified type '{0}' is not compatible with the specified format '{1}'. + The specified type '{0}' is not compatible with the specified format '{1}'. + + + + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + + + + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + + + + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Due to security restrictions on clipboard, the specified clipboard format cannot be set. Das angegebene Zwischenablageformat kann aufgrund von Sicherheitseinschränkungen für die Zwischenablage nicht festgelegt werden. @@ -5775,6 +5805,11 @@ Möchten Sie sie ersetzen? Gibt Unterstützung für transaktive Initialisierung an. + + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + + Cross-thread operation not valid: Control '{0}' accessed from a thread other than the thread it was created on. Ungültiger threadübergreifender Vorgang: Der Zugriff auf das Steuerelement {0} erfolgte von einem anderen Thread als dem Thread, für den es erstellt wurde. diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.es.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.es.xlf index 98b4538d175..355b00404ec 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.es.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.es.xlf @@ -292,6 +292,16 @@ La serialización y deserialización de BinaryFormatter están deshabilitadas en esta aplicación. Consulte https://aka.ms/binaryformatter para obtener más información. + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + + + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Occurs when the binding context has changed. Se produce cuando el contexto de enlace ha cambiado. @@ -957,6 +967,26 @@ Error en la operación solicitada del Portapapeles. + + The specified type '{0}' is not compatible with the specified format '{1}'. + The specified type '{0}' is not compatible with the specified format '{1}'. + + + + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + + + + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + + + + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Due to security restrictions on clipboard, the specified clipboard format cannot be set. Por restricciones de seguridad en el portapapeles, el formato del portapapeles especificado no se puede establecer. @@ -5775,6 +5805,11 @@ Do you want to replace it? Especifica la compatibilidad para la inicialización por transacción. + + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + + Cross-thread operation not valid: Control '{0}' accessed from a thread other than the thread it was created on. Operación no válida a través de subprocesos: Se tuvo acceso al control '{0}' desde un subproceso distinto a aquel en que lo creó. diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.fr.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.fr.xlf index 0b8ddf09ef6..752526ed75d 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.fr.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.fr.xlf @@ -292,6 +292,16 @@ La sérialisation et la désérialisation binaryFormatter sont désactivées dans cette application. Pour plus d’informations, consultez https://aka.ms/binaryformatter. + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + + + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Occurs when the binding context has changed. Se produit lorsque le contexte de liaison change. @@ -957,6 +967,26 @@ Échec de l'opération du Presse-papiers demandée. + + The specified type '{0}' is not compatible with the specified format '{1}'. + The specified type '{0}' is not compatible with the specified format '{1}'. + + + + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + + + + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + + + + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Due to security restrictions on clipboard, the specified clipboard format cannot be set. En raison des restrictions de sécurité du Presse-papiers, il est impossible de définir le format de Presse-papiers spécifié. @@ -5775,6 +5805,11 @@ Voulez-vous le remplacer ? Spécifie la prise en charge de l'initialisation traitée. + + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + + Cross-thread operation not valid: Control '{0}' accessed from a thread other than the thread it was created on. Opération inter-threads non valide : le contrôle '{0}' a fait l'objet d'un accès à partir d'un thread autre que celui sur lequel il a été créé. diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.it.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.it.xlf index 292fe753d8e..0602e028466 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.it.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.it.xlf @@ -292,6 +292,16 @@ La serializzazione e la deserializzazione di BinaryFormatter sono disabilitate in questa applicazione. Per altre informazioni, vedere https://aka.ms/binaryformatter. + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + + + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Occurs when the binding context has changed. Si verifica quando il contesto di associazione viene modificato. @@ -957,6 +967,26 @@ Operazione richiesta sugli Appunti non riuscita. + + The specified type '{0}' is not compatible with the specified format '{1}'. + The specified type '{0}' is not compatible with the specified format '{1}'. + + + + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + + + + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + + + + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Due to security restrictions on clipboard, the specified clipboard format cannot be set. A causa delle restrizioni di sicurezza sugli Appunti, il formato degli Appunti specificato non può essere impostato. @@ -5775,6 +5805,11 @@ Sostituirlo? Specifica il supporto per l'inizializzazione transazionale. + + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + + Cross-thread operation not valid: Control '{0}' accessed from a thread other than the thread it was created on. Operazione cross-thread non valida: è stato eseguito l'accesso al controllo '{0}' da un thread diverso da quello da cui è stata eseguita la creazione. diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.ja.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.ja.xlf index 515e0f534cf..4671afce77f 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.ja.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.ja.xlf @@ -292,6 +292,16 @@ BinaryFormatter のシリアル化と逆シリアル化は、このアプリケーションでは無効です。詳細については、https://aka.ms/binaryformatter を参照してください。 + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + + + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Occurs when the binding context has changed. バインド コンテキストが変更されたときに発生します。 @@ -957,6 +967,26 @@ 要求されたクリップボード操作に成功しませんでした。 + + The specified type '{0}' is not compatible with the specified format '{1}'. + The specified type '{0}' is not compatible with the specified format '{1}'. + + + + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + + + + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + + + + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Due to security restrictions on clipboard, the specified clipboard format cannot be set. クリップボードのセキュリティ上の制限が原因で、指定されたクリップボードの形式を設定できません。 @@ -5775,6 +5805,11 @@ Do you want to replace it? 処理された初期化のサポートを指定します。 + + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + + Cross-thread operation not valid: Control '{0}' accessed from a thread other than the thread it was created on. 有効ではないスレッド間の操作: コントロールが作成されたスレッド以外のスレッドからコントロール '{0}' がアクセスされました。 diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.ko.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.ko.xlf index 583b0ce5ffd..bd2a5011a94 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.ko.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.ko.xlf @@ -292,6 +292,16 @@ 이 애플리케이션 내에서 BinaryFormatter 직렬화 및 역직렬화를 사용할 수 없습니다. 자세한 내용은 https://aka.ms/binaryformatter 페이지를 참조하세요. + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + + + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Occurs when the binding context has changed. 바인딩 컨텍스트가 변경될 때 발생합니다. @@ -957,6 +967,26 @@ 요청한 클립보드 작업을 수행하지 못했습니다. + + The specified type '{0}' is not compatible with the specified format '{1}'. + The specified type '{0}' is not compatible with the specified format '{1}'. + + + + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + + + + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + + + + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Due to security restrictions on clipboard, the specified clipboard format cannot be set. 클립보드의 보안 제약으로 인해 지정한 클립보드 형식을 설정할 수 없습니다. @@ -5775,6 +5805,11 @@ Do you want to replace it? 트랜잭트 초기화를 지원합니다. + + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + + Cross-thread operation not valid: Control '{0}' accessed from a thread other than the thread it was created on. 크로스 스레드 작업이 잘못되었습니다. '{0}' 컨트롤이 자신이 만들어진 스레드가 아닌 스레드에서 액세스되었습니다. diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.pl.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.pl.xlf index 15a5686917f..f0056df6350 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.pl.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.pl.xlf @@ -292,6 +292,16 @@ Serializacji BinaryFormatter i deserializacji są wyłączone w tej aplikacji. Aby uzyskać więcej informacji, zobacz https://aka.ms/binaryformatter. + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + + + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Occurs when the binding context has changed. Występuje, gdy kontekst powiązania zostanie zmieniony. @@ -957,6 +967,26 @@ Żądana operacja schowka nie powiodła się. + + The specified type '{0}' is not compatible with the specified format '{1}'. + The specified type '{0}' is not compatible with the specified format '{1}'. + + + + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + + + + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + + + + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Due to security restrictions on clipboard, the specified clipboard format cannot be set. Z powodu ograniczeń bezpieczeństwa w schowku nie można ustawić określonego formatu schowka. @@ -5775,6 +5805,11 @@ Czy chcesz go zamienić? Określa pomoc techniczną dla inicjowania transakcyjnego. + + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + + Cross-thread operation not valid: Control '{0}' accessed from a thread other than the thread it was created on. Nieprawidłowa operacja między wątkami: do formantu '{0}' uzyskiwany jest dostęp z wątku innego niż wątek, w którym został utworzony. diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.pt-BR.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.pt-BR.xlf index e24517b5d3c..076035afa09 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.pt-BR.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.pt-BR.xlf @@ -292,6 +292,16 @@ A serialização e a desserialização de BinaryFormatter estão desabilitadas neste aplicativo. Consulte https://aka.ms/binaryformatter para obter mais informações. + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + + + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Occurs when the binding context has changed. Ocorre quando o contexto de associação foi alterado. @@ -957,6 +967,26 @@ A operação de Área de Transferência solicitada não foi bem-sucedida. + + The specified type '{0}' is not compatible with the specified format '{1}'. + The specified type '{0}' is not compatible with the specified format '{1}'. + + + + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + + + + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + + + + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Due to security restrictions on clipboard, the specified clipboard format cannot be set. Devido a restrições de segurança na área de transferência, não é possível definir o formato especificado de área de transferência. @@ -5775,6 +5805,11 @@ Deseja substituí-lo? Especifica o suporte para a inicialização transacionada. + + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + + Cross-thread operation not valid: Control '{0}' accessed from a thread other than the thread it was created on. Operação entre threads inválida: controle '{0}' acessado de um thread que não é aquele no qual foi criado. diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.ru.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.ru.xlf index e4d539af451..8798818d7b2 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.ru.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.ru.xlf @@ -292,6 +292,16 @@ Сериализация и десериализация BinaryFormatter отключены в этом приложении. Дополнительные сведения см. https://aka.ms/binaryformatter. + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + + + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Occurs when the binding context has changed. Происходит при изменении контекста привязки. @@ -957,6 +967,26 @@ Сбой при выполнении запрошенной операции с буфером обмена. + + The specified type '{0}' is not compatible with the specified format '{1}'. + The specified type '{0}' is not compatible with the specified format '{1}'. + + + + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + + + + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + + + + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Due to security restrictions on clipboard, the specified clipboard format cannot be set. Установка указанного формата буфера обмена не допускается ограничениями по безопасности. @@ -5776,6 +5806,11 @@ Do you want to replace it? Определяет поддержку для инициализации транзакции. + + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + + Cross-thread operation not valid: Control '{0}' accessed from a thread other than the thread it was created on. Недопустимая операция в нескольких потоках: попытка доступа к элементу управления '{0}' не из того потока, в котором он был создан. diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.tr.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.tr.xlf index 12a01ab1fa2..4beade99ede 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.tr.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.tr.xlf @@ -292,6 +292,16 @@ BinaryFormatter serileştirme ve seri durumdan çıkarma işlemleri bu uygulamada devre dışı. Daha fazla bilgi için https://aka.ms/binaryformatter sayfasına bakın. + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + + + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Occurs when the binding context has changed. Bağlama bağlamı değiştiğinde gerçekleşir. @@ -957,6 +967,26 @@ İstenen Pano işlemi başarılı olmadı. + + The specified type '{0}' is not compatible with the specified format '{1}'. + The specified type '{0}' is not compatible with the specified format '{1}'. + + + + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + + + + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + + + + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Due to security restrictions on clipboard, the specified clipboard format cannot be set. Pano üzerindeki güvenlik kısıtlamaları nedeniyle, belirtilen pano biçimi ayarlanamıyor. @@ -5775,6 +5805,11 @@ Bunu değiştirmek istiyor musunuz? İşlenen başlatma için desteği belirtir. + + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + + Cross-thread operation not valid: Control '{0}' accessed from a thread other than the thread it was created on. Çapraz iş parçacığı işlemi geçerli değil: '{0}' denetimine oluşturulduğu iş parçacığı dışında başka bir iş parçacığından erişildi. diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.zh-Hans.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.zh-Hans.xlf index e86716075df..af8d7230e1c 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.zh-Hans.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.zh-Hans.xlf @@ -292,6 +292,16 @@ 此应用程序中已禁用 BinaryFormatter 序列化和反序列化。有关详细信息,请参阅 https://aka.ms/binaryformatter。 + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + + + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Occurs when the binding context has changed. 当绑定上下文发生更改时发生。 @@ -957,6 +967,26 @@ 所请求的剪贴板操作失败。 + + The specified type '{0}' is not compatible with the specified format '{1}'. + The specified type '{0}' is not compatible with the specified format '{1}'. + + + + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + + + + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + + + + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Due to security restrictions on clipboard, the specified clipboard format cannot be set. 由于剪贴板有安全限制,因此无法设置指定的剪贴板格式。 @@ -5775,6 +5805,11 @@ Do you want to replace it? 指定支持事务处理初始化。 + + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + + Cross-thread operation not valid: Control '{0}' accessed from a thread other than the thread it was created on. 线程间操作无效: 从不是创建控件“{0}”的线程访问它。 diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.zh-Hant.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.zh-Hant.xlf index 8dacd4f93a5..4db8d5ba43f 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.zh-Hant.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.zh-Hant.xlf @@ -292,6 +292,16 @@ 此應用程式內已停用 BinaryFormatter 序列化和還原序列化。如需詳細資訊,請參閱 https://aka.ms/binaryformatter。 + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. + + + + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + BinaryFormatter is not supported in clipboard or drag-and-drop operations. Please enable it and use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Occurs when the binding context has changed. 在繫結內容變更時發生。 @@ -957,6 +967,26 @@ 要求的剪貼簿作業失敗。 + + The specified type '{0}' is not compatible with the specified format '{1}'. + The specified type '{0}' is not compatible with the specified format '{1}'. + + + + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + '{0}' is not a concrete type, and could result in an unbounded deserialization attempt. Please use a concrete type or alternatively define a 'resolver' function that supports types that you are expecting to retrieve from the clipboard or use in drag-and-drop operations. + + + + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + Type {0} is not found. If this type is allowed, please ensure that the 'resolver' function provided in 'TryGetData<T>' APIs supports it. + + + + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + Please use 'TryGetData<T>' APIs with a 'resolver' function that defines a set of allowed types to deserialize '{0}'. + + Due to security restrictions on clipboard, the specified clipboard format cannot be set. 基於剪貼簿的安全限制,無法設定指定的剪貼簿格式。 @@ -5775,6 +5805,11 @@ Do you want to replace it? 為交易性的初始設定指定支援。 + + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + Data object '{0}' doesn't implement the 'ITypedDataObject' interface and can't be read using 'TryGetData<T>(string, out T)' methods. + + Cross-thread operation not valid: Control '{0}' accessed from a thread other than the thread it was created on. 跨執行緒作業無效: 存取控制項 '{0}' 時所使用的執行緒與建立控制項的執行緒不同。 diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/Clipboard.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/Clipboard.cs index 186ea02cb42..25c0c437b2b 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/Clipboard.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/Clipboard.cs @@ -420,11 +420,8 @@ private static bool GetTypedDataObject( if (dataObject is not ITypedDataObject typedDataObject) { - // TODO (TanyaSo): localize string - throw new NotSupportedException(string.Format( - "Data object `{0}` doesn't implement `ITypedDataObject` interface and can't be read" + - " using `TryGetData(string, out T)` method.", - dataObject.GetType().FullName)); + throw new NotSupportedException( + string.Format(SR.ITypeDataObject_Not_Implemented, dataObject.GetType().FullName)); } typed = typedDataObject; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.BinaryFormatUtilities.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.BinaryFormatUtilities.cs index 9cd2a56756b..144da1f2541 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.BinaryFormatUtilities.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.BinaryFormatUtilities.cs @@ -55,8 +55,7 @@ internal static void WriteObjectToStream(MemoryStream stream, object data, bool if (!LocalAppContextSwitches.ClipboardDragDropEnableUnsafeBinaryFormatterSerialization) { - // TODO (TanyaSo): localize string - throw new NotSupportedException("BinaryFormatter is not supported in Clipboard or drag and drop scenarios."); + throw new NotSupportedException(SR.BinaryFormatter_NotSupported_InClipboardOrDragDrop); } stream.Position = position; @@ -146,11 +145,8 @@ record = stream.Decode(out recordMap); if (!LocalAppContextSwitches.ClipboardDragDropEnableUnsafeBinaryFormatterSerialization) { - // TODO (TanyaSo): localize string throw new NotSupportedException(string.Format( - "BinaryFormatter is not supported in Clipboard or drag and drop scenarios." + - " Enable it and use 'TryGetData' API with a 'resolver'" + - " function that defines a set of allowed types, to deserialize '{0}'.", + SR.BinaryFormatter_NotSupported_InClipboardOrDragDrop_UseTypedAPI, typeof(T).FullName)); } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.Binder.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.Binder.cs index 329632b8091..fcb82cadc3c 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.Binder.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.Binder.cs @@ -169,13 +169,10 @@ private static void InitializeCommonTypes() if (_legacyMode) { - // TODO (TanyaSo): localize string return Switches.ClipboardDragDropEnableUnsafeBinaryFormatterSerialization ? null : throw new NotSupportedException(string.Format( - "BinaryFormatter is not supported in Clipboard or drag and drop scenarios." + - " Enable it and use 'TryGetData' API with a 'resolver'" + - " function that defines a set of allowed types, to deserialize '{0}'.", + SR.BinaryFormatter_NotSupported_InClipboardOrDragDrop_UseTypedAPI, $"{assemblyName}.{typeName}")); } @@ -189,18 +186,14 @@ private Type UseResolver(TypeName typeName) { if (_resolver is null) { - // TODO (TanyaSo): localize string throw new NotSupportedException(string.Format( - "Use 'TryGetData' method with a 'resolver' function that defines a set of allowed types, to deserialize '{0}'.", + SR.ClipboardOrDragDrop_UseTypedAPI, typeName.AssemblyQualifiedName)); } - // This helper method is called after we verified that _resolver is not null. - Type resolved = _resolver!(typeName) + Type resolved = _resolver(typeName) ?? throw new NotSupportedException(string.Format( - "'resolver' function provided in 'TryGetData' method should not return a null. " + - "It should throw a 'System.NotSupportedException' when encountering unsupported types, " + - "unless type {0} is one of the allowed types, then the 'Type' should be returned.", + SR.ClipboardOrDragDrop_TypedAPI_InvalidResolver, typeName.AssemblyQualifiedName)); _userTypes.Add(typeName, resolved); diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs index 9201482e8f5..14ac1ec1c7f 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs @@ -464,11 +464,8 @@ private static void ThrowIfFormatAndTypeRequireResolver(string format) // This check is a convenience for simple usages if TryGetData APIs that don't take the resolver. && IsUnboundedType()) { - // TODO (TanyaSo): localize string throw new NotSupportedException(string.Format( - "'{0}' is not a concrete type, and could allow for unbounded deserialization. Use a concrete type" + - " or define a resolver function that supports types that you are retrieving from the Clipboard" + - " or being dragged and dropped.", + SR.ClipboardOrDragDrop_InvalidType, typeof(T).FullName)); } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs index 5be490b1201..5fcf8502256 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs @@ -284,9 +284,8 @@ internal static bool IsValidFormatAndType(string format) return true; } - // TODO (TanyaSo): localize string throw new NotSupportedException(string.Format( - "Type '{0}' is not compatible with the specified format '{1}'.", + SR.ClipboardOrDragDrop_InvalidFormatTypeCombination, typeof(T).FullName, format)); static bool IsValidPredefinedFormatTypeCombination(string format) => format switch diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObjectExtensions.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObjectExtensions.cs index b9d43ef6948..57b78ef4d23 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObjectExtensions.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObjectExtensions.cs @@ -14,9 +14,8 @@ private static ITypedDataObject GetTypedDataObjectOrThrow(IDataObject dataObject if (dataObject is not ITypedDataObject typed) { - // TODO (TanyaSo) : localize string throw new NotSupportedException(string.Format( - "Data object({0}) should implement 'ITypedDataObject' interface to support 'TryGetData methods.", + SR.ITypeDataObject_Not_Implemented, dataObject.GetType().FullName)); } diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/ITypedDataObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/ITypedDataObject.cs index a76ae50dc70..c7e4ab91508 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/ITypedDataObject.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/ITypedDataObject.cs @@ -14,7 +14,7 @@ namespace System.Windows.Forms; /// Implement this interface to use your data object with /// family of methods as well as in the drag and drop operations. This interface will ensure that only /// data of the specified is exchanged. Otherwise the APIs that specify a parameter -/// will throw a .This is replacement of +/// will throw a . This is replacement of /// interface, implement this interface as well. Otherwise the APIs that specify a parameter /// will throw a . /// diff --git a/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/CloneTestListView.cs b/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/CloneTestListView.cs index 8ad353e8d66..cf41cfdb18b 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/CloneTestListView.cs +++ b/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/CloneTestListView.cs @@ -3,6 +3,7 @@ namespace WinFormsControlsTest; +[DesignerCategory("Default")] internal class CloneTestListView : ListView { public void InvokeOnItemChecked(ItemCheckedEventArgs e) diff --git a/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/ScrollableControls.cs b/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/ScrollableControls.cs index b74850bd7ce..fa01269f1ec 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/ScrollableControls.cs +++ b/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/ScrollableControls.cs @@ -3,6 +3,7 @@ namespace WinFormsControlsTest { + [DesignerCategory("Default")] public partial class ScrollableControls : Form { public ScrollableControls() diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/NativeToWinFormsAdapterTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/NativeToWinFormsAdapterTests.cs index c8bfb13e52f..90fc5ff19d7 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/NativeToWinFormsAdapterTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/NativeToWinFormsAdapterTests.cs @@ -5,11 +5,12 @@ using System.Drawing; using System.Reflection.Metadata; +using System.Text.RegularExpressions; using Com = Windows.Win32.System.Com; namespace System.Windows.Forms.Tests; -public unsafe class NativeToWinFormsAdapterTests +public unsafe partial class NativeToWinFormsAdapterTests { public static TheoryData UnboundedFormat() => [ @@ -53,12 +54,14 @@ public static TheoryData StringFormat() => "FileNameW" ]; - private const string InvalidTypeFormatCombinationMessage = "Type '*' is not compatible with the specified format '*'."; - private const string RequiresResolverMessage = - $"'*' is not a concrete type, and could allow for unbounded deserialization. Use a concrete type or" + - $" define a resolver function that supports types that you are retrieving from the Clipboard or being dragged and dropped."; - private const string UseTryGetDataWithResolver = - "Use 'TryGetData' method with a 'resolver' function that defines a set of allowed types, to deserialize '*'."; + [GeneratedRegex(@"{[0-9]}")] + private static partial Regex PlaceholdersPattern(); + + private static string InvalidTypeFormatCombinationMessage => + PlaceholdersPattern().Replace(SR.ClipboardOrDragDrop_InvalidFormatTypeCombination, "*"); + private static string TypeRequiresResolverMessage => PlaceholdersPattern().Replace(SR.ClipboardOrDragDrop_InvalidType, "*"); + private static string UseTryGetDataWithResolver => PlaceholdersPattern().Replace(SR.ClipboardOrDragDrop_UseTypedAPI, "*"); + private const string FormatterDisabledMessage = "BinaryFormatter serialization and deserialization are disabled within this application. See https://aka.ms/binaryformatter for more information."; @@ -88,7 +91,7 @@ public void TryGetData_AsObject_Primitive_RequiresResolver(string format) DataObject dataObject = new(ComHelpers.GetComPointer(native)); Action tryGetData = () => dataObject.TryGetData(format, out object? value); - tryGetData.Should().Throw().WithMessage(expectedWildcardPattern: RequiresResolverMessage); + tryGetData.Should().Throw().WithMessage(expectedWildcardPattern: TypeRequiresResolverMessage); dataObject.TryGetData(format, Resolver, autoConvert: false, out object? value).Should().BeTrue(); value.Should().Be(1); @@ -129,7 +132,7 @@ public void TryGetData_AsObject_Custom_RequiresResolver(string format) (DataObject dataObject, TestData _) = SetDataObject(format); Action tryGetData = () => dataObject.TryGetData(format, out object? _); - tryGetData.Should().Throw().WithMessage(expectedWildcardPattern: RequiresResolverMessage); + tryGetData.Should().Throw().WithMessage(expectedWildcardPattern: TypeRequiresResolverMessage); } [WinFormsTheory] @@ -142,7 +145,7 @@ public void TryGetData_AsObject_Custom_FormatterEnabled_RequiresResolver(string using BinaryFormatterScope scope = new(enable: true); using BinaryFormatterInClipboardDragDropScope clipboardScope = new(enable: true); - tryGetData.Should().Throw().WithMessage(expectedWildcardPattern: RequiresResolverMessage); + tryGetData.Should().Throw().WithMessage(expectedWildcardPattern: TypeRequiresResolverMessage); } [WinFormsTheory] @@ -208,7 +211,7 @@ public void TryGetData_AsInterface_ListOfPrimitives_RequiresResolver(string form // Theoretically we don't require a resolver here, but this is an exception. In the more common cases resolver // is required to instantiate non-concrete types. Action tryGetData = () => dataObject.TryGetData(format, out IList? _); - tryGetData.Should().Throw().WithMessage(expectedWildcardPattern: RequiresResolverMessage); + tryGetData.Should().Throw().WithMessage(expectedWildcardPattern: TypeRequiresResolverMessage); } [WinFormsTheory] @@ -390,7 +393,7 @@ public void TryGetData_AsAbstract_Custom_RequiresResolver(string format) (DataObject dataObject, TestData _) = SetDataObject(format); Action tryGetData = () => dataObject.TryGetData(format, out AbstractBase? _); - tryGetData.Should().Throw().WithMessage(expectedWildcardPattern: RequiresResolverMessage); + tryGetData.Should().Throw().WithMessage(expectedWildcardPattern: TypeRequiresResolverMessage); dataObject.TryGetData(format, out NotSupportedException? ex).Should().BeTrue(); ex.Should().BeOfType().Which.Message.Should().Be(FormatterDisabledMessage); @@ -406,7 +409,7 @@ public void TryGetData_AsAbstract_Custom_FormatterEnabled_RequiresResolver(strin using BinaryFormatterScope scope = new(enable: true); using BinaryFormatterInClipboardDragDropScope clipboardScope = new(enable: true); - tryGetData.Should().Throw().WithMessage(expectedWildcardPattern: RequiresResolverMessage); + tryGetData.Should().Throw().WithMessage(expectedWildcardPattern: TypeRequiresResolverMessage); } [WinFormsTheory] From c9c06a5d614a2346c4d2773906cd1d8d12c2ae5d Mon Sep 17 00:00:00 2001 From: Jeremy Kuhne Date: Thu, 12 Dec 2024 17:31:58 -0800 Subject: [PATCH 103/106] Move all GDI+ specific interop to System.Private.Windows.GdiPlus (#12633) This removes the risk of not properly initializing GDI+ before calling native methods. It also removes the risk of inadvertently loading GDI+ in WPF. Lastly, it reduces the footprint for WPF. The new project is not under a second `src` folder as we're going to move all tests to the root under `tests`. This allows for better build file structure (Directory.*, etc.) and helps some with MAX_PATH constraints. --- Winforms.sln | 19 + codecov.yml | 1 + .../Microsoft.Private.Winforms.csproj | 3 + ...tem.Windows.Forms.FileClassification.props | 1 + .../src/NativeMethods.txt | 511 ----------------- .../src/Resources/Strings.resx | 3 - .../src/System.Drawing.Common.csproj | 6 + .../src/System/Drawing/Bitmap.cs | 36 +- .../src/System/Drawing/Brush.cs | 2 +- .../Drawing/Drawing2D/AdjustableArrowCap.cs | 18 +- .../System/Drawing/Drawing2D/CustomLineCap.cs | 32 +- .../System/Drawing/Drawing2D/GraphicsPath.cs | 96 ++-- .../Drawing/Drawing2D/GraphicsPathIterator.cs | 26 +- .../System/Drawing/Drawing2D/HatchBrush.cs | 10 +- .../Drawing/Drawing2D/LinearGradientBrush.cs | 52 +- .../src/System/Drawing/Drawing2D/Matrix.cs | 62 +- .../Drawing/Drawing2D/PathGradientBrush.cs | 62 +- .../src/System/Drawing/Font.cs | 26 +- .../src/System/Drawing/FontFamily.cs | 26 +- .../src/System/Drawing/Gdiplus.cs | 18 +- .../src/System/Drawing/Graphics.cs | 280 ++++----- .../src/System/Drawing/Icon.cs | 3 +- .../src/System/Drawing/Image.cs | 86 +-- .../System/Drawing/Imaging/CachedBitmap.cs | 4 +- .../System/Drawing/Imaging/ColorPalette.cs | 2 +- .../Imaging/Effects/ColorMatrixEffect.cs | 2 +- .../System/Drawing/Imaging/Effects/Effect.cs | 6 +- .../System/Drawing/Imaging/ImageAttributes.cs | 36 +- .../System/Drawing/Imaging/ImageCodecInfo.cs | 8 +- .../src/System/Drawing/Imaging/ImageFormat.cs | 48 +- .../src/System/Drawing/Imaging/Metafile.cs | 38 +- .../src/System/Drawing/Pen.cs | 92 +-- .../src/System/Drawing/Region.cs | 74 +-- .../src/System/Drawing/SolidBrush.cs | 8 +- .../src/System/Drawing/StringFormat.cs | 46 +- .../src/System/Drawing/Text/FontCollection.cs | 4 +- .../Drawing/Text/InstalledFontCollection.cs | 2 +- .../Drawing/Text/PrivateFontCollection.cs | 8 +- .../src/System/Drawing/TextureBrush.cs | 28 +- .../src/Windows/Win32/PInvoke.cs | 17 - .../src/NativeMethods.txt | 29 - .../src/Properties/AssemblyInfo.cs | 1 + .../src/Resources/SR.resx | 81 --- .../Windows/Win32/Graphics/Gdi/RegionScope.cs | 44 +- .../Win32/Graphics/Gdi/SelectPaletteScope.cs | 38 -- .../Graphics/GdiPlus/GpImageExtensions.cs | 31 - .../Graphics/GdiPlus/GpMetafileExtensions.cs | 15 - .../Windows/Win32/System/Ole/IPictureDisp.cs | 24 - .../src/Windows/Win32/System/Ole/PICTDESC.cs | 65 --- .../GlobalUsings.cs | 8 + .../NativeMethods.json | 11 + .../NativeMethods.txt | 535 ++++++++++++++++++ .../Properties/AssemblyInfo.cs | 67 +++ .../Resources/SR.resx | 185 ++++++ .../System.Private.Windows.GdiPlus.csproj | 49 ++ .../System/Drawing/ApplyGraphicsProperties.cs | 0 .../System/Drawing/CoreImageExtensions.cs | 10 +- .../System/Drawing/IGraphics.cs | 0 .../System/Drawing/IGraphicsContextInfo.cs | 0 .../System/Drawing/IIcon.cs | 0 .../System/Drawing/IIconExtensions.cs | 47 ++ .../System/Drawing/IImage.cs | 0 .../System/Drawing/ImageCodecInfoHelper.cs | 4 +- .../Graphics/Gdi/DeviceContextHdcScope.cs | 0 .../Win32/Graphics/Gdi/HdcExtensions.cs | 50 ++ .../Graphics/Gdi/IGraphicsHdcProvider.cs | 0 .../Graphics/GdiPlus/EncoderParameters.cs | 0 .../Graphics/GdiPlus/GdiPlusInitialization.cs | 24 +- .../Graphics/GdiPlus/GdiplusStartupInputEx.cs | 0 .../Graphics/GdiPlus/GpBitmapExtensions.cs | 27 +- .../Graphics/GdiPlus/GpImageExtensions.cs | 73 +++ .../Graphics/GdiPlus/GpMetafileExtensions.cs | 31 + .../Graphics/GdiPlus/GpRegionExtensions.cs | 55 ++ .../Win32/Graphics/GdiPlus/PixelFormat.cs | 16 +- .../Windows/Win32/Graphics/GdiPlus/Rect.cs | 0 .../Windows/Win32/Graphics/GdiPlus/RectF.cs | 0 .../Graphics/GdiPlus/StatusExtensions.cs | 2 +- .../Windows/Win32/PInvokeGdiPlus.cs | 27 + .../Windows/Win32/System/Ole/IPicture.cs | 11 +- .../System.Windows.Forms.Primitives.csproj | 1 + .../UnitTests/Interop/Ole32/IPictureTests.cs | 11 +- .../Interop/Oleaut32/ITypeInfoTests.cs | 35 +- .../Win32/System/Com/IDispatchTests.cs | 12 +- src/System.Windows.Forms/src/GlobalUsings.cs | 4 + .../src/System/Resources/DataNodeInfo.cs | 3 - .../src/System/Resources/ResXDataNode.cs | 1 - .../System/Resources/ResXResourceReader.cs | 1 - .../Forms/ActiveX/AxHost.OleInterfaces.cs | 1 - .../System/Windows/Forms/ActiveX/AxHost.cs | 9 +- .../COM2Interop/COM2PictureConverter.cs | 5 +- .../src/System/Windows/Forms/Control.cs | 10 +- .../ButtonBaseAdapter.ColorData.cs | 2 - .../ButtonInternal/CheckBoxFlatAdapter.cs | 2 - .../ButtonInternal/RadioButtonFlatAdapter.cs | 2 - .../ButtonInternal/RadioButtonPopupAdapter.cs | 2 - .../Controls/Buttons/FlatButtonAppearance.cs | 1 - .../DataGridView.AccessibleObject.cs | 1 - .../DataGridViewColumnCollection.cs | 1 - .../DataGridViewComboBoxEditingControl.cs | 1 - .../DataGridView/DataGridViewRowCollection.cs | 1 - .../DataGridViewTextBoxEditingControl.cs | 2 - .../LinkLabel.LinkLabelAccessibleObject.cs | 1 - .../ListView/SearchForVirtualItemEventArgs.cs | 2 - ...Calendar.CalendarButtonAccessibleObject.cs | 1 - .../MonthCalendar.HitTestInfo.cs | 2 - ...hCalendar.MonthCalendarAccessibleObject.cs | 1 - ...opertyGrid.PropertyGridAccessibleObject.cs | 1 - ...idView.PropertyGridViewAccessibleObject.cs | 1 - .../Controls/ToolStrips/ProfessionalColors.cs | 1 - .../ToolStrip.ToolStripAccessibleObject.cs | 1 - .../ToolStrips/ToolStripDropTargetManager.cs | 1 - .../ToolStripLocationCancelEventArgs.cs | 1 - .../ToolStripManager.ModalMenuFilter.cs | 2 - .../Forms/Controls/WebBrowser/HtmlDocument.cs | 1 - .../WebBrowser/HtmlElementEventArgs.cs | 1 - .../WebBrowser/WebBrowser.WebBrowserSite.cs | 1 - .../Controls/WebBrowser/WebBrowserSiteBase.cs | 1 - .../Dialogs/CommonDialogs/ColorDialog.cs | 1 - .../ErrorProvider.ErrorWindow.cs | 3 +- .../Windows/Forms/Help/HelpEventArgs.cs | 2 - .../Forms/Input/HandledMouseEventArgs.cs | 2 - .../Windows/Forms/Input/MouseEventArgs.cs | 2 - .../Forms/Rendering/DrawingEventArgs.cs | 3 +- .../Windows/Forms/Rendering/ScreenDcCache.cs | 1 - .../ScrollBar.ScrollBarAccessibleObject.cs | 1 - .../Windows/Forms/ToolTip/ToolTip.TipInfo.cs | 2 - .../Com2Interop/ComNativeDescriptorTests.cs | 7 +- 127 files changed, 1898 insertions(+), 1615 deletions(-) delete mode 100644 src/System.Drawing.Common/src/Windows/Win32/PInvoke.cs delete mode 100644 src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/GpImageExtensions.cs delete mode 100644 src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/GpMetafileExtensions.cs delete mode 100644 src/System.Private.Windows.Core/src/Windows/Win32/System/Ole/IPictureDisp.cs delete mode 100644 src/System.Private.Windows.Core/src/Windows/Win32/System/Ole/PICTDESC.cs create mode 100644 src/System.Private.Windows.GdiPlus/GlobalUsings.cs create mode 100644 src/System.Private.Windows.GdiPlus/NativeMethods.json create mode 100644 src/System.Private.Windows.GdiPlus/NativeMethods.txt create mode 100644 src/System.Private.Windows.GdiPlus/Properties/AssemblyInfo.cs create mode 100644 src/System.Private.Windows.GdiPlus/Resources/SR.resx create mode 100644 src/System.Private.Windows.GdiPlus/System.Private.Windows.GdiPlus.csproj rename src/{System.Private.Windows.Core/src => System.Private.Windows.GdiPlus}/System/Drawing/ApplyGraphicsProperties.cs (100%) rename src/{System.Private.Windows.Core/src => System.Private.Windows.GdiPlus}/System/Drawing/CoreImageExtensions.cs (74%) rename src/{System.Private.Windows.Core/src => System.Private.Windows.GdiPlus}/System/Drawing/IGraphics.cs (100%) rename src/{System.Private.Windows.Core/src => System.Private.Windows.GdiPlus}/System/Drawing/IGraphicsContextInfo.cs (100%) rename src/{System.Private.Windows.Core/src => System.Private.Windows.GdiPlus}/System/Drawing/IIcon.cs (100%) create mode 100644 src/System.Private.Windows.GdiPlus/System/Drawing/IIconExtensions.cs rename src/{System.Private.Windows.Core/src => System.Private.Windows.GdiPlus}/System/Drawing/IImage.cs (100%) rename src/{System.Private.Windows.Core/src => System.Private.Windows.GdiPlus}/System/Drawing/ImageCodecInfoHelper.cs (90%) rename src/{System.Private.Windows.Core/src => System.Private.Windows.GdiPlus}/Windows/Win32/Graphics/Gdi/DeviceContextHdcScope.cs (100%) create mode 100644 src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/Gdi/HdcExtensions.cs rename src/{System.Private.Windows.Core/src => System.Private.Windows.GdiPlus}/Windows/Win32/Graphics/Gdi/IGraphicsHdcProvider.cs (100%) rename src/{System.Private.Windows.Core/src => System.Private.Windows.GdiPlus}/Windows/Win32/Graphics/GdiPlus/EncoderParameters.cs (100%) rename src/{System.Private.Windows.Core/src => System.Private.Windows.GdiPlus}/Windows/Win32/Graphics/GdiPlus/GdiPlusInitialization.cs (69%) rename src/{System.Private.Windows.Core/src => System.Private.Windows.GdiPlus}/Windows/Win32/Graphics/GdiPlus/GdiplusStartupInputEx.cs (100%) rename src/{System.Private.Windows.Core/src => System.Private.Windows.GdiPlus}/Windows/Win32/Graphics/GdiPlus/GpBitmapExtensions.cs (59%) create mode 100644 src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/GpImageExtensions.cs create mode 100644 src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/GpMetafileExtensions.cs create mode 100644 src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/GpRegionExtensions.cs rename src/{System.Private.Windows.Core/src => System.Private.Windows.GdiPlus}/Windows/Win32/Graphics/GdiPlus/PixelFormat.cs (92%) rename src/{System.Private.Windows.Core/src => System.Private.Windows.GdiPlus}/Windows/Win32/Graphics/GdiPlus/Rect.cs (100%) rename src/{System.Private.Windows.Core/src => System.Private.Windows.GdiPlus}/Windows/Win32/Graphics/GdiPlus/RectF.cs (100%) rename src/{System.Private.Windows.Core/src => System.Private.Windows.GdiPlus}/Windows/Win32/Graphics/GdiPlus/StatusExtensions.cs (98%) create mode 100644 src/System.Private.Windows.GdiPlus/Windows/Win32/PInvokeGdiPlus.cs rename src/{System.Private.Windows.Core/src => System.Private.Windows.GdiPlus}/Windows/Win32/System/Ole/IPicture.cs (78%) diff --git a/Winforms.sln b/Winforms.sln index 2e590cb4b85..c012dd45fe1 100644 --- a/Winforms.sln +++ b/Winforms.sln @@ -200,6 +200,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Analyzers", "Analyzers", "{ eng\Analyzer.targets = eng\Analyzer.targets EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Private.Windows.GdiPlus", "src\System.Private.Windows.GdiPlus\System.Private.Windows.GdiPlus.csproj", "{442C867C-51C0-8CE5-F067-DF065008E3DA}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1084,6 +1086,22 @@ Global {B653C860-9B52-4597-9921-24DA79A4E6B1}.Release|x64.Build.0 = Release|Any CPU {B653C860-9B52-4597-9921-24DA79A4E6B1}.Release|x86.ActiveCfg = Release|Any CPU {B653C860-9B52-4597-9921-24DA79A4E6B1}.Release|x86.Build.0 = Release|Any CPU + {442C867C-51C0-8CE5-F067-DF065008E3DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {442C867C-51C0-8CE5-F067-DF065008E3DA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {442C867C-51C0-8CE5-F067-DF065008E3DA}.Debug|arm64.ActiveCfg = Debug|Any CPU + {442C867C-51C0-8CE5-F067-DF065008E3DA}.Debug|arm64.Build.0 = Debug|Any CPU + {442C867C-51C0-8CE5-F067-DF065008E3DA}.Debug|x64.ActiveCfg = Debug|Any CPU + {442C867C-51C0-8CE5-F067-DF065008E3DA}.Debug|x64.Build.0 = Debug|Any CPU + {442C867C-51C0-8CE5-F067-DF065008E3DA}.Debug|x86.ActiveCfg = Debug|Any CPU + {442C867C-51C0-8CE5-F067-DF065008E3DA}.Debug|x86.Build.0 = Debug|Any CPU + {442C867C-51C0-8CE5-F067-DF065008E3DA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {442C867C-51C0-8CE5-F067-DF065008E3DA}.Release|Any CPU.Build.0 = Release|Any CPU + {442C867C-51C0-8CE5-F067-DF065008E3DA}.Release|arm64.ActiveCfg = Release|Any CPU + {442C867C-51C0-8CE5-F067-DF065008E3DA}.Release|arm64.Build.0 = Release|Any CPU + {442C867C-51C0-8CE5-F067-DF065008E3DA}.Release|x64.ActiveCfg = Release|Any CPU + {442C867C-51C0-8CE5-F067-DF065008E3DA}.Release|x64.Build.0 = Release|Any CPU + {442C867C-51C0-8CE5-F067-DF065008E3DA}.Release|x86.ActiveCfg = Release|Any CPU + {442C867C-51C0-8CE5-F067-DF065008E3DA}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1153,6 +1171,7 @@ Global {B653C860-9B52-4597-9921-24DA79A4E6B1} = {583F1292-AE8D-4511-B8D8-A81FE4642DDC} {656C66A4-59CD-4E14-8AE4-1F5BCEECB553} = {8B4B1E09-B3C7-4044-B223-94EDEC1CAA20} {D4D97D78-D213-45DF-B003-9C4C9F2E5E1C} = {8B4B1E09-B3C7-4044-B223-94EDEC1CAA20} + {442C867C-51C0-8CE5-F067-DF065008E3DA} = {77FEDB47-F7F6-490D-AF7C-ABB4A9E0B9D7} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {7B1B0433-F612-4E5A-BE7E-FCF5B9F6E136} diff --git a/codecov.yml b/codecov.yml index 9f3456b4aa0..7059abcff5e 100644 --- a/codecov.yml +++ b/codecov.yml @@ -25,6 +25,7 @@ flags: # which files to include in the reporting - src/System.Drawing.Common/src/ - src/System.Drawing.Design/src/ - src/System.Private.Windows.Core/src/ + - src/System.Private.Windows.GdiPlus/ - src/System.Windows.Forms/src/ - src/System.Windows.Forms.Analyzers/src/ - src/System.Windows.Forms.Analyzers.CSharp/src/ diff --git a/pkg/Microsoft.Private.Winforms/Microsoft.Private.Winforms.csproj b/pkg/Microsoft.Private.Winforms/Microsoft.Private.Winforms.csproj index af01e8c7b11..3355424ed37 100644 --- a/pkg/Microsoft.Private.Winforms/Microsoft.Private.Winforms.csproj +++ b/pkg/Microsoft.Private.Winforms/Microsoft.Private.Winforms.csproj @@ -85,6 +85,9 @@ + + + diff --git a/pkg/Microsoft.Private.Winforms/sdk/dotnet-windowsdesktop/System.Windows.Forms.FileClassification.props b/pkg/Microsoft.Private.Winforms/sdk/dotnet-windowsdesktop/System.Windows.Forms.FileClassification.props index 3089298e670..bf64403eef9 100644 --- a/pkg/Microsoft.Private.Winforms/sdk/dotnet-windowsdesktop/System.Windows.Forms.FileClassification.props +++ b/pkg/Microsoft.Private.Winforms/sdk/dotnet-windowsdesktop/System.Windows.Forms.FileClassification.props @@ -13,6 +13,7 @@ + diff --git a/src/System.Drawing.Common/src/NativeMethods.txt b/src/System.Drawing.Common/src/NativeMethods.txt index 8c337cad3c9..8eaca883d5c 100644 --- a/src/System.Drawing.Common/src/NativeMethods.txt +++ b/src/System.Drawing.Common/src/NativeMethods.txt @@ -28,517 +28,6 @@ EndPage EnumPrinters ExtEscape ExtractAssociatedIcon -GdipAddPathArc -GdipAddPathBezier -GdipAddPathBeziers -GdipAddPathBeziersI -GdipAddPathClosedCurve2 -GdipAddPathClosedCurve2I -GdipAddPathCurve2 -GdipAddPathCurve2I -GdipAddPathCurve3 -GdipAddPathCurve3I -GdipAddPathEllipse -GdipAddPathLine -GdipAddPathLine2 -GdipAddPathLine2I -GdipAddPathPath -GdipAddPathPie -GdipAddPathPolygon -GdipAddPathPolygonI -GdipAddPathRectangle -GdipAddPathRectangles -GdipAddPathRectanglesI -GdipAddPathString -GdipBeginContainer -GdipBeginContainer2 -GdipBitmapApplyEffect -GdipBitmapConvertFormat -GdipBitmapGetPixel -GdipBitmapSetPixel -GdipBitmapSetResolution -GdipClearPathMarkers -GdipCloneBitmapArea -GdipCloneBitmapAreaI -GdipCloneBrush -GdipCloneCustomLineCap -GdipCloneFont -GdipCloneFontFamily -GdipCloneImage -GdipCloneImageAttributes -GdipCloneMatrix -GdipClonePath -GdipClonePen -GdipCloneRegion -GdipCloneStringFormat -GdipClosePathFigure -GdipClosePathFigures -GdipCombineRegionPath -GdipCombineRegionRect -GdipCombineRegionRegion -GdipComment -GdipCreateAdjustableArrowCap -GdipCreateBitmapFromFile -GdipCreateBitmapFromFileICM -GdipCreateBitmapFromGraphics -GdipCreateBitmapFromHBITMAP -GdipCreateBitmapFromHICON -GdipCreateBitmapFromResource -GdipCreateBitmapFromScan0 -GdipCreateBitmapFromStream -GdipCreateBitmapFromStreamICM -GdipCreateCachedBitmap -GdipCreateCustomLineCap -GdipCreateEffect -GdipCreateFont -GdipCreateFontFamilyFromName -GdipCreateFontFromDC -GdipCreateFontFromLogfont -GdipCreateFromHDC -GdipCreateFromHDC2 -GdipCreateHatchBrush -GdipCreateHICONFromBitmap -GdipCreateImageAttributes -GdipCreateLineBrush -GdipCreateLineBrushFromRect -GdipCreateLineBrushFromRectWithAngle -GdipCreateMatrix -GdipCreateMatrix2 -GdipCreateMatrix3 -GdipCreateMatrix3I -GdipCreateMetafileFromEmf -GdipCreateMetafileFromFile -GdipCreateMetafileFromStream -GdipCreateMetafileFromWmf -GdipCreatePath -GdipCreatePath2 -GdipCreatePath2I -GdipCreatePathGradient -GdipCreatePathGradientFromPath -GdipCreatePathGradientI -GdipCreatePathIter -GdipCreatePen1 -GdipCreatePen2 -GdipCreateRegion -GdipCreateRegionHrgn -GdipCreateRegionPath -GdipCreateRegionRect -GdipCreateRegionRgnData -GdipCreateSolidFill -GdipCreateStringFormat -GdipCreateTexture -GdipCreateTexture2 -GdipCreateTextureIA -GdipDeleteBrush -GdipDeleteCachedBitmap -GdipDeleteCustomLineCap -GdipDeleteCustomLineCap -GdipDeleteEffect -GdipDeleteFont -GdipDeleteFontFamily -GdipDeleteMatrix -GdipDeletePath -GdipDeletePathIter -GdipDeletePen -GdipDeletePrivateFontCollection -GdipDeleteRegion -GdipDeleteStringFormat -GdipDisposeImage -GdipDisposeImage -GdipDisposeImageAttributes -GdipDrawArc -GdipDrawBezier -GdipDrawBeziers -GdipDrawBeziersI -GdipDrawCachedBitmap -GdipDrawClosedCurve -GdipDrawClosedCurve2 -GdipDrawClosedCurve2I -GdipDrawClosedCurveI -GdipDrawCurve -GdipDrawCurve2 -GdipDrawCurve2I -GdipDrawCurve3 -GdipDrawCurve3I -GdipDrawCurveI -GdipDrawEllipse -GdipDrawImage -GdipDrawImageFX -GdipDrawImagePointRect -GdipDrawImagePoints -GdipDrawImagePointsI -GdipDrawImagePointsRect -GdipDrawImagePointsRectI -GdipDrawImageRect -GdipDrawImageRectRect -GdipDrawLine -GdipDrawLines -GdipDrawLinesI -GdipDrawPath -GdipDrawPie -GdipDrawPolygon -GdipDrawPolygonI -GdipDrawRectangle -GdipDrawRectangles -GdipDrawRectanglesI -GdipDrawString -GdipEndContainer -GdipEnumerateMetafileDestPoint -GdipEnumerateMetafileDestPoints -GdipEnumerateMetafileDestPointsI -GdipEnumerateMetafileDestRect -GdipEnumerateMetafileSrcRectDestPoint -GdipEnumerateMetafileSrcRectDestPoints -GdipEnumerateMetafileSrcRectDestPointsI -GdipEnumerateMetafileSrcRectDestRect -GdipFillClosedCurve -GdipFillClosedCurve2 -GdipFillClosedCurve2I -GdipFillClosedCurveI -GdipFillEllipse -GdipFillPath -GdipFillPie -GdipFillPolygon -GdipFillPolygonI -GdipFillRectangle -GdipFillRectangles -GdipFillRectanglesI -GdipFillRegion -GdipFlattenPath -GdipFlush -GdipGetAdjustableArrowCapFillState -GdipGetAdjustableArrowCapHeight -GdipGetAdjustableArrowCapMiddleInset -GdipGetAdjustableArrowCapWidth -GdipGetAllPropertyItems -GdipGetCellAscent -GdipGetCellDescent -GdipGetClip -GdipGetClipBounds -GdipGetCompositingMode -GdipGetCompositingQuality -GdipGetCustomLineCapBaseCap -GdipGetCustomLineCapBaseInset -GdipGetCustomLineCapStrokeCaps -GdipGetCustomLineCapStrokeJoin -GdipGetCustomLineCapType -GdipGetCustomLineCapWidthScale -GdipGetDC -GdipGetDpiX -GdipGetDpiY -GdipGetEmHeight -GdipGetEncoderParameterList -GdipGetEncoderParameterListSize -GdipGetFamily -GdipGetFamilyName -GdipGetFontCollectionFamilyCount -GdipGetFontCollectionFamilyList -GdipGetFontHeight -GdipGetFontHeightGivenDPI -GdipGetFontSize -GdipGetFontStyle -GdipGetFontUnit -GdipGetGenericFontFamilyMonospace -GdipGetGenericFontFamilySansSerif -GdipGetGenericFontFamilySerif -GdipGetHatchBackgroundColor -GdipGetHatchForegroundColor -GdipGetHatchStyle -GdipGetImageAttributesAdjustedPalette -GdipGetImageDecoders -GdipGetImageDecodersSize -GdipGetImageDimension -GdipGetImageFlags -GdipGetImageGraphicsContext -GdipGetImageHeight -GdipGetImageHorizontalResolution -GdipGetImagePalette -GdipGetImagePaletteSize -GdipGetImageRawFormat -GdipGetImageThumbnail -GdipGetImageType -GdipGetImageVerticalResolution -GdipGetImageWidth -GdipGetInterpolationMode -GdipGetLineBlend -GdipGetLineBlendCount -GdipGetLineColors -GdipGetLineGammaCorrection -GdipGetLinePresetBlend -GdipGetLinePresetBlendCount -GdipGetLineRect -GdipGetLineSpacing -GdipGetLineTransform -GdipGetLineWrapMode -GdipGetLogFont -GdipGetMatrixElements -GdipGetMetafileHeaderFromEmf -GdipGetMetafileHeaderFromFile -GdipGetMetafileHeaderFromMetafile -GdipGetMetafileHeaderFromStream -GdipGetMetafileHeaderFromWmf -GdipGetNearestColor -GdipGetPageScale -GdipGetPageUnit -GdipGetPathData -GdipGetPathFillMode -GdipGetPathGradientBlend -GdipGetPathGradientBlendCount -GdipGetPathGradientCenterColor -GdipGetPathGradientCenterPoint -GdipGetPathGradientFocusScales -GdipGetPathGradientPresetBlend -GdipGetPathGradientPresetBlendCount -GdipGetPathGradientRect -GdipGetPathGradientSurroundColorCount -GdipGetPathGradientSurroundColorsWithCount -GdipGetPathGradientTransform -GdipGetPathGradientWrapMode -GdipGetPathLastPoint -GdipGetPathPoints -GdipGetPathTypes -GdipGetPathWorldBounds -GdipGetPenBrushFill -GdipGetPenColor -GdipGetPenCompoundArray -GdipGetPenCompoundCount -GdipGetPenCustomEndCap -GdipGetPenCustomStartCap -GdipGetPenDashArray -GdipGetPenDashCap197819 -GdipGetPenDashCount -GdipGetPenDashOffset -GdipGetPenDashStyle -GdipGetPenEndCap -GdipGetPenFillType -GdipGetPenLineJoin -GdipGetPenMiterLimit -GdipGetPenMode -GdipGetPenStartCap -GdipGetPenTransform -GdipGetPenWidth -GdipGetPixelOffsetMode -GdipGetPointCount -GdipGetPropertyCount -GdipGetPropertyIdList -GdipGetPropertyItem -GdipGetPropertyItemSize -GdipGetPropertySize -GdipGetRegionBounds -GdipGetRegionData -GdipGetRegionDataSize -GdipGetRegionScans -GdipGetRegionScansCount -GdipGetRenderingOrigin -GdipGetSmoothingMode -GdipGetSolidFillColor -GdipGetStringFormatAlign -GdipGetStringFormatDigitSubstitution -GdipGetStringFormatFlags -GdipGetStringFormatHotkeyPrefix -GdipGetStringFormatLineAlign -GdipGetStringFormatMeasurableCharacterRangeCount -GdipGetStringFormatTabStopCount -GdipGetStringFormatTabStops -GdipGetStringFormatTrimming -GdipGetTextContrast -GdipGetTextRenderingHint -GdipGetTextureImage -GdipGetTextureTransform -GdipGetTextureWrapMode -GdipGetVisibleClipBounds -GdipGetWorldTransform -GdipGraphicsClear -GdipImageForceValidation -GdipImageGetFrameCount -GdipImageGetFrameDimensionsCount -GdipImageGetFrameDimensionsList -GdipImageRotateFlip -GdipImageSelectActiveFrame -GdipInitializePalette -GdipInvertMatrix -GdipIsClipEmpty -GdipIsEmptyRegion -GdipIsEqualRegion -GdipIsMatrixEqual -GdipIsMatrixIdentity -GdipIsMatrixInvertible -GdipIsOutlineVisiblePathPoint -GdipIsStyleAvailable -GdipIsVisibleClipEmpty -GdipIsVisiblePathPoint -GdipIsVisiblePoint -GdipIsVisibleRect -GdipIsVisibleRegionPoint -GdipIsVisibleRegionRect -GdipLoadImageFromFile -GdipLoadImageFromFileICM -GdipLoadImageFromStream -GdipLoadImageFromStreamICM -GdipMeasureCharacterRanges -GdipMeasureString -GdipMultiplyLineTransform -GdipMultiplyMatrix -GdipMultiplyPathGradientTransform -GdipMultiplyPenTransform -GdipMultiplyTextureTransform -GdipMultiplyWorldTransform -GdipNewInstalledFontCollection -GdipNewPrivateFontCollection -GdipPathIterCopyData -GdipPathIterEnumerate -GdipPathIterGetCount -GdipPathIterGetSubpathCount -GdipPathIterHasCurve -GdipPathIterIsValid -GdipPathIterNextMarker -GdipPathIterNextMarkerPath -GdipPathIterNextPathType -GdipPathIterNextSubpath -GdipPathIterNextSubpathPath -GdipPathIterRewind -GdipPlayMetafileRecord -GdipPrivateAddFontFile -GdipPrivateAddMemoryFont -GdipRecordMetafile -GdipRecordMetafileFileName -GdipRecordMetafileStream -GdipReleaseDC -GdipRemovePropertyItem -GdipResetClip -GdipResetLineTransform -GdipResetPath -GdipResetPathGradientTransform -GdipResetPenTransform -GdipResetTextureTransform -GdipResetWorldTransform -GdipRestoreGraphics -GdipReversePath -GdipRotateLineTransform -GdipRotateMatrix -GdipRotatePathGradientTransform -GdipRotatePenTransform -GdipRotateTextureTransform -GdipRotateWorldTransform -GdipSaveAdd -GdipSaveAddImage -GdipSaveGraphics -GdipSaveImageToFile -GdipScaleLineTransform -GdipScaleMatrix -GdipScalePathGradientTransform -GdipScalePenTransform -GdipScaleTextureTransform -GdipScaleWorldTransform -GdipSetAdjustableArrowCapFillState -GdipSetAdjustableArrowCapHeight -GdipSetAdjustableArrowCapMiddleInset -GdipSetAdjustableArrowCapWidth -GdipSetClipGraphics -GdipSetClipPath -GdipSetClipRect -GdipSetClipRegion -GdipSetCompositingMode -GdipSetCompositingQuality -GdipSetCustomLineCapBaseCap -GdipSetCustomLineCapBaseInset -GdipSetCustomLineCapStrokeCaps -GdipSetCustomLineCapStrokeJoin -GdipSetCustomLineCapWidthScale -GdipSetEffectParameters -GdipSetEmpty -GdipSetImageAttributesColorKeys -GdipSetImageAttributesColorMatrix -GdipSetImageAttributesGamma -GdipSetImageAttributesNoOp -GdipSetImageAttributesOutputChannel -GdipSetImageAttributesOutputChannelColorProfile -GdipSetImageAttributesRemapTable -GdipSetImageAttributesThreshold -GdipSetImageAttributesWrapMode -GdipSetImagePalette -GdipSetInfinite -GdipSetInterpolationMode -GdipSetLineBlend -GdipSetLineColors -GdipSetLineGammaCorrection -GdipSetLineLinearBlend -GdipSetLinePresetBlend -GdipSetLineSigmaBlend -GdipSetLineTransform -GdipSetLineWrapMode -GdipSetMatrixElements -GdipSetPageScale -GdipSetPageUnit -GdipSetPathFillMode -GdipSetPathGradientBlend -GdipSetPathGradientCenterColor -GdipSetPathGradientCenterPoint -GdipSetPathGradientFocusScales -GdipSetPathGradientLinearBlend -GdipSetPathGradientPresetBlend -GdipSetPathGradientSigmaBlend -GdipSetPathGradientSurroundColorsWithCount -GdipSetPathGradientTransform -GdipSetPathGradientWrapMode -GdipSetPathMarker -GdipSetPenBrushFill -GdipSetPenColor -GdipSetPenCompoundArray -GdipSetPenCustomEndCap -GdipSetPenCustomStartCap -GdipSetPenDashArray -GdipSetPenDashCap197819 -GdipSetPenDashOffset -GdipSetPenDashStyle -GdipSetPenEndCap -GdipSetPenLineCap197819 -GdipSetPenLineJoin -GdipSetPenMiterLimit -GdipSetPenMode -GdipSetPenStartCap -GdipSetPenTransform -GdipSetPenWidth -GdipSetPixelOffsetMode -GdipSetPropertyItem -GdipSetRenderingOrigin -GdipSetSmoothingMode -GdipSetSolidFillColor -GdipSetStringFormatAlign -GdipSetStringFormatDigitSubstitution -GdipSetStringFormatFlags -GdipSetStringFormatHotkeyPrefix -GdipSetStringFormatLineAlign -GdipSetStringFormatMeasurableCharacterRanges -GdipSetStringFormatTabStops -GdipSetStringFormatTrimming -GdipSetTextContrast -GdipSetTextRenderingHint -GdipSetTextureTransform -GdipSetTextureWrapMode -GdipSetWorldTransform -GdipShearMatrix -GdipStartPathFigure -GdipStringFormatGetGenericDefault -GdipStringFormatGetGenericTypographic -GdipTransformMatrixPoints -GdipTransformMatrixPointsI -GdipTransformPath -GdipTransformPoints -GdipTransformPointsI -GdipTransformRegion -GdipTranslateClip -GdipTranslateLineTransform -GdipTranslateMatrix -GdipTranslatePathGradientTransform -GdipTranslatePenTransform -GdipTranslateRegion -GdipTranslateTextureTransform -GdipTranslateWorldTransform -GdipVectorTransformMatrixPoints -GdipVectorTransformMatrixPointsI -GdipWarpPath -GdipWidenPath GetDIBits HueSaturationLightnessEffectGuid HueSaturationLightnessParams diff --git a/src/System.Drawing.Common/src/Resources/Strings.resx b/src/System.Drawing.Common/src/Resources/Strings.resx index a1da963ca68..82fe376f2de 100644 --- a/src/System.Drawing.Common/src/Resources/Strings.resx +++ b/src/System.Drawing.Common/src/Resources/Strings.resx @@ -329,9 +329,6 @@ Occurs before each page is printed. Useful for changing PageSettings for a particular page. - - System.Drawing.Common is not supported on non-Windows platforms. See https://aka.ms/systemdrawingnonwindows for more information. - Defines an object that sends output to a printer. diff --git a/src/System.Drawing.Common/src/System.Drawing.Common.csproj b/src/System.Drawing.Common/src/System.Drawing.Common.csproj index a65375a7a21..ae2854277ae 100644 --- a/src/System.Drawing.Common/src/System.Drawing.Common.csproj +++ b/src/System.Drawing.Common/src/System.Drawing.Common.csproj @@ -56,6 +56,12 @@ all + + TargetFramework=$(TargetFramework) + true + all + + all diff --git a/src/System.Drawing.Common/src/System/Drawing/Bitmap.cs b/src/System.Drawing.Common/src/System/Drawing/Bitmap.cs index 80fb744a520..ca3fd84a2bf 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Bitmap.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Bitmap.cs @@ -37,8 +37,8 @@ public Bitmap(string filename, bool useIcm) fixed (char* fn = filename) { Status status = useIcm - ? PInvoke.GdipCreateBitmapFromFileICM(fn, &bitmap) - : PInvoke.GdipCreateBitmapFromFile(fn, &bitmap); + ? PInvokeGdiPlus.GdipCreateBitmapFromFileICM(fn, &bitmap) + : PInvokeGdiPlus.GdipCreateBitmapFromFile(fn, &bitmap); status.ThrowIfFailed(); } @@ -58,8 +58,8 @@ public Bitmap(Stream stream, bool useIcm) GpBitmap* bitmap = null; Status status = useIcm - ? PInvoke.GdipCreateBitmapFromStreamICM(iStream, &bitmap) - : PInvoke.GdipCreateBitmapFromStream(iStream, &bitmap); + ? PInvokeGdiPlus.GdipCreateBitmapFromStreamICM(iStream, &bitmap) + : PInvokeGdiPlus.GdipCreateBitmapFromStream(iStream, &bitmap); status.ThrowIfFailed(); ValidateImage((GpImage*)bitmap); @@ -89,7 +89,7 @@ public Bitmap(int width, int height, Graphics g) ArgumentNullException.ThrowIfNull(g); GpBitmap* bitmap; - PInvoke.GdipCreateBitmapFromGraphics(width, height, g.NativeGraphics, &bitmap).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreateBitmapFromGraphics(width, height, g.NativeGraphics, &bitmap).ThrowIfFailed(); SetNativeImage((GpImage*)bitmap); GC.KeepAlive(g); } @@ -97,14 +97,14 @@ public Bitmap(int width, int height, Graphics g) public Bitmap(int width, int height, int stride, PixelFormat format, IntPtr scan0) { GpBitmap* bitmap; - PInvoke.GdipCreateBitmapFromScan0(width, height, stride, (int)format, (byte*)scan0, &bitmap).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreateBitmapFromScan0(width, height, stride, (int)format, (byte*)scan0, &bitmap).ThrowIfFailed(); SetNativeImage((GpImage*)bitmap); } public Bitmap(int width, int height, PixelFormat format) { GpBitmap* bitmap; - PInvoke.GdipCreateBitmapFromScan0(width, height, 0, (int)format, null, &bitmap).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreateBitmapFromScan0(width, height, 0, (int)format, null, &bitmap).ThrowIfFailed(); SetNativeImage((GpImage*)bitmap); } @@ -133,7 +133,7 @@ private Bitmap(SerializationInfo info, StreamingContext context) : base(info, co public static Bitmap FromHicon(IntPtr hicon) { GpBitmap* bitmap; - PInvoke.GdipCreateBitmapFromHICON((HICON)hicon, &bitmap).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreateBitmapFromHICON((HICON)hicon, &bitmap).ThrowIfFailed(); return new Bitmap(bitmap); } @@ -143,7 +143,7 @@ public static Bitmap FromResource(IntPtr hinstance, string bitmapName) GpBitmap* bitmap = null; fixed (char* bn = bitmapName) { - PInvoke.GdipCreateBitmapFromResource((HINSTANCE)hinstance, bn, &bitmap).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreateBitmapFromResource((HINSTANCE)hinstance, bn, &bitmap).ThrowIfFailed(); } return new Bitmap(bitmap); @@ -176,7 +176,7 @@ public IntPtr GetHbitmap(Color background) public IntPtr GetHicon() { HICON hicon; - PInvoke.GdipCreateHICONFromBitmap(this.Pointer(), &hicon).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreateHICONFromBitmap(this.Pointer(), &hicon).ThrowIfFailed(); GC.KeepAlive(this); return hicon; } @@ -190,7 +190,7 @@ public Bitmap Clone(RectangleF rect, PixelFormat format) GpBitmap* clone; - Status status = PInvoke.GdipCloneBitmapArea( + Status status = PInvokeGdiPlus.GdipCloneBitmapArea( rect.X, rect.Y, rect.Width, rect.Height, (int)format, this.Pointer(), @@ -304,7 +304,7 @@ public Color GetPixel(int x, int y) } uint color; - PInvoke.GdipBitmapGetPixel(this.Pointer(), x, y, &color).ThrowIfFailed(); + PInvokeGdiPlus.GdipBitmapGetPixel(this.Pointer(), x, y, &color).ThrowIfFailed(); GC.KeepAlive(this); return Color.FromArgb((int)color); } @@ -326,13 +326,13 @@ public void SetPixel(int x, int y, Color color) throw new ArgumentOutOfRangeException(nameof(y), SR.ValidRangeY); } - PInvoke.GdipBitmapSetPixel(this.Pointer(), x, y, (uint)color.ToArgb()).ThrowIfFailed(); + PInvokeGdiPlus.GdipBitmapSetPixel(this.Pointer(), x, y, (uint)color.ToArgb()).ThrowIfFailed(); GC.KeepAlive(this); } public void SetResolution(float xDpi, float yDpi) { - PInvoke.GdipBitmapSetResolution(this.Pointer(), xDpi, yDpi).ThrowIfFailed(); + PInvokeGdiPlus.GdipBitmapSetResolution(this.Pointer(), xDpi, yDpi).ThrowIfFailed(); GC.KeepAlive(this); } @@ -344,7 +344,7 @@ public Bitmap Clone(Rectangle rect, PixelFormat format) } GpBitmap* clone; - Status status = PInvoke.GdipCloneBitmapAreaI( + Status status = PInvokeGdiPlus.GdipCloneBitmapAreaI( rect.X, rect.Y, rect.Width, rect.Height, (int)format, this.Pointer(), @@ -368,7 +368,7 @@ public Bitmap Clone(Rectangle rect, PixelFormat format) public void ApplyEffect(Effect effect, Rectangle area = default) { RECT rect = area; - PInvoke.GdipBitmapApplyEffect( + PInvokeGdiPlus.GdipBitmapApplyEffect( this.Pointer(), effect.Pointer(), area.IsEmpty ? null : &rect, @@ -449,7 +449,7 @@ public void ConvertFormat( { if (palette is null) { - PInvoke.GdipBitmapConvertFormat( + PInvokeGdiPlus.GdipBitmapConvertFormat( this.Pointer(), (int)format, (GdiPlus.DitherType)ditherType, @@ -462,7 +462,7 @@ public void ConvertFormat( using var buffer = palette.ConvertToBuffer(); fixed (void* b = buffer) { - PInvoke.GdipBitmapConvertFormat( + PInvokeGdiPlus.GdipBitmapConvertFormat( this.Pointer(), (int)format, (GdiPlus.DitherType)ditherType, diff --git a/src/System.Drawing.Common/src/System/Drawing/Brush.cs b/src/System.Drawing.Common/src/System/Drawing/Brush.cs index b4b22a41e66..ce0c3224399 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Brush.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Brush.cs @@ -28,7 +28,7 @@ protected virtual void Dispose(bool disposing) { if (_nativeBrush is not null) { - Status status = !Gdip.Initialized ? Status.Ok : PInvoke.GdipDeleteBrush(_nativeBrush); + Status status = !Gdip.Initialized ? Status.Ok : PInvokeGdiPlus.GdipDeleteBrush(_nativeBrush); _nativeBrush = null; Debug.Assert(status == Status.Ok, $"GDI+ returned an error status: {status}"); } diff --git a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/AdjustableArrowCap.cs b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/AdjustableArrowCap.cs index 4ed77426d66..664beacb42e 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/AdjustableArrowCap.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/AdjustableArrowCap.cs @@ -12,7 +12,7 @@ public AdjustableArrowCap(float width, float height) : this(width, height, true) public AdjustableArrowCap(float width, float height, bool isFilled) { GpAdjustableArrowCap* nativeCap; - PInvoke.GdipCreateAdjustableArrowCap(height, width, isFilled, &nativeCap).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreateAdjustableArrowCap(height, width, isFilled, &nativeCap).ThrowIfFailed(); SetNativeLineCap((GpCustomLineCap*)nativeCap); } @@ -23,13 +23,13 @@ public float Height get { float height; - PInvoke.GdipGetAdjustableArrowCapHeight(NativeArrowCap, &height).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetAdjustableArrowCapHeight(NativeArrowCap, &height).ThrowIfFailed(); GC.KeepAlive(this); return height; } set { - PInvoke.GdipSetAdjustableArrowCapHeight(NativeArrowCap, value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetAdjustableArrowCapHeight(NativeArrowCap, value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -39,13 +39,13 @@ public float Width get { float width; - PInvoke.GdipGetAdjustableArrowCapWidth(NativeArrowCap, &width).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetAdjustableArrowCapWidth(NativeArrowCap, &width).ThrowIfFailed(); GC.KeepAlive(this); return width; } set { - PInvoke.GdipSetAdjustableArrowCapWidth(NativeArrowCap, value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetAdjustableArrowCapWidth(NativeArrowCap, value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -55,13 +55,13 @@ public float MiddleInset get { float middleInset; - PInvoke.GdipGetAdjustableArrowCapMiddleInset(NativeArrowCap, &middleInset).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetAdjustableArrowCapMiddleInset(NativeArrowCap, &middleInset).ThrowIfFailed(); GC.KeepAlive(this); return middleInset; } set { - PInvoke.GdipSetAdjustableArrowCapMiddleInset(NativeArrowCap, value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetAdjustableArrowCapMiddleInset(NativeArrowCap, value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -71,13 +71,13 @@ public bool Filled get { BOOL isFilled; - PInvoke.GdipGetAdjustableArrowCapFillState(NativeArrowCap, &isFilled).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetAdjustableArrowCapFillState(NativeArrowCap, &isFilled).ThrowIfFailed(); GC.KeepAlive(this); return isFilled; } set { - PInvoke.GdipSetAdjustableArrowCapFillState(NativeArrowCap, value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetAdjustableArrowCapFillState(NativeArrowCap, value).ThrowIfFailed(); GC.KeepAlive(this); } } diff --git a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/CustomLineCap.cs b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/CustomLineCap.cs index b38ca70e7bb..e517d7f84e2 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/CustomLineCap.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/CustomLineCap.cs @@ -19,7 +19,7 @@ public CustomLineCap(GraphicsPath? fillPath, GraphicsPath? strokePath, LineCap b public CustomLineCap(GraphicsPath? fillPath, GraphicsPath? strokePath, LineCap baseCap, float baseInset) { GpCustomLineCap* lineCap; - PInvoke.GdipCreateCustomLineCap( + PInvokeGdiPlus.GdipCreateCustomLineCap( fillPath.Pointer(), strokePath.Pointer(), (GdiPlus.LineCap)baseCap, @@ -34,10 +34,10 @@ public CustomLineCap(GraphicsPath? fillPath, GraphicsPath? strokePath, LineCap b internal static CustomLineCap CreateCustomLineCapObject(GpCustomLineCap* cap) { GdiPlus.CustomLineCapType capType; - Status status = PInvoke.GdipGetCustomLineCapType(cap, &capType); + Status status = PInvokeGdiPlus.GdipGetCustomLineCapType(cap, &capType); if (status != Status.Ok) { - PInvoke.GdipDeleteCustomLineCap(cap); + PInvokeGdiPlus.GdipDeleteCustomLineCap(cap); throw status.GetException(); } @@ -49,7 +49,7 @@ internal static CustomLineCap CreateCustomLineCapObject(GpCustomLineCap* cap) return new AdjustableArrowCap(cap); } - PInvoke.GdipDeleteCustomLineCap(cap); + PInvokeGdiPlus.GdipDeleteCustomLineCap(cap); throw Status.NotImplemented.GetException(); } @@ -76,7 +76,7 @@ protected virtual void Dispose(bool disposing) if (_nativeCap is not null && Gdip.Initialized) { - Status status = PInvoke.GdipDeleteCustomLineCap(_nativeCap); + Status status = PInvokeGdiPlus.GdipDeleteCustomLineCap(_nativeCap); _nativeCap = null; Debug.Assert(status == Status.Ok, $"GDI+ returned an error status: {status}"); } @@ -91,14 +91,14 @@ protected virtual void Dispose(bool disposing) internal virtual object CoreClone() { GpCustomLineCap* clonedCap; - PInvoke.GdipCloneCustomLineCap(_nativeCap, &clonedCap).ThrowIfFailed(); + PInvokeGdiPlus.GdipCloneCustomLineCap(_nativeCap, &clonedCap).ThrowIfFailed(); GC.KeepAlive(this); return CreateCustomLineCapObject(clonedCap); } public void SetStrokeCaps(LineCap startCap, LineCap endCap) { - PInvoke.GdipSetCustomLineCapStrokeCaps(_nativeCap, (GdiPlus.LineCap)startCap, (GdiPlus.LineCap)endCap).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetCustomLineCapStrokeCaps(_nativeCap, (GdiPlus.LineCap)startCap, (GdiPlus.LineCap)endCap).ThrowIfFailed(); GC.KeepAlive(this); } @@ -107,7 +107,7 @@ public void GetStrokeCaps(out LineCap startCap, out LineCap endCap) fixed (LineCap* sc = &startCap) fixed (LineCap* ec = &endCap) { - PInvoke.GdipGetCustomLineCapStrokeCaps(_nativeCap, (GdiPlus.LineCap*)sc, (GdiPlus.LineCap*)ec).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetCustomLineCapStrokeCaps(_nativeCap, (GdiPlus.LineCap*)sc, (GdiPlus.LineCap*)ec).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -117,13 +117,13 @@ public LineJoin StrokeJoin get { LineJoin lineJoin; - PInvoke.GdipGetCustomLineCapStrokeJoin(_nativeCap, (GdiPlus.LineJoin*)&lineJoin).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetCustomLineCapStrokeJoin(_nativeCap, (GdiPlus.LineJoin*)&lineJoin).ThrowIfFailed(); GC.KeepAlive(this); return lineJoin; } set { - PInvoke.GdipSetCustomLineCapStrokeJoin(_nativeCap, (GdiPlus.LineJoin)value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetCustomLineCapStrokeJoin(_nativeCap, (GdiPlus.LineJoin)value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -133,13 +133,13 @@ public LineCap BaseCap get { LineCap baseCap; - PInvoke.GdipGetCustomLineCapBaseCap(_nativeCap, (GdiPlus.LineCap*)&baseCap).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetCustomLineCapBaseCap(_nativeCap, (GdiPlus.LineCap*)&baseCap).ThrowIfFailed(); GC.KeepAlive(this); return baseCap; } set { - PInvoke.GdipSetCustomLineCapBaseCap(_nativeCap, (GdiPlus.LineCap)value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetCustomLineCapBaseCap(_nativeCap, (GdiPlus.LineCap)value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -149,13 +149,13 @@ public float BaseInset get { float inset; - PInvoke.GdipGetCustomLineCapBaseInset(_nativeCap, &inset).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetCustomLineCapBaseInset(_nativeCap, &inset).ThrowIfFailed(); GC.KeepAlive(this); return inset; } set { - PInvoke.GdipSetCustomLineCapBaseInset(_nativeCap, value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetCustomLineCapBaseInset(_nativeCap, value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -165,13 +165,13 @@ public float WidthScale get { float widthScale; - PInvoke.GdipGetCustomLineCapWidthScale(_nativeCap, &widthScale).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetCustomLineCapWidthScale(_nativeCap, &widthScale).ThrowIfFailed(); GC.KeepAlive(this); return widthScale; } set { - PInvoke.GdipSetCustomLineCapWidthScale(_nativeCap, value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetCustomLineCapWidthScale(_nativeCap, value).ThrowIfFailed(); GC.KeepAlive(this); } } diff --git a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsPath.cs b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsPath.cs index da9dcdae0bd..17c0e5f007c 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsPath.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsPath.cs @@ -19,7 +19,7 @@ public GraphicsPath() : this(FillMode.Alternate) { } public GraphicsPath(FillMode fillMode) { GpPath* path; - PInvoke.GdipCreatePath((GdiPlus.FillMode)fillMode, &path).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreatePath((GdiPlus.FillMode)fillMode, &path).ThrowIfFailed(); _nativePath = path; } @@ -49,7 +49,7 @@ public GraphicsPath(PointF[] pts, byte[] types, FillMode fillMode) fixed (byte* t = types) { GpPath* path; - PInvoke.GdipCreatePath2((GdiPlus.PointF*)p, t, types.Length, (GdiPlus.FillMode)fillMode, &path).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreatePath2((GdiPlus.PointF*)p, t, types.Length, (GdiPlus.FillMode)fillMode, &path).ThrowIfFailed(); _nativePath = path; } } @@ -85,7 +85,7 @@ public GraphicsPath(Point[] pts, byte[] types, FillMode fillMode) fixed (Point* p = pts) { GpPath* path; - PInvoke.GdipCreatePath2I((GdiPlus.Point*)p, t, types.Length, (GdiPlus.FillMode)fillMode, &path).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreatePath2I((GdiPlus.Point*)p, t, types.Length, (GdiPlus.FillMode)fillMode, &path).ThrowIfFailed(); _nativePath = path; } } @@ -93,7 +93,7 @@ public GraphicsPath(Point[] pts, byte[] types, FillMode fillMode) public object Clone() { GpPath* path; - PInvoke.GdipClonePath(_nativePath, &path).ThrowIfFailed(); + PInvokeGdiPlus.GdipClonePath(_nativePath, &path).ThrowIfFailed(); GC.KeepAlive(this); return new GraphicsPath(path); } @@ -121,7 +121,7 @@ private void Dispose(bool disposing) #if DEBUG Status status = !Gdip.Initialized ? Status.Ok : #endif - PInvoke.GdipDeletePath(_nativePath); + PInvokeGdiPlus.GdipDeletePath(_nativePath); #if DEBUG Debug.Assert(status == Status.Ok, $"GDI+ returned an error status: {status}"); #endif @@ -141,7 +141,7 @@ private void Dispose(bool disposing) public void Reset() { - PInvoke.GdipResetPath(_nativePath).ThrowIfFailed(); + PInvokeGdiPlus.GdipResetPath(_nativePath).ThrowIfFailed(); GC.KeepAlive(this); } @@ -150,7 +150,7 @@ public FillMode FillMode get { GdiPlus.FillMode fillMode; - PInvoke.GdipGetPathFillMode(_nativePath, &fillMode).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPathFillMode(_nativePath, &fillMode).ThrowIfFailed(); GC.KeepAlive(this); return (FillMode)fillMode; } @@ -159,7 +159,7 @@ public FillMode FillMode if (value is < FillMode.Alternate or > FillMode.Winding) throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(FillMode)); - PInvoke.GdipSetPathFillMode(_nativePath, (GdiPlus.FillMode)value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPathFillMode(_nativePath, (GdiPlus.FillMode)value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -189,7 +189,7 @@ public PathData PathData Types = t }; - PInvoke.GdipGetPathData(_nativePath, (GdiPlus.PathData*)&data).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPathData(_nativePath, (GdiPlus.PathData*)&data).ThrowIfFailed(); GC.KeepAlive(this); } @@ -199,44 +199,44 @@ public PathData PathData public void StartFigure() { - PInvoke.GdipStartPathFigure(_nativePath); + PInvokeGdiPlus.GdipStartPathFigure(_nativePath); GC.KeepAlive(this); } public void CloseFigure() { - PInvoke.GdipClosePathFigure(_nativePath).ThrowIfFailed(); + PInvokeGdiPlus.GdipClosePathFigure(_nativePath).ThrowIfFailed(); GC.KeepAlive(this); } public void CloseAllFigures() { - PInvoke.GdipClosePathFigures(_nativePath).ThrowIfFailed(); + PInvokeGdiPlus.GdipClosePathFigures(_nativePath).ThrowIfFailed(); GC.KeepAlive(this); } public void SetMarkers() { - PInvoke.GdipSetPathMarker(_nativePath).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPathMarker(_nativePath).ThrowIfFailed(); GC.KeepAlive(this); } public void ClearMarkers() { - PInvoke.GdipClearPathMarkers(_nativePath).ThrowIfFailed(); + PInvokeGdiPlus.GdipClearPathMarkers(_nativePath).ThrowIfFailed(); GC.KeepAlive(this); } public void Reverse() { - PInvoke.GdipReversePath(_nativePath).ThrowIfFailed(); + PInvokeGdiPlus.GdipReversePath(_nativePath).ThrowIfFailed(); GC.KeepAlive(this); } public PointF GetLastPoint() { PointF point; - PInvoke.GdipGetPathLastPoint(_nativePath, (GdiPlus.PointF*)&point); + PInvokeGdiPlus.GdipGetPathLastPoint(_nativePath, (GdiPlus.PointF*)&point); GC.KeepAlive(this); return point; } @@ -248,7 +248,7 @@ public PointF GetLastPoint() public bool IsVisible(float x, float y, Graphics? graphics) { BOOL isVisible; - PInvoke.GdipIsVisiblePathPoint( + PInvokeGdiPlus.GdipIsVisiblePathPoint( _nativePath, x, y, graphics is null ? null : graphics.NativeGraphics, @@ -277,7 +277,7 @@ public bool IsOutlineVisible(float x, float y, Pen pen, Graphics? graphics) { ArgumentNullException.ThrowIfNull(pen); BOOL isVisible; - PInvoke.GdipIsOutlineVisiblePathPoint( + PInvokeGdiPlus.GdipIsOutlineVisiblePathPoint( _nativePath, x, y, pen.NativePen, @@ -304,7 +304,7 @@ public bool IsOutlineVisible(float x, float y, Pen pen, Graphics? graphics) public void AddLine(float x1, float y1, float x2, float y2) { - PInvoke.GdipAddPathLine(_nativePath, x1, y1, x2, y2).ThrowIfFailed(); + PInvokeGdiPlus.GdipAddPathLine(_nativePath, x1, y1, x2, y2).ThrowIfFailed(); GC.KeepAlive(this); } @@ -338,7 +338,7 @@ void AddLines(params ReadOnlySpan points) fixed (PointF* p = points) { - PInvoke.GdipAddPathLine2(_nativePath, (GdiPlus.PointF*)p, points.Length).ThrowIfFailed(); + PInvokeGdiPlus.GdipAddPathLine2(_nativePath, (GdiPlus.PointF*)p, points.Length).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -365,7 +365,7 @@ void AddLines(params ReadOnlySpan points) fixed (Point* p = points) { - PInvoke.GdipAddPathLine2I(_nativePath, (GdiPlus.Point*)p, points.Length).ThrowIfFailed(); + PInvokeGdiPlus.GdipAddPathLine2I(_nativePath, (GdiPlus.Point*)p, points.Length).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -375,7 +375,7 @@ public void AddArc(RectangleF rect, float startAngle, float sweepAngle) => public void AddArc(float x, float y, float width, float height, float startAngle, float sweepAngle) { - PInvoke.GdipAddPathArc(_nativePath, x, y, width, height, startAngle, sweepAngle).ThrowIfFailed(); + PInvokeGdiPlus.GdipAddPathArc(_nativePath, x, y, width, height, startAngle, sweepAngle).ThrowIfFailed(); GC.KeepAlive(this); } @@ -390,7 +390,7 @@ public void AddBezier(PointF pt1, PointF pt2, PointF pt3, PointF pt4) => public void AddBezier(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) { - PInvoke.GdipAddPathBezier(_nativePath, x1, y1, x2, y2, x3, y3, x4, y4).ThrowIfFailed(); + PInvokeGdiPlus.GdipAddPathBezier(_nativePath, x1, y1, x2, y2, x3, y3, x4, y4).ThrowIfFailed(); GC.KeepAlive(this); } @@ -410,7 +410,7 @@ void AddBeziers(params ReadOnlySpan points) { fixed (PointF* p = points) { - PInvoke.GdipAddPathBeziers(_nativePath, (GdiPlus.PointF*)p, points.Length).ThrowIfFailed(); + PInvokeGdiPlus.GdipAddPathBeziers(_nativePath, (GdiPlus.PointF*)p, points.Length).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -437,7 +437,7 @@ void AddBeziers(params ReadOnlySpan points) fixed (Point* p = points) { - PInvoke.GdipAddPathBeziersI(_nativePath, (GdiPlus.Point*)p, points.Length).ThrowIfFailed(); + PInvokeGdiPlus.GdipAddPathBeziersI(_nativePath, (GdiPlus.Point*)p, points.Length).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -466,7 +466,7 @@ public void AddCurve(PointF[] points, int offset, int numberOfSegments, float te { fixed (PointF* p = points) { - PInvoke.GdipAddPathCurve3( + PInvokeGdiPlus.GdipAddPathCurve3( _nativePath, (GdiPlus.PointF*)p, points.Length, @@ -493,7 +493,7 @@ void AddCurve(ReadOnlySpan points, float tension) { fixed (PointF* p = points) { - PInvoke.GdipAddPathCurve2( + PInvokeGdiPlus.GdipAddPathCurve2( _nativePath, (GdiPlus.PointF*)p, points.Length, @@ -514,7 +514,7 @@ public void AddCurve(Point[] points, int offset, int numberOfSegments, float ten { fixed (Point* p = points) { - PInvoke.GdipAddPathCurve3I( + PInvokeGdiPlus.GdipAddPathCurve3I( _nativePath, (GdiPlus.Point*)p, points.Length, @@ -541,7 +541,7 @@ void AddCurve(ReadOnlySpan points, float tension) { fixed (Point* p = points) { - PInvoke.GdipAddPathCurve2I( + PInvokeGdiPlus.GdipAddPathCurve2I( _nativePath, (GdiPlus.Point*)p, points.Length, @@ -572,7 +572,7 @@ void AddClosedCurve(ReadOnlySpan points, float tension) { fixed (PointF* p = points) { - PInvoke.GdipAddPathClosedCurve2(_nativePath, (GdiPlus.PointF*)p, points.Length, tension).ThrowIfFailed(); + PInvokeGdiPlus.GdipAddPathClosedCurve2(_nativePath, (GdiPlus.PointF*)p, points.Length, tension).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -602,14 +602,14 @@ void AddClosedCurve(ReadOnlySpan points, float tension) { fixed (Point* p = points) { - PInvoke.GdipAddPathClosedCurve2I(_nativePath, (GdiPlus.Point*)p, points.Length, tension).ThrowIfFailed(); + PInvokeGdiPlus.GdipAddPathClosedCurve2I(_nativePath, (GdiPlus.Point*)p, points.Length, tension).ThrowIfFailed(); GC.KeepAlive(this); } } public void AddRectangle(RectangleF rect) { - PInvoke.GdipAddPathRectangle( + PInvokeGdiPlus.GdipAddPathRectangle( _nativePath, rect.X, rect.Y, rect.Width, rect.Height).ThrowIfFailed(); GC.KeepAlive(this); @@ -631,7 +631,7 @@ void AddRectangles(params ReadOnlySpan rects) { fixed (RectangleF* r = rects) { - PInvoke.GdipAddPathRectangles(_nativePath, (RectF*)r, rects.Length).ThrowIfFailed(); + PInvokeGdiPlus.GdipAddPathRectangles(_nativePath, (RectF*)r, rects.Length).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -651,7 +651,7 @@ void AddRectangles(params ReadOnlySpan rects) { fixed (Rectangle* r = rects) { - PInvoke.GdipAddPathRectanglesI(_nativePath, (Rect*)r, rects.Length).ThrowIfFailed(); + PInvokeGdiPlus.GdipAddPathRectanglesI(_nativePath, (Rect*)r, rects.Length).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -702,7 +702,7 @@ public void AddEllipse(RectangleF rect) => public void AddEllipse(float x, float y, float width, float height) { - PInvoke.GdipAddPathEllipse(_nativePath, x, y, width, height).ThrowIfFailed(); + PInvokeGdiPlus.GdipAddPathEllipse(_nativePath, x, y, width, height).ThrowIfFailed(); GC.KeepAlive(this); } @@ -715,7 +715,7 @@ public void AddPie(Rectangle rect, float startAngle, float sweepAngle) => public void AddPie(float x, float y, float width, float height, float startAngle, float sweepAngle) { - PInvoke.GdipAddPathPie( + PInvokeGdiPlus.GdipAddPathPie( _nativePath, x, y, width, height, startAngle, @@ -740,7 +740,7 @@ void AddPolygon(params ReadOnlySpan points) { fixed (PointF* p = points) { - PInvoke.GdipAddPathPolygon(_nativePath, (GdiPlus.PointF*)p, points.Length).ThrowIfFailed(); + PInvokeGdiPlus.GdipAddPathPolygon(_nativePath, (GdiPlus.PointF*)p, points.Length).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -761,7 +761,7 @@ void AddPolygon(params ReadOnlySpan points) { fixed (Point* p = points) { - PInvoke.GdipAddPathPolygonI(_nativePath, (GdiPlus.Point*)p, points.Length).ThrowIfFailed(); + PInvokeGdiPlus.GdipAddPathPolygonI(_nativePath, (GdiPlus.Point*)p, points.Length).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -769,7 +769,7 @@ void AddPolygon(params ReadOnlySpan points) public void AddPath(GraphicsPath addingPath, bool connect) { ArgumentNullException.ThrowIfNull(addingPath); - PInvoke.GdipAddPathPath(_nativePath, addingPath.Pointer(), connect).ThrowIfFailed(); + PInvokeGdiPlus.GdipAddPathPath(_nativePath, addingPath.Pointer(), connect).ThrowIfFailed(); GC.KeepAlive(addingPath); GC.KeepAlive(this); } @@ -787,7 +787,7 @@ public void AddString(string s, FontFamily family, int style, float emSize, Rect fixed (char* c = s) { - PInvoke.GdipAddPathString( + PInvokeGdiPlus.GdipAddPathString( _nativePath, c, s.Length, family.Pointer(), @@ -808,7 +808,7 @@ public void AddString(string s, FontFamily family, int style, float emSize, Rect public void Transform(Matrix matrix) { ArgumentNullException.ThrowIfNull(matrix); - PInvoke.GdipTransformPath(_nativePath, matrix.NativeMatrix).ThrowIfFailed(); + PInvokeGdiPlus.GdipTransformPath(_nativePath, matrix.NativeMatrix).ThrowIfFailed(); GC.KeepAlive(matrix); GC.KeepAlive(this); } @@ -820,7 +820,7 @@ public void Transform(Matrix matrix) public RectangleF GetBounds(Matrix? matrix, Pen? pen) { RectF bounds; - PInvoke.GdipGetPathWorldBounds( + PInvokeGdiPlus.GdipGetPathWorldBounds( _nativePath, &bounds, matrix.Pointer(), @@ -838,7 +838,7 @@ public RectangleF GetBounds(Matrix? matrix, Pen? pen) public void Flatten(Matrix? matrix, float flatness) { - PInvoke.GdipFlattenPath(_nativePath, matrix.Pointer(), flatness).ThrowIfFailed(); + PInvokeGdiPlus.GdipFlattenPath(_nativePath, matrix.Pointer(), flatness).ThrowIfFailed(); GC.KeepAlive(this); } @@ -855,7 +855,7 @@ public void Widen(Pen pen, Matrix? matrix, float flatness) if (PointCount == 0) return; - PInvoke.GdipWidenPath(_nativePath, pen.Pointer(), matrix.Pointer(), flatness).ThrowIfFailed(); + PInvokeGdiPlus.GdipWidenPath(_nativePath, pen.Pointer(), matrix.Pointer(), flatness).ThrowIfFailed(); GC.KeepAlive(pen); GC.KeepAlive(matrix); GC.KeepAlive(this); @@ -908,7 +908,7 @@ void Warp( { fixed (PointF* p = destPoints) { - PInvoke.GdipWarpPath( + PInvokeGdiPlus.GdipWarpPath( _nativePath, matrix.Pointer(), (GdiPlus.PointF*)p, @@ -926,7 +926,7 @@ public int PointCount get { int count; - PInvoke.GdipGetPointCount(_nativePath, &count).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPointCount(_nativePath, &count).ThrowIfFailed(); GC.KeepAlive(this); return count; } @@ -971,7 +971,7 @@ int GetPathTypes(Span destination) fixed (byte* t = destination) { - PInvoke.GdipGetPathTypes(_nativePath, t, destination.Length).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPathTypes(_nativePath, t, destination.Length).ThrowIfFailed(); GC.KeepAlive(this); return PointCount; } @@ -1016,7 +1016,7 @@ int GetPathPoints(Span destination) fixed (PointF* p = destination) { - PInvoke.GdipGetPathPoints(_nativePath, (GdiPlus.PointF*)p, destination.Length).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPathPoints(_nativePath, (GdiPlus.PointF*)p, destination.Length).ThrowIfFailed(); GC.KeepAlive(this); return PointCount; } diff --git a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsPathIterator.cs b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsPathIterator.cs index 7db34df5861..9d4c1ba754c 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsPathIterator.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsPathIterator.cs @@ -11,7 +11,7 @@ public sealed unsafe class GraphicsPathIterator : MarshalByRefObject, IDisposabl public GraphicsPathIterator(GraphicsPath? path) { GpPathIterator* iterator; - PInvoke.GdipCreatePathIter(&iterator, path.Pointer()).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreatePathIter(&iterator, path.Pointer()).ThrowIfFailed(); GC.KeepAlive(path); _nativeIterator = iterator; } @@ -31,7 +31,7 @@ private void Dispose(bool disposing) #if DEBUG Status status = !Gdip.Initialized ? Status.Ok : #endif - PInvoke.GdipDeletePathIter(_nativeIterator); + PInvokeGdiPlus.GdipDeletePathIter(_nativeIterator); #if DEBUG Debug.Assert(status == Status.Ok, $"GDI+ returned an error status: {status}"); #endif @@ -61,7 +61,7 @@ public int NextSubpath(out int startIndex, out int endIndex, out bool isClosed) fixed (int* s = &startIndex, e = &endIndex) { - PInvoke.GdipPathIterNextSubpath(_nativeIterator, &resultCount, s, e, &tempIsClosed).ThrowIfFailed(); + PInvokeGdiPlus.GdipPathIterNextSubpath(_nativeIterator, &resultCount, s, e, &tempIsClosed).ThrowIfFailed(); isClosed = tempIsClosed; GC.KeepAlive(this); return resultCount; @@ -72,7 +72,7 @@ public int NextSubpath(GraphicsPath path, out bool isClosed) { int resultCount; BOOL tempIsClosed; - PInvoke.GdipPathIterNextSubpathPath(_nativeIterator, &resultCount, path.Pointer(), &tempIsClosed).ThrowIfFailed(); + PInvokeGdiPlus.GdipPathIterNextSubpathPath(_nativeIterator, &resultCount, path.Pointer(), &tempIsClosed).ThrowIfFailed(); isClosed = tempIsClosed; GC.KeepAlive(this); return resultCount; @@ -85,7 +85,7 @@ public int NextPathType(out byte pathType, out int startIndex, out int endIndex) fixed (byte* pt = &pathType) fixed (int* s = &startIndex, e = &endIndex) { - PInvoke.GdipPathIterNextPathType(_nativeIterator, &resultCount, pt, s, e).ThrowIfFailed(); + PInvokeGdiPlus.GdipPathIterNextPathType(_nativeIterator, &resultCount, pt, s, e).ThrowIfFailed(); GC.KeepAlive(this); return resultCount; } @@ -97,7 +97,7 @@ public int NextMarker(out int startIndex, out int endIndex) fixed (int* s = &startIndex, e = &endIndex) { - PInvoke.GdipPathIterNextMarker(_nativeIterator, &resultCount, s, e).ThrowIfFailed(); + PInvokeGdiPlus.GdipPathIterNextMarker(_nativeIterator, &resultCount, s, e).ThrowIfFailed(); GC.KeepAlive(this); return resultCount; } @@ -106,7 +106,7 @@ public int NextMarker(out int startIndex, out int endIndex) public int NextMarker(GraphicsPath path) { int resultCount; - PInvoke.GdipPathIterNextMarkerPath(_nativeIterator, &resultCount, path.Pointer()).ThrowIfFailed(); + PInvokeGdiPlus.GdipPathIterNextMarkerPath(_nativeIterator, &resultCount, path.Pointer()).ThrowIfFailed(); GC.KeepAlive(this); return resultCount; } @@ -116,7 +116,7 @@ public int Count get { int resultCount; - PInvoke.GdipPathIterGetCount(_nativeIterator, &resultCount).ThrowIfFailed(); + PInvokeGdiPlus.GdipPathIterGetCount(_nativeIterator, &resultCount).ThrowIfFailed(); GC.KeepAlive(this); return resultCount; } @@ -127,7 +127,7 @@ public int SubpathCount get { int resultCount; - PInvoke.GdipPathIterGetSubpathCount(_nativeIterator, &resultCount).ThrowIfFailed(); + PInvokeGdiPlus.GdipPathIterGetSubpathCount(_nativeIterator, &resultCount).ThrowIfFailed(); GC.KeepAlive(this); return resultCount; } @@ -136,14 +136,14 @@ public int SubpathCount public bool HasCurve() { BOOL hasCurve; - PInvoke.GdipPathIterHasCurve(_nativeIterator, &hasCurve).ThrowIfFailed(); + PInvokeGdiPlus.GdipPathIterHasCurve(_nativeIterator, &hasCurve).ThrowIfFailed(); GC.KeepAlive(this); return hasCurve; } public void Rewind() { - PInvoke.GdipPathIterRewind(_nativeIterator).ThrowIfFailed(); + PInvokeGdiPlus.GdipPathIterRewind(_nativeIterator).ThrowIfFailed(); GC.KeepAlive(this); } @@ -174,7 +174,7 @@ unsafe int Enumerate(Span points, Span types) fixed (byte* t = types) { int resultCount; - PInvoke.GdipPathIterEnumerate( + PInvokeGdiPlus.GdipPathIterEnumerate( _nativeIterator, &resultCount, (GdiPlus.PointF*)p, @@ -222,7 +222,7 @@ unsafe int CopyData(Span points, Span types, int startIndex, int e fixed (byte* t = types) { int resultCount; - PInvoke.GdipPathIterCopyData( + PInvokeGdiPlus.GdipPathIterCopyData( _nativeIterator, &resultCount, (GdiPlus.PointF*)p, diff --git a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/HatchBrush.cs b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/HatchBrush.cs index f568d889855..9462a07f880 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/HatchBrush.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/HatchBrush.cs @@ -18,7 +18,7 @@ public HatchBrush(HatchStyle hatchstyle, Color foreColor, Color backColor) } GpHatch* nativeBrush; - PInvoke.GdipCreateHatchBrush((GdiPlus.HatchStyle)hatchstyle, (ARGB)foreColor, (ARGB)backColor, &nativeBrush).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreateHatchBrush((GdiPlus.HatchStyle)hatchstyle, (ARGB)foreColor, (ARGB)backColor, &nativeBrush).ThrowIfFailed(); SetNativeBrushInternal((GpBrush*)nativeBrush); } @@ -31,7 +31,7 @@ internal HatchBrush(GpHatch* nativeBrush) public override object Clone() { GpBrush* clonedBrush; - PInvoke.GdipCloneBrush(NativeBrush, &clonedBrush).ThrowIfFailed(); + PInvokeGdiPlus.GdipCloneBrush(NativeBrush, &clonedBrush).ThrowIfFailed(); GC.KeepAlive(this); return new HatchBrush((GpHatch*)clonedBrush); } @@ -41,7 +41,7 @@ public HatchStyle HatchStyle get { GdiPlus.HatchStyle hatchStyle; - PInvoke.GdipGetHatchStyle((GpHatch*)NativeBrush, &hatchStyle).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetHatchStyle((GpHatch*)NativeBrush, &hatchStyle).ThrowIfFailed(); GC.KeepAlive(this); return (HatchStyle)hatchStyle; } @@ -52,7 +52,7 @@ public Color ForegroundColor get { ARGB foregroundArgb; - PInvoke.GdipGetHatchForegroundColor((GpHatch*)NativeBrush, (uint*)&foregroundArgb).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetHatchForegroundColor((GpHatch*)NativeBrush, (uint*)&foregroundArgb).ThrowIfFailed(); GC.KeepAlive(this); return foregroundArgb; } @@ -63,7 +63,7 @@ public Color BackgroundColor get { ARGB backgroundArgb; - PInvoke.GdipGetHatchBackgroundColor((GpHatch*)NativeBrush, (uint*)&backgroundArgb).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetHatchBackgroundColor((GpHatch*)NativeBrush, (uint*)&backgroundArgb).ThrowIfFailed(); GC.KeepAlive(this); return backgroundArgb; } diff --git a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/LinearGradientBrush.cs b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/LinearGradientBrush.cs index ab3318082fb..59f90e50013 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/LinearGradientBrush.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/LinearGradientBrush.cs @@ -12,7 +12,7 @@ public sealed unsafe class LinearGradientBrush : Brush public LinearGradientBrush(PointF point1, PointF point2, Color color1, Color color2) { GpLineGradient* nativeBrush; - PInvoke.GdipCreateLineBrush( + PInvokeGdiPlus.GdipCreateLineBrush( (GdiPlus.PointF*)&point1, (GdiPlus.PointF*)&point2, (uint)color1.ToArgb(), (uint)color2.ToArgb(), GdiPlus.WrapMode.WrapModeTile, @@ -35,7 +35,7 @@ public LinearGradientBrush(RectangleF rect, Color color1, Color color2, LinearGr throw new ArgumentException(SR.Format(SR.GdiplusInvalidRectangle, rect.ToString())); GpLineGradient* nativeBrush; - PInvoke.GdipCreateLineBrushFromRect( + PInvokeGdiPlus.GdipCreateLineBrushFromRect( (RectF*)&rect, (ARGB)color1, (ARGB)color2, @@ -62,7 +62,7 @@ public LinearGradientBrush(RectangleF rect, Color color1, Color color2, float an throw new ArgumentException(SR.Format(SR.GdiplusInvalidRectangle, rect.ToString())); GpLineGradient* nativeBrush; - PInvoke.GdipCreateLineBrushFromRectWithAngle( + PInvokeGdiPlus.GdipCreateLineBrushFromRectWithAngle( (RectF*)&rect, (ARGB)color1, (ARGB)color2, @@ -95,7 +95,7 @@ internal LinearGradientBrush(GpLineGradient* nativeBrush) public override object Clone() { GpBrush* clonedBrush; - PInvoke.GdipCloneBrush(NativeBrush, &clonedBrush).ThrowIfFailed(); + PInvokeGdiPlus.GdipCloneBrush(NativeBrush, &clonedBrush).ThrowIfFailed(); GC.KeepAlive(this); return new LinearGradientBrush((GpLineGradient*)clonedBrush); } @@ -105,7 +105,7 @@ public Color[] LinearColors get { uint* colors = stackalloc uint[2]; - PInvoke.GdipGetLineColors(NativeLineGradient, colors).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetLineColors(NativeLineGradient, colors).ThrowIfFailed(); GC.KeepAlive(this); return @@ -116,7 +116,7 @@ public Color[] LinearColors } set { - PInvoke.GdipSetLineColors(NativeLineGradient, (uint)value[0].ToArgb(), (uint)value[1].ToArgb()).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetLineColors(NativeLineGradient, (uint)value[0].ToArgb(), (uint)value[1].ToArgb()).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -126,7 +126,7 @@ public RectangleF Rectangle get { RectangleF rect; - PInvoke.GdipGetLineRect(NativeLineGradient, (RectF*)&rect).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetLineRect(NativeLineGradient, (RectF*)&rect).ThrowIfFailed(); GC.KeepAlive(this); return rect; } @@ -137,13 +137,13 @@ public bool GammaCorrection get { BOOL useGammaCorrection; - PInvoke.GdipGetLineGammaCorrection(NativeLineGradient, &useGammaCorrection).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetLineGammaCorrection(NativeLineGradient, &useGammaCorrection).ThrowIfFailed(); GC.KeepAlive(this); return useGammaCorrection; } set { - PInvoke.GdipSetLineGammaCorrection(NativeLineGradient, value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetLineGammaCorrection(NativeLineGradient, value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -159,7 +159,7 @@ public Blend? Blend return null; int count; - PInvoke.GdipGetLineBlendCount(NativeLineGradient, &count).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetLineBlendCount(NativeLineGradient, &count).ThrowIfFailed(); GC.KeepAlive(this); if (count <= 0) @@ -171,7 +171,7 @@ public Blend? Blend fixed (float* f = blend.Factors, p = blend.Positions) { - PInvoke.GdipGetLineBlend(NativeLineGradient, f, p, count).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetLineBlend(NativeLineGradient, f, p, count).ThrowIfFailed(); GC.KeepAlive(this); return blend; } @@ -187,7 +187,7 @@ public Blend? Blend fixed (float* f = value.Factors, p = value.Positions) { // Set blend factors. - PInvoke.GdipSetLineBlend(NativeLineGradient, f, p, value.Factors.Length).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetLineBlend(NativeLineGradient, f, p, value.Factors.Length).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -197,7 +197,7 @@ public Blend? Blend public void SetSigmaBellShape(float focus, float scale) { - PInvoke.GdipSetLineSigmaBlend(NativeLineGradient, focus, scale).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetLineSigmaBlend(NativeLineGradient, focus, scale).ThrowIfFailed(); GC.KeepAlive(this); } @@ -206,7 +206,7 @@ public void SetSigmaBellShape(float focus, float scale) public void SetBlendTriangularShape(float focus, float scale) { _interpolationColorsWasSet = false; - PInvoke.GdipSetLineLinearBlend(NativeLineGradient, focus, scale).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetLineLinearBlend(NativeLineGradient, focus, scale).ThrowIfFailed(); GC.KeepAlive(this); } @@ -215,7 +215,7 @@ public ColorBlend InterpolationColors get { int count; - PInvoke.GdipGetLinePresetBlendCount(NativeLineGradient, &count).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetLinePresetBlendCount(NativeLineGradient, &count).ThrowIfFailed(); if (count == 0) { @@ -231,7 +231,7 @@ public ColorBlend InterpolationColors fixed (float* p = positions) { // Retrieve horizontal blend factors - PInvoke.GdipGetLinePresetBlend(NativeLineGradient, c, p, count).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetLinePresetBlend(NativeLineGradient, c, p, count).ThrowIfFailed(); } blend.Positions = positions; @@ -257,7 +257,7 @@ public ColorBlend InterpolationColors fixed (uint* a = argbValues) { // Set blend factors - PInvoke.GdipSetLinePresetBlend(NativeLineGradient, a, p, count).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetLinePresetBlend(NativeLineGradient, a, p, count).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -268,7 +268,7 @@ public WrapMode WrapMode get { WrapMode mode; - PInvoke.GdipGetLineWrapMode(NativeLineGradient, (GdiPlus.WrapMode*)&mode).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetLineWrapMode(NativeLineGradient, (GdiPlus.WrapMode*)&mode).ThrowIfFailed(); GC.KeepAlive(this); return mode; } @@ -277,7 +277,7 @@ public WrapMode WrapMode if (value is < WrapMode.Tile or > WrapMode.Clamp) throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(WrapMode)); - PInvoke.GdipSetLineWrapMode(NativeLineGradient, (GdiPlus.WrapMode)value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetLineWrapMode(NativeLineGradient, (GdiPlus.WrapMode)value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -287,14 +287,14 @@ public Matrix Transform get { Matrix matrix = new(); - PInvoke.GdipGetLineTransform(NativeLineGradient, matrix.NativeMatrix).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetLineTransform(NativeLineGradient, matrix.NativeMatrix).ThrowIfFailed(); GC.KeepAlive(this); return matrix; } set { ArgumentNullException.ThrowIfNull(value); - PInvoke.GdipSetLineTransform(NativeLineGradient, value.NativeMatrix).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetLineTransform(NativeLineGradient, value.NativeMatrix).ThrowIfFailed(); GC.KeepAlive(value); GC.KeepAlive(this); } @@ -302,7 +302,7 @@ public Matrix Transform public void ResetTransform() { - PInvoke.GdipResetLineTransform(NativeLineGradient).ThrowIfFailed(); + PInvokeGdiPlus.GdipResetLineTransform(NativeLineGradient).ThrowIfFailed(); GC.KeepAlive(this); } @@ -312,7 +312,7 @@ public void MultiplyTransform(Matrix matrix, MatrixOrder order) { ArgumentNullException.ThrowIfNull(matrix); - PInvoke.GdipMultiplyLineTransform(NativeLineGradient, matrix.NativeMatrix, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); + PInvokeGdiPlus.GdipMultiplyLineTransform(NativeLineGradient, matrix.NativeMatrix, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); GC.KeepAlive(this); } @@ -320,7 +320,7 @@ public void MultiplyTransform(Matrix matrix, MatrixOrder order) public void TranslateTransform(float dx, float dy, MatrixOrder order) { - PInvoke.GdipTranslateLineTransform(NativeLineGradient, dx, dy, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); + PInvokeGdiPlus.GdipTranslateLineTransform(NativeLineGradient, dx, dy, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); GC.KeepAlive(this); } @@ -328,7 +328,7 @@ public void TranslateTransform(float dx, float dy, MatrixOrder order) public void ScaleTransform(float sx, float sy, MatrixOrder order) { - PInvoke.GdipScaleLineTransform(NativeLineGradient, sx, sy, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); + PInvokeGdiPlus.GdipScaleLineTransform(NativeLineGradient, sx, sy, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); GC.KeepAlive(this); } @@ -336,7 +336,7 @@ public void ScaleTransform(float sx, float sy, MatrixOrder order) public void RotateTransform(float angle, MatrixOrder order) { - PInvoke.GdipRotateLineTransform(NativeLineGradient, angle, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); + PInvokeGdiPlus.GdipRotateLineTransform(NativeLineGradient, angle, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); GC.KeepAlive(this); } } diff --git a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/Matrix.cs b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/Matrix.cs index b44896fb355..c60009756bd 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/Matrix.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/Matrix.cs @@ -12,14 +12,14 @@ public sealed unsafe class Matrix : MarshalByRefObject, IDisposable public Matrix() { GdiPlus.Matrix* matrix; - PInvoke.GdipCreateMatrix(&matrix).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreateMatrix(&matrix).ThrowIfFailed(); NativeMatrix = matrix; } public Matrix(float m11, float m12, float m21, float m22, float dx, float dy) { GdiPlus.Matrix* matrix; - PInvoke.GdipCreateMatrix2(m11, m12, m21, m22, dx, dy, &matrix).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreateMatrix2(m11, m12, m21, m22, dx, dy, &matrix).ThrowIfFailed(); NativeMatrix = matrix; } @@ -36,7 +36,7 @@ public Matrix(Matrix3x2 matrix) : this(CreateNativeHandle(matrix)) internal static GdiPlus.Matrix* CreateNativeHandle(Matrix3x2 matrix) { GdiPlus.Matrix* nativeMatrix; - PInvoke.GdipCreateMatrix2( + PInvokeGdiPlus.GdipCreateMatrix2( matrix.M11, matrix.M12, matrix.M21, @@ -57,7 +57,7 @@ public Matrix(RectangleF rect, params PointF[] plgpts) fixed (PointF* p = plgpts) { GdiPlus.Matrix* matrix; - PInvoke.GdipCreateMatrix3((RectF*)&rect, (GdiPlus.PointF*)p, &matrix).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreateMatrix3((RectF*)&rect, (GdiPlus.PointF*)p, &matrix).ThrowIfFailed(); NativeMatrix = matrix; } } @@ -71,7 +71,7 @@ public Matrix(Rectangle rect, params Point[] plgpts) fixed (Point* p = plgpts) { GdiPlus.Matrix* matrix; - PInvoke.GdipCreateMatrix3I((Rect*)&rect, (GdiPlus.Point*)p, &matrix).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreateMatrix3I((Rect*)&rect, (GdiPlus.Point*)p, &matrix).ThrowIfFailed(); NativeMatrix = matrix; } } @@ -88,7 +88,7 @@ private void DisposeInternal() { if (Gdip.Initialized) { - PInvoke.GdipDeleteMatrix(NativeMatrix); + PInvokeGdiPlus.GdipDeleteMatrix(NativeMatrix); } NativeMatrix = null; @@ -100,7 +100,7 @@ private void DisposeInternal() public Matrix Clone() { GdiPlus.Matrix* matrix; - PInvoke.GdipCloneMatrix(NativeMatrix, &matrix).ThrowIfFailed(); + PInvokeGdiPlus.GdipCloneMatrix(NativeMatrix, &matrix).ThrowIfFailed(); GC.KeepAlive(this); return new Matrix(matrix); } @@ -123,13 +123,13 @@ public Matrix3x2 MatrixElements get { Matrix3x2 matrix = default; - PInvoke.GdipGetMatrixElements(NativeMatrix, (float*)&matrix).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetMatrixElements(NativeMatrix, (float*)&matrix).ThrowIfFailed(); GC.KeepAlive(this); return matrix; } set { - PInvoke.GdipSetMatrixElements( + PInvokeGdiPlus.GdipSetMatrixElements( NativeMatrix, value.M11, value.M12, @@ -148,7 +148,7 @@ internal void GetElements(Span elements) fixed (float* m = elements) { - PInvoke.GdipGetMatrixElements(NativeMatrix, m).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetMatrixElements(NativeMatrix, m).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -169,7 +169,7 @@ internal PointF Offset public void Reset() { - PInvoke.GdipSetMatrixElements( + PInvokeGdiPlus.GdipSetMatrixElements( NativeMatrix, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f).ThrowIfFailed(); @@ -186,7 +186,7 @@ public void Multiply(Matrix matrix, MatrixOrder order) if (matrix.NativeMatrix == NativeMatrix) throw new InvalidOperationException(SR.GdiplusObjectBusy); - PInvoke.GdipMultiplyMatrix(NativeMatrix, matrix.NativeMatrix, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); + PInvokeGdiPlus.GdipMultiplyMatrix(NativeMatrix, matrix.NativeMatrix, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); GC.KeepAlive(this); GC.KeepAlive(matrix); } @@ -195,7 +195,7 @@ public void Multiply(Matrix matrix, MatrixOrder order) public void Translate(float offsetX, float offsetY, MatrixOrder order) { - PInvoke.GdipTranslateMatrix(NativeMatrix, offsetX, offsetY, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); + PInvokeGdiPlus.GdipTranslateMatrix(NativeMatrix, offsetX, offsetY, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); GC.KeepAlive(this); } @@ -203,7 +203,7 @@ public void Translate(float offsetX, float offsetY, MatrixOrder order) public void Scale(float scaleX, float scaleY, MatrixOrder order) { - PInvoke.GdipScaleMatrix(NativeMatrix, scaleX, scaleY, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); + PInvokeGdiPlus.GdipScaleMatrix(NativeMatrix, scaleX, scaleY, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); GC.KeepAlive(this); } @@ -211,7 +211,7 @@ public void Scale(float scaleX, float scaleY, MatrixOrder order) public void Rotate(float angle, MatrixOrder order) { - PInvoke.GdipRotateMatrix(NativeMatrix, angle, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); + PInvokeGdiPlus.GdipRotateMatrix(NativeMatrix, angle, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); GC.KeepAlive(this); } @@ -221,15 +221,15 @@ public void RotateAt(float angle, PointF point, MatrixOrder order) Status status; if (order == MatrixOrder.Prepend) { - status = PInvoke.GdipTranslateMatrix(NativeMatrix, point.X, point.Y, (GdiPlus.MatrixOrder)order); - status |= PInvoke.GdipRotateMatrix(NativeMatrix, angle, (GdiPlus.MatrixOrder)order); - status |= PInvoke.GdipTranslateMatrix(NativeMatrix, -point.X, -point.Y, (GdiPlus.MatrixOrder)order); + status = PInvokeGdiPlus.GdipTranslateMatrix(NativeMatrix, point.X, point.Y, (GdiPlus.MatrixOrder)order); + status |= PInvokeGdiPlus.GdipRotateMatrix(NativeMatrix, angle, (GdiPlus.MatrixOrder)order); + status |= PInvokeGdiPlus.GdipTranslateMatrix(NativeMatrix, -point.X, -point.Y, (GdiPlus.MatrixOrder)order); } else { - status = PInvoke.GdipTranslateMatrix(NativeMatrix, -point.X, -point.Y, (GdiPlus.MatrixOrder)order); - status |= PInvoke.GdipRotateMatrix(NativeMatrix, angle, (GdiPlus.MatrixOrder)order); - status |= PInvoke.GdipTranslateMatrix(NativeMatrix, point.X, point.Y, (GdiPlus.MatrixOrder)order); + status = PInvokeGdiPlus.GdipTranslateMatrix(NativeMatrix, -point.X, -point.Y, (GdiPlus.MatrixOrder)order); + status |= PInvokeGdiPlus.GdipRotateMatrix(NativeMatrix, angle, (GdiPlus.MatrixOrder)order); + status |= PInvokeGdiPlus.GdipTranslateMatrix(NativeMatrix, point.X, point.Y, (GdiPlus.MatrixOrder)order); } status.ThrowIfFailed(); @@ -238,19 +238,19 @@ public void RotateAt(float angle, PointF point, MatrixOrder order) public void Shear(float shearX, float shearY) { - PInvoke.GdipShearMatrix(NativeMatrix, shearX, shearY, GdiPlus.MatrixOrder.MatrixOrderPrepend).ThrowIfFailed(); + PInvokeGdiPlus.GdipShearMatrix(NativeMatrix, shearX, shearY, GdiPlus.MatrixOrder.MatrixOrderPrepend).ThrowIfFailed(); GC.KeepAlive(this); } public void Shear(float shearX, float shearY, MatrixOrder order) { - PInvoke.GdipShearMatrix(NativeMatrix, shearX, shearY, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); + PInvokeGdiPlus.GdipShearMatrix(NativeMatrix, shearX, shearY, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); GC.KeepAlive(this); } public void Invert() { - PInvoke.GdipInvertMatrix(NativeMatrix).ThrowIfFailed(); + PInvokeGdiPlus.GdipInvertMatrix(NativeMatrix).ThrowIfFailed(); GC.KeepAlive(this); } @@ -271,7 +271,7 @@ void TransformPoints(params ReadOnlySpan pts) { fixed (PointF* p = pts) { - PInvoke.GdipTransformMatrixPoints( + PInvokeGdiPlus.GdipTransformMatrixPoints( NativeMatrix, (GdiPlus.PointF*)p, pts.Length).ThrowIfFailed(); @@ -300,7 +300,7 @@ void TransformPoints(params ReadOnlySpan pts) { fixed (Point* p = pts) { - PInvoke.GdipTransformMatrixPointsI( + PInvokeGdiPlus.GdipTransformMatrixPointsI( NativeMatrix, (GdiPlus.Point*)p, pts.Length).ThrowIfFailed(); @@ -329,7 +329,7 @@ void TransformVectors(params ReadOnlySpan pts) { fixed (PointF* p = pts) { - PInvoke.GdipVectorTransformMatrixPoints( + PInvokeGdiPlus.GdipVectorTransformMatrixPoints( NativeMatrix, (GdiPlus.PointF*)p, pts.Length).ThrowIfFailed(); @@ -363,7 +363,7 @@ void TransformVectors(params ReadOnlySpan pts) { fixed (Point* p = pts) { - PInvoke.GdipVectorTransformMatrixPointsI( + PInvokeGdiPlus.GdipVectorTransformMatrixPointsI( NativeMatrix, (GdiPlus.Point*)p, pts.Length).ThrowIfFailed(); @@ -377,7 +377,7 @@ public bool IsInvertible get { BOOL invertible; - PInvoke.GdipIsMatrixInvertible(NativeMatrix, &invertible).ThrowIfFailed(); + PInvokeGdiPlus.GdipIsMatrixInvertible(NativeMatrix, &invertible).ThrowIfFailed(); GC.KeepAlive(this); return invertible; } @@ -388,7 +388,7 @@ public bool IsIdentity get { BOOL identity; - PInvoke.GdipIsMatrixIdentity(NativeMatrix, &identity).ThrowIfFailed(); + PInvokeGdiPlus.GdipIsMatrixIdentity(NativeMatrix, &identity).ThrowIfFailed(); GC.KeepAlive(this); return identity; } @@ -400,7 +400,7 @@ public override bool Equals([NotNullWhen(true)] object? obj) return false; BOOL equal; - PInvoke.GdipIsMatrixEqual( + PInvokeGdiPlus.GdipIsMatrixEqual( NativeMatrix, matrix2.NativeMatrix, &equal).ThrowIfFailed(); diff --git a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/PathGradientBrush.cs b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/PathGradientBrush.cs index 85196256c86..38c79b08730 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/PathGradientBrush.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/PathGradientBrush.cs @@ -43,7 +43,7 @@ public PathGradientBrush(PointF[] points, WrapMode wrapMode) : this(wrapMode, po fixed (PointF* p = points) { GpPathGradient* nativeBrush; - PInvoke.GdipCreatePathGradient( + PInvokeGdiPlus.GdipCreatePathGradient( (GdiPlus.PointF*)p, points.Length, (GdiPlus.WrapMode)wrapMode, @@ -84,7 +84,7 @@ public PathGradientBrush(Point[] points, WrapMode wrapMode) : this(wrapMode, poi fixed (Point* p = points) { GpPathGradient* nativeBrush; - PInvoke.GdipCreatePathGradientI( + PInvokeGdiPlus.GdipCreatePathGradientI( (GdiPlus.Point*)p, points.Length, (GdiPlus.WrapMode)wrapMode, @@ -98,7 +98,7 @@ public PathGradientBrush(GraphicsPath path) { ArgumentNullException.ThrowIfNull(path); GpPathGradient* nativeBrush; - PInvoke.GdipCreatePathGradientFromPath(path._nativePath, &nativeBrush).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreatePathGradientFromPath(path._nativePath, &nativeBrush).ThrowIfFailed(); SetNativeBrushInternal((GpBrush*)nativeBrush); } @@ -113,7 +113,7 @@ internal PathGradientBrush(GpPathGradient* nativeBrush) public override object Clone() { GpBrush* clonedBrush; - PInvoke.GdipCloneBrush(NativeBrush, &clonedBrush).ThrowIfFailed(); + PInvokeGdiPlus.GdipCloneBrush(NativeBrush, &clonedBrush).ThrowIfFailed(); GC.KeepAlive(this); return new PathGradientBrush((GpPathGradient*)clonedBrush); } @@ -123,13 +123,13 @@ public Color CenterColor get { ARGB argb; - PInvoke.GdipGetPathGradientCenterColor(NativePathGradient, (uint*)&argb).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPathGradientCenterColor(NativePathGradient, (uint*)&argb).ThrowIfFailed(); GC.KeepAlive(this); return argb; } set { - PInvoke.GdipSetPathGradientCenterColor(NativePathGradient, (ARGB)value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPathGradientCenterColor(NativePathGradient, (ARGB)value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -139,12 +139,12 @@ public Color[] SurroundColors get { int count; - PInvoke.GdipGetPathGradientSurroundColorCount(NativePathGradient, &count).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPathGradientSurroundColorCount(NativePathGradient, &count).ThrowIfFailed(); using ArgbBuffer buffer = new(count); fixed (uint* b = buffer) { - PInvoke.GdipGetPathGradientSurroundColorsWithCount(NativePathGradient, b, &count).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPathGradientSurroundColorsWithCount(NativePathGradient, b, &count).ThrowIfFailed(); } GC.KeepAlive(this); @@ -158,7 +158,7 @@ public Color[] SurroundColors int count = value.Length; fixed (uint* b = buffer) { - PInvoke.GdipSetPathGradientSurroundColorsWithCount( + PInvokeGdiPlus.GdipSetPathGradientSurroundColorsWithCount( NativePathGradient, b, &count).ThrowIfFailed(); @@ -173,13 +173,13 @@ public PointF CenterPoint get { PointF point; - PInvoke.GdipGetPathGradientCenterPoint(NativePathGradient, (GdiPlus.PointF*)&point).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPathGradientCenterPoint(NativePathGradient, (GdiPlus.PointF*)&point).ThrowIfFailed(); GC.KeepAlive(this); return point; } set { - PInvoke.GdipSetPathGradientCenterPoint(NativePathGradient, (GdiPlus.PointF*)&value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPathGradientCenterPoint(NativePathGradient, (GdiPlus.PointF*)&value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -189,7 +189,7 @@ public RectangleF Rectangle get { RectangleF rect; - PInvoke.GdipGetPathGradientRect(NativePathGradient, (RectF*)&rect).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPathGradientRect(NativePathGradient, (RectF*)&rect).ThrowIfFailed(); GC.KeepAlive(this); return rect; } @@ -201,7 +201,7 @@ public Blend Blend { // Figure out the size of blend factor array int count; - PInvoke.GdipGetPathGradientBlendCount(NativePathGradient, &count).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPathGradientBlendCount(NativePathGradient, &count).ThrowIfFailed(); float[] factors = new float[count]; float[] positions = new float[count]; @@ -209,7 +209,7 @@ public Blend Blend // Retrieve horizontal blend factors fixed (float* f = factors, p = positions) { - PInvoke.GdipGetPathGradientBlend(NativePathGradient, f, p, count).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPathGradientBlend(NativePathGradient, f, p, count).ThrowIfFailed(); } // Return the result in a managed array @@ -236,7 +236,7 @@ public Blend Blend fixed (float* f = value.Factors, p = value.Positions) { // Set blend factors - PInvoke.GdipSetPathGradientBlend(NativePathGradient, f, p, count).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPathGradientBlend(NativePathGradient, f, p, count).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -246,7 +246,7 @@ public Blend Blend public void SetSigmaBellShape(float focus, float scale) { - PInvoke.GdipSetPathGradientSigmaBlend(NativePathGradient, focus, scale).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPathGradientSigmaBlend(NativePathGradient, focus, scale).ThrowIfFailed(); GC.KeepAlive(this); } @@ -254,7 +254,7 @@ public void SetSigmaBellShape(float focus, float scale) public void SetBlendTriangularShape(float focus, float scale) { - PInvoke.GdipSetPathGradientLinearBlend(NativePathGradient, focus, scale).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPathGradientLinearBlend(NativePathGradient, focus, scale).ThrowIfFailed(); GC.KeepAlive(this); } @@ -264,7 +264,7 @@ public ColorBlend InterpolationColors { // Figure out the size of blend factor array int count; - PInvoke.GdipGetPathGradientPresetBlendCount(NativePathGradient, &count).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPathGradientPresetBlendCount(NativePathGradient, &count).ThrowIfFailed(); if (count == 0) { @@ -280,7 +280,7 @@ public ColorBlend InterpolationColors fixed (float* p = positions) { // Retrieve horizontal blend factors - PInvoke.GdipGetPathGradientPresetBlend(NativePathGradient, c, p, count).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPathGradientPresetBlend(NativePathGradient, c, p, count).ThrowIfFailed(); } blend.Positions = positions; @@ -303,7 +303,7 @@ public ColorBlend InterpolationColors fixed (uint* a = argbColors) { // Set blend factors - PInvoke.GdipSetPathGradientPresetBlend(NativePathGradient, a, p, count).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPathGradientPresetBlend(NativePathGradient, a, p, count).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -314,14 +314,14 @@ public Matrix Transform get { Matrix matrix = new(); - PInvoke.GdipGetPathGradientTransform(NativePathGradient, matrix.NativeMatrix).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPathGradientTransform(NativePathGradient, matrix.NativeMatrix).ThrowIfFailed(); GC.KeepAlive(this); return matrix; } set { ArgumentNullException.ThrowIfNull(value); - PInvoke.GdipSetPathGradientTransform(NativePathGradient, value.NativeMatrix).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPathGradientTransform(NativePathGradient, value.NativeMatrix).ThrowIfFailed(); GC.KeepAlive(value); GC.KeepAlive(this); } @@ -329,7 +329,7 @@ public Matrix Transform public void ResetTransform() { - PInvoke.GdipResetPathGradientTransform(NativePathGradient).ThrowIfFailed(); + PInvokeGdiPlus.GdipResetPathGradientTransform(NativePathGradient).ThrowIfFailed(); GC.KeepAlive(this); } @@ -338,7 +338,7 @@ public void ResetTransform() public void MultiplyTransform(Matrix matrix, MatrixOrder order) { ArgumentNullException.ThrowIfNull(matrix); - PInvoke.GdipMultiplyPathGradientTransform( + PInvokeGdiPlus.GdipMultiplyPathGradientTransform( NativePathGradient, matrix.NativeMatrix, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); @@ -351,7 +351,7 @@ public void MultiplyTransform(Matrix matrix, MatrixOrder order) public void TranslateTransform(float dx, float dy, MatrixOrder order) { - PInvoke.GdipTranslatePathGradientTransform(NativePathGradient, dx, dy, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); + PInvokeGdiPlus.GdipTranslatePathGradientTransform(NativePathGradient, dx, dy, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); GC.KeepAlive(this); } @@ -359,7 +359,7 @@ public void TranslateTransform(float dx, float dy, MatrixOrder order) public void ScaleTransform(float sx, float sy, MatrixOrder order) { - PInvoke.GdipScalePathGradientTransform(NativePathGradient, sx, sy, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); + PInvokeGdiPlus.GdipScalePathGradientTransform(NativePathGradient, sx, sy, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); GC.KeepAlive(this); } @@ -367,7 +367,7 @@ public void ScaleTransform(float sx, float sy, MatrixOrder order) public void RotateTransform(float angle, MatrixOrder order) { - PInvoke.GdipRotatePathGradientTransform(NativePathGradient, angle, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); + PInvokeGdiPlus.GdipRotatePathGradientTransform(NativePathGradient, angle, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); GC.KeepAlive(this); } @@ -377,13 +377,13 @@ public PointF FocusScales { float scaleX; float scaleY; - PInvoke.GdipGetPathGradientFocusScales(NativePathGradient, &scaleX, &scaleY).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPathGradientFocusScales(NativePathGradient, &scaleX, &scaleY).ThrowIfFailed(); GC.KeepAlive(this); return new PointF(scaleX, scaleY); } set { - PInvoke.GdipSetPathGradientFocusScales(NativePathGradient, value.X, value.Y).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPathGradientFocusScales(NativePathGradient, value.X, value.Y).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -393,7 +393,7 @@ public WrapMode WrapMode get { WrapMode mode; - PInvoke.GdipGetPathGradientWrapMode(NativePathGradient, (GdiPlus.WrapMode*)&mode).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPathGradientWrapMode(NativePathGradient, (GdiPlus.WrapMode*)&mode).ThrowIfFailed(); GC.KeepAlive(this); return mode; } @@ -402,7 +402,7 @@ public WrapMode WrapMode if (value is < WrapMode.Tile or > WrapMode.Clamp) throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(WrapMode)); - PInvoke.GdipSetPathGradientWrapMode(NativePathGradient, (GdiPlus.WrapMode)value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPathGradientWrapMode(NativePathGradient, (GdiPlus.WrapMode)value).ThrowIfFailed(); GC.KeepAlive(this); } } diff --git a/src/System.Drawing.Common/src/System/Drawing/Font.cs b/src/System.Drawing.Common/src/System/Drawing/Font.cs index 0c58e7d4210..6c6a80505da 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Font.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Font.cs @@ -179,7 +179,7 @@ private void Dispose(bool disposing) #if DEBUG Status status = !Gdip.Initialized ? Status.Ok : #endif - PInvoke.GdipDeleteFont(_nativeFont); + PInvokeGdiPlus.GdipDeleteFont(_nativeFont); #if DEBUG Debug.Assert(status == Status.Ok, $"GDI+ returned an error status: {status}"); #endif @@ -206,7 +206,7 @@ public float GetHeight(Graphics graphics) } float height; - PInvoke.GdipGetFontHeight(NativeFont, graphics.Pointer(), &height).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetFontHeight(NativeFont, graphics.Pointer(), &height).ThrowIfFailed(); GC.KeepAlive(this); GC.KeepAlive(graphics); return height; @@ -215,7 +215,7 @@ public float GetHeight(Graphics graphics) public float GetHeight(float dpi) { float height; - PInvoke.GdipGetFontHeightGivenDPI(NativeFont, dpi, &height).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetFontHeightGivenDPI(NativeFont, dpi, &height).ThrowIfFailed(); GC.KeepAlive(this); return height; } @@ -307,7 +307,7 @@ void ToLogFont(out LOGFONT logFont, Graphics graphics) fixed (LOGFONT* lf = &logFont) { - PInvoke.GdipGetLogFont(NativeFont, graphics.Pointer(), (LOGFONTW*)lf).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetLogFont(NativeFont, graphics.Pointer(), (LOGFONTW*)lf).ThrowIfFailed(); GC.KeepAlive(this); GC.KeepAlive(graphics); } @@ -341,7 +341,7 @@ private void CreateNativeFont() // if creating the font object from an external FontFamily, this object's FontFamily will share the same native object. GpFont* font; - Status status = PInvoke.GdipCreateFont(_fontFamily.Pointer(), _fontSize, (int)_fontStyle, (Unit)_fontUnit, &font); + Status status = PInvokeGdiPlus.GdipCreateFont(_fontFamily.Pointer(), _fontSize, (int)_fontStyle, (Unit)_fontUnit, &font); GC.KeepAlive(this); _nativeFont = font; @@ -481,10 +481,10 @@ private Font(GpFont* nativeFont, byte gdiCharSet, bool gdiVerticalFont) float size; FontStyle style; GpFontFamily* family; - PInvoke.GdipGetFontUnit(_nativeFont, (Unit*)&unit).ThrowIfFailed(); - PInvoke.GdipGetFontSize(_nativeFont, &size).ThrowIfFailed(); - PInvoke.GdipGetFontStyle(_nativeFont, (int*)&style).ThrowIfFailed(); - PInvoke.GdipGetFamily(_nativeFont, &family).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetFontUnit(_nativeFont, (Unit*)&unit).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetFontSize(_nativeFont, &size).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetFontStyle(_nativeFont, (int*)&style).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetFamily(_nativeFont, &family).ThrowIfFailed(); // Fonts from native HFONTs are always from the installed font collection. SetFontFamily(new FontFamily(family, fromInstalledFontCollection: true)); @@ -536,7 +536,7 @@ private void Initialize(FontFamily family, float emSize, FontStyle style, Graphi // Get actual size. float size; - status = PInvoke.GdipGetFontSize(_nativeFont, &size); + status = PInvokeGdiPlus.GdipGetFontSize(_nativeFont, &size); _fontSize = size; GC.KeepAlive(this); Gdip.CheckStatus(status); @@ -586,7 +586,7 @@ static Font FromLogFont(in LOGFONT logFont, IntPtr hdc) GpFont* font; fixed (LOGFONT* lf = &logFont) { - status = PInvoke.GdipCreateFontFromLogfont((HDC)hdc, (LOGFONTW*)lf, &font); + status = PInvokeGdiPlus.GdipCreateFontFromLogfont((HDC)hdc, (LOGFONTW*)lf, &font); } // Special case this incredibly common error message to give more information @@ -653,7 +653,7 @@ public static Font FromLogFont(object lf, IntPtr hdc) public static Font FromHdc(IntPtr hdc) { GpFont* font; - Status status = PInvoke.GdipCreateFontFromDC((HDC)hdc, &font); + Status status = PInvokeGdiPlus.GdipCreateFontFromDC((HDC)hdc, &font); // Special case this incredibly common error message to give more information if (status == Status.NotTrueTypeFont) @@ -674,7 +674,7 @@ public static Font FromHdc(IntPtr hdc) public object Clone() { GpFont* font; - PInvoke.GdipCloneFont(_nativeFont, &font).ThrowIfFailed(); + PInvokeGdiPlus.GdipCloneFont(_nativeFont, &font).ThrowIfFailed(); GC.KeepAlive(this); return new Font(font, _gdiCharSet, _gdiVerticalFont); } diff --git a/src/System.Drawing.Common/src/System/Drawing/FontFamily.cs b/src/System.Drawing.Common/src/System/Drawing/FontFamily.cs index bb3f43b226d..cd8f9e14d06 100644 --- a/src/System.Drawing.Common/src/System/Drawing/FontFamily.cs +++ b/src/System.Drawing.Common/src/System/Drawing/FontFamily.cs @@ -35,7 +35,7 @@ internal FontFamily(GpFontFamily* family, bool fromInstalledFontCollection) else { GpFontFamily* clonedFamily; - PInvoke.GdipCloneFontFamily(family, &clonedFamily).ThrowIfFailed(); + PInvokeGdiPlus.GdipCloneFontFamily(family, &clonedFamily).ThrowIfFailed(); // Only the font collection is ref counted, new font family instances are not created. Debug.Assert(clonedFamily == family); @@ -93,7 +93,7 @@ private void CreateFontFamily(ReadOnlySpan name, FontCollection? fontColle fixed (char* n = name) { Debug.Assert(n is null || n[name.Length] == '\0', "Expected null-terminated string."); - status = PInvoke.GdipCreateFontFamilyFromName(n, nativeFontCollection, &fontFamily); + status = PInvokeGdiPlus.GdipCreateFontFamilyFromName(n, nativeFontCollection, &fontFamily); } if (status != Status.Ok) @@ -140,14 +140,14 @@ public FontFamily(GenericFontFamilies genericFamily) switch (genericFamily) { case GenericFontFamilies.Serif: - PInvoke.GdipGetGenericFontFamilySerif(&nativeFamily).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetGenericFontFamilySerif(&nativeFamily).ThrowIfFailed(); break; case GenericFontFamilies.SansSerif: - PInvoke.GdipGetGenericFontFamilySansSerif(&nativeFamily).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetGenericFontFamilySansSerif(&nativeFamily).ThrowIfFailed(); break; case GenericFontFamilies.Monospace: default: - PInvoke.GdipGetGenericFontFamilyMonospace(&nativeFamily).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetGenericFontFamilyMonospace(&nativeFamily).ThrowIfFailed(); break; } @@ -209,7 +209,7 @@ private void Dispose(bool disposing) // This will ref count the associated FontCollection object. This is only strictly necessary for // manually loaded FontCollections (PrivateFontCollection). - Status status = PInvoke.GdipDeleteFontFamily(_nativeFamily); + Status status = PInvokeGdiPlus.GdipDeleteFontFamily(_nativeFamily); _nativeFamily = null; if (disposing) @@ -239,7 +239,7 @@ private unsafe void GetName(Span span, ushort language) fixed (char* name = span) { - PInvoke.GdipGetFamilyName(NativeFamily, name, language).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetFamilyName(NativeFamily, name, language).ThrowIfFailed(); } } @@ -257,7 +257,7 @@ private unsafe void GetName(Span span, ushort language) private static GpFontFamily* GetGdipGenericSansSerif() { GpFontFamily* nativeFamily; - PInvoke.GdipGetGenericFontFamilySansSerif(&nativeFamily).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetGenericFontFamilySansSerif(&nativeFamily).ThrowIfFailed(); return nativeFamily; } @@ -288,7 +288,7 @@ public static FontFamily[] GetFamilies(Graphics graphics) public bool IsStyleAvailable(FontStyle style) { BOOL isStyleAvailable; - PInvoke.GdipIsStyleAvailable(NativeFamily, (int)style, &isStyleAvailable).ThrowIfFailed(); + PInvokeGdiPlus.GdipIsStyleAvailable(NativeFamily, (int)style, &isStyleAvailable).ThrowIfFailed(); GC.KeepAlive(this); return isStyleAvailable; } @@ -299,7 +299,7 @@ public bool IsStyleAvailable(FontStyle style) public int GetEmHeight(FontStyle style) { ushort emHeight; - PInvoke.GdipGetEmHeight(NativeFamily, (int)style, &emHeight).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetEmHeight(NativeFamily, (int)style, &emHeight).ThrowIfFailed(); GC.KeepAlive(this); return emHeight; } @@ -310,7 +310,7 @@ public int GetEmHeight(FontStyle style) public int GetCellAscent(FontStyle style) { ushort cellAscent; - PInvoke.GdipGetCellAscent(NativeFamily, (int)style, &cellAscent).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetCellAscent(NativeFamily, (int)style, &cellAscent).ThrowIfFailed(); GC.KeepAlive(this); return cellAscent; } @@ -321,7 +321,7 @@ public int GetCellAscent(FontStyle style) public int GetCellDescent(FontStyle style) { ushort cellDescent; - PInvoke.GdipGetCellDescent(NativeFamily, (int)style, &cellDescent).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetCellDescent(NativeFamily, (int)style, &cellDescent).ThrowIfFailed(); GC.KeepAlive(this); return cellDescent; } @@ -333,7 +333,7 @@ public int GetCellDescent(FontStyle style) public int GetLineSpacing(FontStyle style) { ushort lineSpacing; - PInvoke.GdipGetLineSpacing(NativeFamily, (int)style, &lineSpacing).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetLineSpacing(NativeFamily, (int)style, &lineSpacing).ThrowIfFailed(); GC.KeepAlive(this); return lineSpacing; } diff --git a/src/System.Drawing.Common/src/System/Drawing/Gdiplus.cs b/src/System.Drawing.Common/src/System/Drawing/Gdiplus.cs index 84615dbfa17..36ad30e4099 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Gdiplus.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Gdiplus.cs @@ -1,30 +1,14 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Reflection; -using System.Runtime.InteropServices; - namespace System.Drawing; internal static partial class Gdip { - private static readonly bool s_initialized = Init(); - [ThreadStatic] private static IDictionary? t_threadData; - private static unsafe bool Init() - { - if (!OperatingSystem.IsWindows()) - { - NativeLibrary.SetDllImportResolver(Assembly.GetExecutingAssembly(), static (_, _, _) => - throw new PlatformNotSupportedException(SR.PlatformNotSupported_Unix)); - } - - return GdiPlusInitialization.EnsureInitialized(); - } - - internal static bool Initialized => s_initialized; + internal static bool Initialized => GdiPlusInitialization.IsInitialized; /// /// This property will give us back a dictionary we can use to store all of our static brushes and pens on diff --git a/src/System.Drawing.Common/src/System/Drawing/Graphics.cs b/src/System.Drawing.Common/src/System/Drawing/Graphics.cs index 2867cfb6002..d06b20a4e62 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Graphics.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Graphics.cs @@ -86,7 +86,7 @@ public static Graphics FromHdc(IntPtr hdc) public static Graphics FromHdcInternal(IntPtr hdc) { GpGraphics* nativeGraphics; - Gdip.CheckStatus(PInvoke.GdipCreateFromHDC((HDC)hdc, &nativeGraphics)); + Gdip.CheckStatus(PInvokeGdiPlus.GdipCreateFromHDC((HDC)hdc, &nativeGraphics)); return new Graphics(nativeGraphics); } @@ -97,7 +97,7 @@ public static Graphics FromHdcInternal(IntPtr hdc) public static Graphics FromHdc(IntPtr hdc, IntPtr hdevice) { GpGraphics* nativeGraphics; - Gdip.CheckStatus(PInvoke.GdipCreateFromHDC2((HDC)hdc, (HANDLE)hdevice, &nativeGraphics)); + Gdip.CheckStatus(PInvokeGdiPlus.GdipCreateFromHDC2((HDC)hdc, (HANDLE)hdevice, &nativeGraphics)); return new Graphics(nativeGraphics); } @@ -116,7 +116,7 @@ public static Graphics FromHwndInternal(IntPtr hwnd) // this automatically, PInvokeCore cannot and as such needs to be manually initialized if we've never called // another PInvoke method. GdiPlusInitialization.EnsureInitialized(); - Gdip.CheckStatus(PInvokeCore.GdipCreateFromHWND((HWND)hwnd, &nativeGraphics)); + Gdip.CheckStatus(PInvokeGdiPlus.GdipCreateFromHWND((HWND)hwnd, &nativeGraphics)); return new Graphics(nativeGraphics); } @@ -131,7 +131,7 @@ public static Graphics FromImage(Image image) throw new ArgumentException(SR.GdiplusCannotCreateGraphicsFromIndexedPixelFormat, nameof(image)); GpGraphics* nativeGraphics; - Gdip.CheckStatus(PInvoke.GdipGetImageGraphicsContext(image.Pointer(), &nativeGraphics)); + Gdip.CheckStatus(PInvokeGdiPlus.GdipGetImageGraphicsContext(image.Pointer(), &nativeGraphics)); GC.KeepAlive(image); return new Graphics(nativeGraphics) { _backingImage = image }; @@ -140,7 +140,7 @@ public static Graphics FromImage(Image image) [EditorBrowsable(EditorBrowsableState.Never)] public void ReleaseHdcInternal(IntPtr hdc) { - CheckStatus(!Gdip.Initialized ? Status.Ok : PInvoke.GdipReleaseDC(NativeGraphics, (HDC)hdc)); + CheckStatus(!Gdip.Initialized ? Status.Ok : PInvokeGdiPlus.GdipReleaseDC(NativeGraphics, (HDC)hdc)); _nativeHdc = HDC.Null; } @@ -179,7 +179,7 @@ private void Dispose(bool disposing) if (NativeGraphics is not null) { - Status status = !Gdip.Initialized ? Status.Ok : PInvokeCore.GdipDeleteGraphics(NativeGraphics); + Status status = !Gdip.Initialized ? Status.Ok : PInvokeGdiPlus.GdipDeleteGraphics(NativeGraphics); NativeGraphics = null; Debug.Assert(status == Status.Ok, $"GDI+ returned an error status: {status}"); } @@ -199,7 +199,7 @@ public Region Clip get { Region region = new(); - CheckStatus(PInvoke.GdipGetClip(NativeGraphics, region.NativeRegion)); + CheckStatus(PInvokeGdiPlus.GdipGetClip(NativeGraphics, region.NativeRegion)); return region; } set => SetClip(value, Drawing2D.CombineMode.Replace); @@ -210,7 +210,7 @@ public RectangleF ClipBounds get { RectF rect; - CheckStatus(PInvoke.GdipGetClipBounds(NativeGraphics, &rect)); + CheckStatus(PInvokeGdiPlus.GdipGetClipBounds(NativeGraphics, &rect)); return rect; } } @@ -223,7 +223,7 @@ public Drawing2D.CompositingMode CompositingMode get { GdiPlus.CompositingMode mode; - CheckStatus(PInvoke.GdipGetCompositingMode(NativeGraphics, &mode)); + CheckStatus(PInvokeGdiPlus.GdipGetCompositingMode(NativeGraphics, &mode)); return (Drawing2D.CompositingMode)mode; } set @@ -231,7 +231,7 @@ public Drawing2D.CompositingMode CompositingMode if (value is < Drawing2D.CompositingMode.SourceOver or > Drawing2D.CompositingMode.SourceCopy) throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(Drawing2D.CompositingMode)); - CheckStatus(PInvoke.GdipSetCompositingMode(NativeGraphics, (GdiPlus.CompositingMode)value)); + CheckStatus(PInvokeGdiPlus.GdipSetCompositingMode(NativeGraphics, (GdiPlus.CompositingMode)value)); } } @@ -240,7 +240,7 @@ public Drawing2D.CompositingQuality CompositingQuality get { GdiPlus.CompositingQuality quality; - CheckStatus(PInvoke.GdipGetCompositingQuality(NativeGraphics, &quality)); + CheckStatus(PInvokeGdiPlus.GdipGetCompositingQuality(NativeGraphics, &quality)); return (Drawing2D.CompositingQuality)quality; } set @@ -248,7 +248,7 @@ public Drawing2D.CompositingQuality CompositingQuality if (value is < Drawing2D.CompositingQuality.Invalid or > Drawing2D.CompositingQuality.AssumeLinear) throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(Drawing2D.CompositingQuality)); - CheckStatus(PInvoke.GdipSetCompositingQuality(NativeGraphics, (GdiPlus.CompositingQuality)value)); + CheckStatus(PInvokeGdiPlus.GdipSetCompositingQuality(NativeGraphics, (GdiPlus.CompositingQuality)value)); } } @@ -257,7 +257,7 @@ public float DpiX get { float dpi; - CheckStatus(PInvoke.GdipGetDpiX(NativeGraphics, &dpi)); + CheckStatus(PInvokeGdiPlus.GdipGetDpiX(NativeGraphics, &dpi)); return dpi; } } @@ -267,7 +267,7 @@ public float DpiY get { float dpi; - CheckStatus(PInvoke.GdipGetDpiY(NativeGraphics, &dpi)); + CheckStatus(PInvokeGdiPlus.GdipGetDpiY(NativeGraphics, &dpi)); return dpi; } } @@ -280,7 +280,7 @@ public Drawing2D.InterpolationMode InterpolationMode get { GdiPlus.InterpolationMode mode; - CheckStatus(PInvoke.GdipGetInterpolationMode(NativeGraphics, &mode)); + CheckStatus(PInvokeGdiPlus.GdipGetInterpolationMode(NativeGraphics, &mode)); return (Drawing2D.InterpolationMode)mode; } set @@ -288,7 +288,7 @@ public Drawing2D.InterpolationMode InterpolationMode if (value is < Drawing2D.InterpolationMode.Invalid or > Drawing2D.InterpolationMode.HighQualityBicubic) throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(Drawing2D.InterpolationMode)); - CheckStatus(PInvoke.GdipSetInterpolationMode(NativeGraphics, (GdiPlus.InterpolationMode)value)); + CheckStatus(PInvokeGdiPlus.GdipSetInterpolationMode(NativeGraphics, (GdiPlus.InterpolationMode)value)); } } @@ -297,7 +297,7 @@ public bool IsClipEmpty get { BOOL isEmpty; - CheckStatus(PInvoke.GdipIsClipEmpty(NativeGraphics, &isEmpty)); + CheckStatus(PInvokeGdiPlus.GdipIsClipEmpty(NativeGraphics, &isEmpty)); return isEmpty; } } @@ -307,7 +307,7 @@ public bool IsVisibleClipEmpty get { BOOL isEmpty; - CheckStatus(PInvoke.GdipIsVisibleClipEmpty(NativeGraphics, &isEmpty)); + CheckStatus(PInvokeGdiPlus.GdipIsVisibleClipEmpty(NativeGraphics, &isEmpty)); return isEmpty; } } @@ -317,10 +317,10 @@ public float PageScale get { float scale; - CheckStatus(PInvoke.GdipGetPageScale(NativeGraphics, &scale)); + CheckStatus(PInvokeGdiPlus.GdipGetPageScale(NativeGraphics, &scale)); return scale; } - set => CheckStatus(PInvoke.GdipSetPageScale(NativeGraphics, value)); + set => CheckStatus(PInvokeGdiPlus.GdipSetPageScale(NativeGraphics, value)); } public GraphicsUnit PageUnit @@ -328,7 +328,7 @@ public GraphicsUnit PageUnit get { Unit unit; - CheckStatus(PInvoke.GdipGetPageUnit(NativeGraphics, &unit)); + CheckStatus(PInvokeGdiPlus.GdipGetPageUnit(NativeGraphics, &unit)); return (GraphicsUnit)unit; } set @@ -336,7 +336,7 @@ public GraphicsUnit PageUnit if (value is < GraphicsUnit.World or > GraphicsUnit.Millimeter) throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(GraphicsUnit)); - CheckStatus(PInvoke.GdipSetPageUnit(NativeGraphics, (Unit)value)); + CheckStatus(PInvokeGdiPlus.GdipSetPageUnit(NativeGraphics, (Unit)value)); } } @@ -345,7 +345,7 @@ public PixelOffsetMode PixelOffsetMode get { GdiPlus.PixelOffsetMode mode; - CheckStatus(PInvoke.GdipGetPixelOffsetMode(NativeGraphics, &mode)); + CheckStatus(PInvokeGdiPlus.GdipGetPixelOffsetMode(NativeGraphics, &mode)); return (PixelOffsetMode)mode; } set @@ -353,7 +353,7 @@ public PixelOffsetMode PixelOffsetMode if (value is < PixelOffsetMode.Invalid or > PixelOffsetMode.Half) throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(PixelOffsetMode)); - CheckStatus(PInvoke.GdipSetPixelOffsetMode(NativeGraphics, (GdiPlus.PixelOffsetMode)value)); + CheckStatus(PInvokeGdiPlus.GdipSetPixelOffsetMode(NativeGraphics, (GdiPlus.PixelOffsetMode)value)); } } @@ -362,10 +362,10 @@ public Point RenderingOrigin get { int x, y; - CheckStatus(PInvoke.GdipGetRenderingOrigin(NativeGraphics, &x, &y)); + CheckStatus(PInvokeGdiPlus.GdipGetRenderingOrigin(NativeGraphics, &x, &y)); return new Point(x, y); } - set => CheckStatus(PInvoke.GdipSetRenderingOrigin(NativeGraphics, value.X, value.Y)); + set => CheckStatus(PInvokeGdiPlus.GdipSetRenderingOrigin(NativeGraphics, value.X, value.Y)); } public Drawing2D.SmoothingMode SmoothingMode @@ -373,7 +373,7 @@ public Drawing2D.SmoothingMode SmoothingMode get { GdiPlus.SmoothingMode mode; - CheckStatus(PInvoke.GdipGetSmoothingMode(NativeGraphics, &mode)); + CheckStatus(PInvokeGdiPlus.GdipGetSmoothingMode(NativeGraphics, &mode)); return (Drawing2D.SmoothingMode)mode; } set @@ -381,7 +381,7 @@ public Drawing2D.SmoothingMode SmoothingMode if (value is < Drawing2D.SmoothingMode.Invalid or > Drawing2D.SmoothingMode.AntiAlias) throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(Drawing2D.SmoothingMode)); - CheckStatus(PInvoke.GdipSetSmoothingMode(NativeGraphics, (GdiPlus.SmoothingMode)value)); + CheckStatus(PInvokeGdiPlus.GdipSetSmoothingMode(NativeGraphics, (GdiPlus.SmoothingMode)value)); } } @@ -390,10 +390,10 @@ public int TextContrast get { uint textContrast; - CheckStatus(PInvoke.GdipGetTextContrast(NativeGraphics, &textContrast)); + CheckStatus(PInvokeGdiPlus.GdipGetTextContrast(NativeGraphics, &textContrast)); return (int)textContrast; } - set => CheckStatus(PInvoke.GdipSetTextContrast(NativeGraphics, (uint)value)); + set => CheckStatus(PInvokeGdiPlus.GdipSetTextContrast(NativeGraphics, (uint)value)); } /// @@ -404,7 +404,7 @@ public TextRenderingHint TextRenderingHint get { GdiPlus.TextRenderingHint hint; - CheckStatus(PInvoke.GdipGetTextRenderingHint(NativeGraphics, &hint)); + CheckStatus(PInvokeGdiPlus.GdipGetTextRenderingHint(NativeGraphics, &hint)); return (TextRenderingHint)hint; } set @@ -412,7 +412,7 @@ public TextRenderingHint TextRenderingHint if (value is < TextRenderingHint.SystemDefault or > TextRenderingHint.ClearTypeGridFit) throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(TextRenderingHint)); - CheckStatus(PInvoke.GdipSetTextRenderingHint(NativeGraphics, (GdiPlus.TextRenderingHint)value)); + CheckStatus(PInvokeGdiPlus.GdipSetTextRenderingHint(NativeGraphics, (GdiPlus.TextRenderingHint)value)); } } @@ -424,12 +424,12 @@ public Matrix Transform get { Matrix matrix = new(); - CheckStatus(PInvoke.GdipGetWorldTransform(NativeGraphics, matrix.NativeMatrix)); + CheckStatus(PInvokeGdiPlus.GdipGetWorldTransform(NativeGraphics, matrix.NativeMatrix)); return matrix; } set { - CheckStatus(PInvoke.GdipSetWorldTransform(NativeGraphics, value.NativeMatrix)); + CheckStatus(PInvokeGdiPlus.GdipSetWorldTransform(NativeGraphics, value.NativeMatrix)); GC.KeepAlive(value); } } @@ -447,21 +447,21 @@ public Matrix3x2 TransformElements get { GdiPlus.Matrix* nativeMatrix; - CheckStatus(PInvoke.GdipCreateMatrix(&nativeMatrix)); + CheckStatus(PInvokeGdiPlus.GdipCreateMatrix(&nativeMatrix)); try { - CheckStatus(PInvoke.GdipGetWorldTransform(NativeGraphics, nativeMatrix)); + CheckStatus(PInvokeGdiPlus.GdipGetWorldTransform(NativeGraphics, nativeMatrix)); Matrix3x2 matrix = default; - CheckStatus(PInvoke.GdipGetMatrixElements(nativeMatrix, (float*)&matrix)); + CheckStatus(PInvokeGdiPlus.GdipGetMatrixElements(nativeMatrix, (float*)&matrix)); return matrix; } finally { if (nativeMatrix is not null) { - PInvoke.GdipDeleteMatrix(nativeMatrix); + PInvokeGdiPlus.GdipDeleteMatrix(nativeMatrix); } } } @@ -471,13 +471,13 @@ public Matrix3x2 TransformElements try { - CheckStatus(PInvoke.GdipSetWorldTransform(NativeGraphics, nativeMatrix)); + CheckStatus(PInvokeGdiPlus.GdipSetWorldTransform(NativeGraphics, nativeMatrix)); } finally { if (nativeMatrix is not null) { - PInvoke.GdipDeleteMatrix(nativeMatrix); + PInvokeGdiPlus.GdipDeleteMatrix(nativeMatrix); } } } @@ -488,7 +488,7 @@ public Matrix3x2 TransformElements public IntPtr GetHdc() { HDC hdc; - CheckStatus(PInvoke.GdipGetDC(NativeGraphics, &hdc)); + CheckStatus(PInvokeGdiPlus.GdipGetDC(NativeGraphics, &hdc)); // Need to cache the hdc to be able to release with a call to IDeviceContext.ReleaseHdc(). _nativeHdc = hdc; @@ -509,7 +509,7 @@ public IntPtr GetHdc() /// Forces execution of all operations currently on the stack. /// public void Flush(Drawing2D.FlushIntention intention) => - CheckStatus(PInvoke.GdipFlush(NativeGraphics, (GdiPlus.FlushIntention)intention)); + CheckStatus(PInvokeGdiPlus.GdipFlush(NativeGraphics, (GdiPlus.FlushIntention)intention)); public void SetClip(Graphics g) => SetClip(g, Drawing2D.CombineMode.Replace); @@ -517,7 +517,7 @@ public void SetClip(Graphics g, Drawing2D.CombineMode combineMode) { ArgumentNullException.ThrowIfNull(g); - CheckStatus(PInvoke.GdipSetClipGraphics(NativeGraphics, g.NativeGraphics, (GdiPlus.CombineMode)combineMode)); + CheckStatus(PInvokeGdiPlus.GdipSetClipGraphics(NativeGraphics, g.NativeGraphics, (GdiPlus.CombineMode)combineMode)); GC.KeepAlive(g); } @@ -528,28 +528,28 @@ public void SetClip(Graphics g, Drawing2D.CombineMode combineMode) public void SetClip(RectangleF rect) => SetClip(rect, Drawing2D.CombineMode.Replace); public void SetClip(RectangleF rect, Drawing2D.CombineMode combineMode) => - CheckStatus(PInvoke.GdipSetClipRect(NativeGraphics, rect.X, rect.Y, rect.Width, rect.Height, (GdiPlus.CombineMode)combineMode)); + CheckStatus(PInvokeGdiPlus.GdipSetClipRect(NativeGraphics, rect.X, rect.Y, rect.Width, rect.Height, (GdiPlus.CombineMode)combineMode)); public void SetClip(GraphicsPath path) => SetClip(path, Drawing2D.CombineMode.Replace); public void SetClip(GraphicsPath path, Drawing2D.CombineMode combineMode) { ArgumentNullException.ThrowIfNull(path); - CheckStatus(PInvoke.GdipSetClipPath(NativeGraphics, path._nativePath, (GdiPlus.CombineMode)combineMode)); + CheckStatus(PInvokeGdiPlus.GdipSetClipPath(NativeGraphics, path._nativePath, (GdiPlus.CombineMode)combineMode)); GC.KeepAlive(path); } public void SetClip(Region region, Drawing2D.CombineMode combineMode) { ArgumentNullException.ThrowIfNull(region); - CheckStatus(PInvoke.GdipSetClipRegion(NativeGraphics, region.NativeRegion, (GdiPlus.CombineMode)combineMode)); + CheckStatus(PInvokeGdiPlus.GdipSetClipRegion(NativeGraphics, region.NativeRegion, (GdiPlus.CombineMode)combineMode)); GC.KeepAlive(region); } public void IntersectClip(Rectangle rect) => IntersectClip((RectangleF)rect); public void IntersectClip(RectangleF rect) => - CheckStatus(PInvoke.GdipSetClipRect( + CheckStatus(PInvokeGdiPlus.GdipSetClipRect( NativeGraphics, rect.X, rect.Y, rect.Width, rect.Height, GdiPlus.CombineMode.CombineModeIntersect)); @@ -557,12 +557,12 @@ public void IntersectClip(RectangleF rect) => public void IntersectClip(Region region) { ArgumentNullException.ThrowIfNull(region); - CheckStatus(PInvoke.GdipSetClipRegion(NativeGraphics, region.NativeRegion, GdiPlus.CombineMode.CombineModeIntersect)); + CheckStatus(PInvokeGdiPlus.GdipSetClipRegion(NativeGraphics, region.NativeRegion, GdiPlus.CombineMode.CombineModeIntersect)); GC.KeepAlive(region); } public void ExcludeClip(Rectangle rect) => - CheckStatus(PInvoke.GdipSetClipRect( + CheckStatus(PInvokeGdiPlus.GdipSetClipRect( NativeGraphics, rect.X, rect.Y, rect.Width, rect.Height, GdiPlus.CombineMode.CombineModeExclude)); @@ -570,15 +570,15 @@ public void ExcludeClip(Rectangle rect) => public void ExcludeClip(Region region) { ArgumentNullException.ThrowIfNull(region); - CheckStatus(PInvoke.GdipSetClipRegion(NativeGraphics, region.NativeRegion, GdiPlus.CombineMode.CombineModeExclude)); + CheckStatus(PInvokeGdiPlus.GdipSetClipRegion(NativeGraphics, region.NativeRegion, GdiPlus.CombineMode.CombineModeExclude)); GC.KeepAlive(region); } - public void ResetClip() => CheckStatus(PInvoke.GdipResetClip(NativeGraphics)); + public void ResetClip() => CheckStatus(PInvokeGdiPlus.GdipResetClip(NativeGraphics)); - public void TranslateClip(float dx, float dy) => CheckStatus(PInvoke.GdipTranslateClip(NativeGraphics, dx, dy)); + public void TranslateClip(float dx, float dy) => CheckStatus(PInvokeGdiPlus.GdipTranslateClip(NativeGraphics, dx, dy)); - public void TranslateClip(int dx, int dy) => CheckStatus(PInvoke.GdipTranslateClip(NativeGraphics, dx, dy)); + public void TranslateClip(int dx, int dy) => CheckStatus(PInvokeGdiPlus.GdipTranslateClip(NativeGraphics, dx, dy)); public bool IsVisible(int x, int y) => IsVisible((float)x, y); @@ -587,7 +587,7 @@ public void ExcludeClip(Region region) public bool IsVisible(float x, float y) { BOOL isVisible; - CheckStatus(PInvoke.GdipIsVisiblePoint(NativeGraphics, x, y, &isVisible)); + CheckStatus(PInvokeGdiPlus.GdipIsVisiblePoint(NativeGraphics, x, y, &isVisible)); return isVisible; } @@ -600,7 +600,7 @@ public bool IsVisible(float x, float y) public bool IsVisible(float x, float y, float width, float height) { BOOL isVisible; - CheckStatus(PInvoke.GdipIsVisibleRect(NativeGraphics, x, y, width, height, &isVisible)); + CheckStatus(PInvokeGdiPlus.GdipIsVisibleRect(NativeGraphics, x, y, width, height, &isVisible)); return isVisible; } @@ -609,7 +609,7 @@ public bool IsVisible(float x, float y, float width, float height) /// /// Resets the world transform to identity. /// - public void ResetTransform() => CheckStatus(PInvoke.GdipResetWorldTransform(NativeGraphics)); + public void ResetTransform() => CheckStatus(PInvokeGdiPlus.GdipResetWorldTransform(NativeGraphics)); /// /// Multiplies the that represents the world transform and . @@ -622,24 +622,24 @@ public bool IsVisible(float x, float y, float width, float height) public void MultiplyTransform(Matrix matrix, MatrixOrder order) { ArgumentNullException.ThrowIfNull(matrix); - CheckStatus(PInvoke.GdipMultiplyWorldTransform(NativeGraphics, matrix.NativeMatrix, (GdiPlus.MatrixOrder)order)); + CheckStatus(PInvokeGdiPlus.GdipMultiplyWorldTransform(NativeGraphics, matrix.NativeMatrix, (GdiPlus.MatrixOrder)order)); GC.KeepAlive(matrix); } public void TranslateTransform(float dx, float dy) => TranslateTransform(dx, dy, MatrixOrder.Prepend); public void TranslateTransform(float dx, float dy, MatrixOrder order) => - CheckStatus(PInvoke.GdipTranslateWorldTransform(NativeGraphics, dx, dy, (GdiPlus.MatrixOrder)order)); + CheckStatus(PInvokeGdiPlus.GdipTranslateWorldTransform(NativeGraphics, dx, dy, (GdiPlus.MatrixOrder)order)); public void ScaleTransform(float sx, float sy) => ScaleTransform(sx, sy, MatrixOrder.Prepend); public void ScaleTransform(float sx, float sy, MatrixOrder order) => - CheckStatus(PInvoke.GdipScaleWorldTransform(NativeGraphics, sx, sy, (GdiPlus.MatrixOrder)order)); + CheckStatus(PInvokeGdiPlus.GdipScaleWorldTransform(NativeGraphics, sx, sy, (GdiPlus.MatrixOrder)order)); public void RotateTransform(float angle) => RotateTransform(angle, MatrixOrder.Prepend); public void RotateTransform(float angle, MatrixOrder order) => - CheckStatus(PInvoke.GdipRotateWorldTransform(NativeGraphics, angle, (GdiPlus.MatrixOrder)order)); + CheckStatus(PInvokeGdiPlus.GdipRotateWorldTransform(NativeGraphics, angle, (GdiPlus.MatrixOrder)order)); /// /// Draws an arc from the specified ellipse. @@ -648,7 +648,7 @@ public void DrawArc(Pen pen, float x, float y, float width, float height, float { ArgumentNullException.ThrowIfNull(pen); - CheckErrorStatus(PInvoke.GdipDrawArc( + CheckErrorStatus(PInvokeGdiPlus.GdipDrawArc( NativeGraphics, pen.NativePen, x, y, width, height, @@ -683,7 +683,7 @@ public void DrawBezier(Pen pen, float x1, float y1, float x2, float y2, float x3 { ArgumentNullException.ThrowIfNull(pen); - CheckErrorStatus(PInvoke.GdipDrawBezier( + CheckErrorStatus(PInvokeGdiPlus.GdipDrawBezier( NativeGraphics, pen.NativePen, x1, y1, x2, y2, x3, y3, x4, y4)); @@ -740,7 +740,7 @@ public void DrawRoundedRectangle(Pen pen, RectangleF rect, SizeF radius) public void DrawRectangle(Pen pen, float x, float y, float width, float height) { ArgumentNullException.ThrowIfNull(pen); - CheckErrorStatus(PInvoke.GdipDrawRectangle(NativeGraphics, pen.NativePen, x, y, width, height)); + CheckErrorStatus(PInvokeGdiPlus.GdipDrawRectangle(NativeGraphics, pen.NativePen, x, y, width, height)); GC.KeepAlive(pen); } @@ -765,7 +765,7 @@ void DrawRectangles(Pen pen, params ReadOnlySpan rects) fixed (RectangleF* r = rects) { - CheckErrorStatus(PInvoke.GdipDrawRectangles(NativeGraphics, pen.NativePen, (RectF*)r, rects.Length)); + CheckErrorStatus(PInvokeGdiPlus.GdipDrawRectangles(NativeGraphics, pen.NativePen, (RectF*)r, rects.Length)); } GC.KeepAlive(pen); @@ -790,7 +790,7 @@ void DrawRectangles(Pen pen, params ReadOnlySpan rects) fixed (Rectangle* r = rects) { - CheckErrorStatus(PInvoke.GdipDrawRectanglesI(NativeGraphics, pen.NativePen, (Rect*)r, rects.Length)); + CheckErrorStatus(PInvokeGdiPlus.GdipDrawRectanglesI(NativeGraphics, pen.NativePen, (Rect*)r, rects.Length)); } GC.KeepAlive(pen); @@ -807,7 +807,7 @@ void DrawRectangles(Pen pen, params ReadOnlySpan rects) public void DrawEllipse(Pen pen, float x, float y, float width, float height) { ArgumentNullException.ThrowIfNull(pen); - CheckErrorStatus(PInvoke.GdipDrawEllipse(NativeGraphics, pen.NativePen, x, y, width, height)); + CheckErrorStatus(PInvokeGdiPlus.GdipDrawEllipse(NativeGraphics, pen.NativePen, x, y, width, height)); GC.KeepAlive(pen); } @@ -833,7 +833,7 @@ public void DrawPie(Pen pen, RectangleF rect, float startAngle, float sweepAngle public void DrawPie(Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle) { ArgumentNullException.ThrowIfNull(pen); - CheckErrorStatus(PInvoke.GdipDrawPie(NativeGraphics, pen.NativePen, x, y, width, height, startAngle, sweepAngle)); + CheckErrorStatus(PInvokeGdiPlus.GdipDrawPie(NativeGraphics, pen.NativePen, x, y, width, height, startAngle, sweepAngle)); GC.KeepAlive(pen); } @@ -864,7 +864,7 @@ void DrawPolygon(Pen pen, params ReadOnlySpan points) fixed (PointF* p = points) { - CheckErrorStatus(PInvoke.GdipDrawPolygon(NativeGraphics, pen.NativePen, (GdiPlus.PointF*)p, points.Length)); + CheckErrorStatus(PInvokeGdiPlus.GdipDrawPolygon(NativeGraphics, pen.NativePen, (GdiPlus.PointF*)p, points.Length)); } GC.KeepAlive(pen); @@ -889,7 +889,7 @@ void DrawPolygon(Pen pen, params ReadOnlySpan points) fixed (Point* p = points) { - CheckErrorStatus(PInvoke.GdipDrawPolygonI(NativeGraphics, pen.NativePen, (GdiPlus.Point*)p, points.Length)); + CheckErrorStatus(PInvokeGdiPlus.GdipDrawPolygonI(NativeGraphics, pen.NativePen, (GdiPlus.Point*)p, points.Length)); } GC.KeepAlive(pen); @@ -903,7 +903,7 @@ public void DrawPath(Pen pen, GraphicsPath path) ArgumentNullException.ThrowIfNull(pen); ArgumentNullException.ThrowIfNull(path); - CheckErrorStatus(PInvoke.GdipDrawPath(NativeGraphics, pen.NativePen, path._nativePath)); + CheckErrorStatus(PInvokeGdiPlus.GdipDrawPath(NativeGraphics, pen.NativePen, path._nativePath)); GC.KeepAlive(pen); GC.KeepAlive(path); @@ -924,7 +924,7 @@ void DrawCurve(Pen pen, params ReadOnlySpan points) fixed (PointF* p = points) { - CheckErrorStatus(PInvoke.GdipDrawCurve(NativeGraphics, pen.NativePen, (GdiPlus.PointF*)p, points.Length)); + CheckErrorStatus(PInvokeGdiPlus.GdipDrawCurve(NativeGraphics, pen.NativePen, (GdiPlus.PointF*)p, points.Length)); } GC.KeepAlive(pen); @@ -946,7 +946,7 @@ void DrawCurve(Pen pen, ReadOnlySpan points, float tension) fixed (PointF* p = points) { - CheckErrorStatus(PInvoke.GdipDrawCurve2( + CheckErrorStatus(PInvokeGdiPlus.GdipDrawCurve2( NativeGraphics, pen.NativePen, (GdiPlus.PointF*)p, points.Length, @@ -982,7 +982,7 @@ void DrawCurve(Pen pen, ReadOnlySpan points, int offset, int numberOfSeg fixed (PointF* p = points) { - CheckErrorStatus(PInvoke.GdipDrawCurve3( + CheckErrorStatus(PInvokeGdiPlus.GdipDrawCurve3( NativeGraphics, pen.NativePen, (GdiPlus.PointF*)p, points.Length, @@ -1009,7 +1009,7 @@ void DrawCurve(Pen pen, params ReadOnlySpan points) fixed (Point* p = points) { - CheckErrorStatus(PInvoke.GdipDrawCurveI(NativeGraphics, pen.NativePen, (GdiPlus.Point*)p, points.Length)); + CheckErrorStatus(PInvokeGdiPlus.GdipDrawCurveI(NativeGraphics, pen.NativePen, (GdiPlus.Point*)p, points.Length)); } GC.KeepAlive(pen); @@ -1031,7 +1031,7 @@ void DrawCurve(Pen pen, ReadOnlySpan points, float tension) fixed (Point* p = points) { - CheckErrorStatus(PInvoke.GdipDrawCurve2I( + CheckErrorStatus(PInvokeGdiPlus.GdipDrawCurve2I( NativeGraphics, pen.NativePen, (GdiPlus.Point*)p, points.Length, @@ -1064,7 +1064,7 @@ void DrawCurve(Pen pen, ReadOnlySpan points, int offset, int numberOfSegm fixed (Point* p = points) { - CheckErrorStatus(PInvoke.GdipDrawCurve3I( + CheckErrorStatus(PInvokeGdiPlus.GdipDrawCurve3I( NativeGraphics, pen.NativePen, (GdiPlus.Point*)p, points.Length, @@ -1092,7 +1092,7 @@ void DrawClosedCurve(Pen pen, params ReadOnlySpan points) fixed (PointF* p = points) { - CheckErrorStatus(PInvoke.GdipDrawClosedCurve( + CheckErrorStatus(PInvokeGdiPlus.GdipDrawClosedCurve( NativeGraphics, pen.NativePen, (GdiPlus.PointF*)p, points.Length)); @@ -1123,7 +1123,7 @@ void DrawClosedCurve(Pen pen, ReadOnlySpan points, float tension, FillMo fixed (PointF* p = points) { - CheckErrorStatus(PInvoke.GdipDrawClosedCurve2( + CheckErrorStatus(PInvokeGdiPlus.GdipDrawClosedCurve2( NativeGraphics, pen.NativePen, (GdiPlus.PointF*)p, points.Length, @@ -1148,7 +1148,7 @@ void DrawClosedCurve(Pen pen, params ReadOnlySpan points) fixed (Point* p = points) { - CheckErrorStatus(PInvoke.GdipDrawClosedCurveI( + CheckErrorStatus(PInvokeGdiPlus.GdipDrawClosedCurveI( NativeGraphics, pen.NativePen, (GdiPlus.Point*)p, points.Length)); @@ -1174,7 +1174,7 @@ void DrawClosedCurve(Pen pen, ReadOnlySpan points, float tension, FillMod fixed (Point* p = points) { - CheckErrorStatus(PInvoke.GdipDrawClosedCurve2I( + CheckErrorStatus(PInvokeGdiPlus.GdipDrawClosedCurve2I( NativeGraphics, pen.NativePen, (GdiPlus.Point*)p, points.Length, @@ -1187,7 +1187,7 @@ void DrawClosedCurve(Pen pen, ReadOnlySpan points, float tension, FillMod /// /// Fills the entire drawing surface with the specified color. /// - public void Clear(Color color) => CheckStatus(PInvoke.GdipGraphicsClear(NativeGraphics, (uint)color.ToArgb())); + public void Clear(Color color) => CheckStatus(PInvokeGdiPlus.GdipGraphicsClear(NativeGraphics, (uint)color.ToArgb())); #if NET9_0_OR_GREATER /// /> @@ -1220,7 +1220,7 @@ public void FillRectangle(Brush brush, float x, float y, float width, float heig { ArgumentNullException.ThrowIfNull(brush); - CheckErrorStatus(PInvoke.GdipFillRectangle( + CheckErrorStatus(PInvokeGdiPlus.GdipFillRectangle( NativeGraphics, brush.NativeBrush, x, y, width, height)); @@ -1261,7 +1261,7 @@ void FillRectangles(Brush brush, params ReadOnlySpan rects) fixed (RectangleF* r = rects) { - CheckErrorStatus(PInvoke.GdipFillRectangles(NativeGraphics, brush.NativeBrush, (RectF*)r, rects.Length)); + CheckErrorStatus(PInvokeGdiPlus.GdipFillRectangles(NativeGraphics, brush.NativeBrush, (RectF*)r, rects.Length)); } GC.KeepAlive(brush); @@ -1283,7 +1283,7 @@ void FillRectangles(Brush brush, params ReadOnlySpan rects) fixed (Rectangle* r = rects) { - CheckErrorStatus(PInvoke.GdipFillRectanglesI(NativeGraphics, brush.NativeBrush, (Rect*)r, rects.Length)); + CheckErrorStatus(PInvokeGdiPlus.GdipFillRectanglesI(NativeGraphics, brush.NativeBrush, (Rect*)r, rects.Length)); } GC.KeepAlive(brush); @@ -1313,7 +1313,7 @@ void FillPolygon(Brush brush, ReadOnlySpan points, FillMode fillMode) fixed (PointF* p = points) { - CheckErrorStatus(PInvoke.GdipFillPolygon( + CheckErrorStatus(PInvokeGdiPlus.GdipFillPolygon( NativeGraphics, brush.NativeBrush, (GdiPlus.PointF*)p, points.Length, @@ -1352,7 +1352,7 @@ void FillPolygon(Brush brush, ReadOnlySpan points, FillMode fillMode) fixed (Point* p = points) { - CheckErrorStatus(PInvoke.GdipFillPolygonI( + CheckErrorStatus(PInvokeGdiPlus.GdipFillPolygonI( NativeGraphics, brush.NativeBrush, (GdiPlus.Point*)p, points.Length, @@ -1374,7 +1374,7 @@ public void FillEllipse(Brush brush, float x, float y, float width, float height { ArgumentNullException.ThrowIfNull(brush); - CheckErrorStatus(PInvoke.GdipFillEllipse( + CheckErrorStatus(PInvokeGdiPlus.GdipFillEllipse( NativeGraphics, brush.NativeBrush, x, y, width, height)); @@ -1423,7 +1423,7 @@ public void FillPie(Brush brush, float x, float y, float width, float height, fl { ArgumentNullException.ThrowIfNull(brush); - CheckErrorStatus(PInvoke.GdipFillPie( + CheckErrorStatus(PInvokeGdiPlus.GdipFillPie( NativeGraphics, brush.NativeBrush, x, y, width, height, @@ -1455,7 +1455,7 @@ void FillClosedCurve(Brush brush, params ReadOnlySpan points) fixed (PointF* p = points) { - CheckErrorStatus(PInvoke.GdipFillClosedCurve( + CheckErrorStatus(PInvokeGdiPlus.GdipFillClosedCurve( NativeGraphics, brush.NativeBrush, (GdiPlus.PointF*)p, points.Length)); @@ -1496,7 +1496,7 @@ void FillClosedCurve(Brush brush, ReadOnlySpan points, FillMode fillmode fixed (PointF* p = points) { - CheckErrorStatus(PInvoke.GdipFillClosedCurve2( + CheckErrorStatus(PInvokeGdiPlus.GdipFillClosedCurve2( NativeGraphics, brush.NativeBrush, (GdiPlus.PointF*)p, points.Length, @@ -1523,7 +1523,7 @@ void FillClosedCurve(Brush brush, params ReadOnlySpan points) fixed (Point* p = points) { - CheckErrorStatus(PInvoke.GdipFillClosedCurveI( + CheckErrorStatus(PInvokeGdiPlus.GdipFillClosedCurveI( NativeGraphics, brush.NativeBrush, (GdiPlus.Point*)p, points.Length)); @@ -1559,7 +1559,7 @@ void FillClosedCurve(Brush brush, ReadOnlySpan points, FillMode fillmode, fixed (Point* p = points) { - CheckErrorStatus(PInvoke.GdipFillClosedCurve2I( + CheckErrorStatus(PInvokeGdiPlus.GdipFillClosedCurve2I( NativeGraphics, brush.NativeBrush, (GdiPlus.Point*)p, points.Length, @@ -1742,7 +1742,7 @@ private void DrawStringInternal(ReadOnlySpan s, Font font, Brush brush, Re fixed (char* c = s) { - CheckErrorStatus(PInvoke.GdipDrawString( + CheckErrorStatus(PInvokeGdiPlus.GdipDrawString( NativeGraphics, c, s.Length, font.NativeFont, @@ -1803,7 +1803,7 @@ public SizeF MeasureStringInternal( fixed (int* fitted = &charactersFitted) fixed (int* filled = &linesFilled) { - CheckStatus(PInvoke.GdipMeasureString( + CheckStatus(PInvokeGdiPlus.GdipMeasureString( NativeGraphics, c, text.Length, @@ -1952,7 +1952,7 @@ private Region[] MeasureCharacterRangesInternal( ArgumentNullException.ThrowIfNull(font); int count; - CheckStatus(PInvoke.GdipGetStringFormatMeasurableCharacterRangeCount(stringFormat.Pointer(), &count)); + CheckStatus(PInvokeGdiPlus.GdipGetStringFormatMeasurableCharacterRangeCount(stringFormat.Pointer(), &count)); if (count == 0) { @@ -1971,7 +1971,7 @@ private Region[] MeasureCharacterRangesInternal( fixed (char* c = text) fixed (GpRegion** r = gpRegions) { - CheckStatus(PInvoke.GdipMeasureCharacterRanges( + CheckStatus(PInvokeGdiPlus.GdipMeasureCharacterRanges( NativeGraphics, c, text.Length, @@ -1996,7 +1996,7 @@ private Region[] MeasureCharacterRangesInternal( public void DrawImage(Image image, float x, float y) { ArgumentNullException.ThrowIfNull(image); - Status status = PInvoke.GdipDrawImage(NativeGraphics, image.Pointer(), x, y); + Status status = PInvokeGdiPlus.GdipDrawImage(NativeGraphics, image.Pointer(), x, y); IgnoreMetafileErrors(image, ref status); CheckErrorStatus(status); } @@ -2006,7 +2006,7 @@ public void DrawImage(Image image, float x, float y) public void DrawImage(Image image, float x, float y, float width, float height) { ArgumentNullException.ThrowIfNull(image); - Status status = PInvoke.GdipDrawImageRect(NativeGraphics, image.Pointer(), x, y, width, height); + Status status = PInvokeGdiPlus.GdipDrawImageRect(NativeGraphics, image.Pointer(), x, y, width, height); IgnoreMetafileErrors(image, ref status); CheckErrorStatus(status); } @@ -2061,7 +2061,7 @@ public void DrawImage(Image image, PointF[] destPoints) fixed (PointF* p = destPoints) { - Status status = PInvoke.GdipDrawImagePoints(NativeGraphics, image.Pointer(), (GdiPlus.PointF*)p, count); + Status status = PInvokeGdiPlus.GdipDrawImagePoints(NativeGraphics, image.Pointer(), (GdiPlus.PointF*)p, count); IgnoreMetafileErrors(image, ref status); CheckErrorStatus(status); } @@ -2078,7 +2078,7 @@ public void DrawImage(Image image, Point[] destPoints) fixed (Point* p = destPoints) { - Status status = PInvoke.GdipDrawImagePointsI(NativeGraphics, image.Pointer(), (GdiPlus.Point*)p, count); + Status status = PInvokeGdiPlus.GdipDrawImagePointsI(NativeGraphics, image.Pointer(), (GdiPlus.Point*)p, count); IgnoreMetafileErrors(image, ref status); CheckErrorStatus(status); } @@ -2088,7 +2088,7 @@ public void DrawImage(Image image, float x, float y, RectangleF srcRect, Graphic { ArgumentNullException.ThrowIfNull(image); - Status status = PInvoke.GdipDrawImagePointRect( + Status status = PInvokeGdiPlus.GdipDrawImagePointRect( NativeGraphics, image.Pointer(), x, y, @@ -2106,7 +2106,7 @@ public void DrawImage(Image image, RectangleF destRect, RectangleF srcRect, Grap { ArgumentNullException.ThrowIfNull(image); - Status status = PInvoke.GdipDrawImageRectRect( + Status status = PInvokeGdiPlus.GdipDrawImageRectRect( NativeGraphics, image.Pointer(), destRect.X, destRect.Y, destRect.Width, destRect.Height, @@ -2134,7 +2134,7 @@ public void DrawImage(Image image, PointF[] destPoints, RectangleF srcRect, Grap fixed (PointF* p = destPoints) { - Status status = PInvoke.GdipDrawImagePointsRect( + Status status = PInvokeGdiPlus.GdipDrawImagePointsRect( NativeGraphics, image.Pointer(), (GdiPlus.PointF*)p, destPoints.Length, @@ -2179,7 +2179,7 @@ public void DrawImage( fixed (PointF* p = destPoints) { - Status status = PInvoke.GdipDrawImagePointsRect( + Status status = PInvokeGdiPlus.GdipDrawImagePointsRect( NativeGraphics, image.Pointer(), (GdiPlus.PointF*)p, destPoints.Length, @@ -2232,7 +2232,7 @@ public void DrawImage( fixed (Point* p = destPoints) { - Status status = PInvoke.GdipDrawImagePointsRectI( + Status status = PInvokeGdiPlus.GdipDrawImagePointsRectI( NativeGraphics, image.Pointer(), (GdiPlus.Point*)p, destPoints.Length, @@ -2294,7 +2294,7 @@ public void DrawImage( { ArgumentNullException.ThrowIfNull(image); - Status status = PInvoke.GdipDrawImageRectRect( + Status status = PInvokeGdiPlus.GdipDrawImageRectRect( NativeGraphics, image.Pointer(), destRect.X, destRect.Y, destRect.Width, destRect.Height, @@ -2372,7 +2372,7 @@ void DrawLines(Pen pen, params ReadOnlySpan points) fixed (PointF* p = points) { - CheckErrorStatus(PInvoke.GdipDrawLines(NativeGraphics, pen.NativePen, (GdiPlus.PointF*)p, points.Length)); + CheckErrorStatus(PInvokeGdiPlus.GdipDrawLines(NativeGraphics, pen.NativePen, (GdiPlus.PointF*)p, points.Length)); } GC.KeepAlive(pen); @@ -2401,7 +2401,7 @@ public void DrawLines(Pen pen, params Point[] points) fixed (Point* p = points) { - CheckErrorStatus(PInvoke.GdipDrawLinesI(NativeGraphics, pen.NativePen, (GdiPlus.Point*)p, points.Length)); + CheckErrorStatus(PInvokeGdiPlus.GdipDrawLinesI(NativeGraphics, pen.NativePen, (GdiPlus.Point*)p, points.Length)); } GC.KeepAlive(pen); @@ -2419,7 +2419,7 @@ void DrawLines(Pen pen, params ReadOnlySpan points) fixed (Point* p = points) { - CheckErrorStatus(PInvoke.GdipDrawLinesI(NativeGraphics, pen.NativePen, (GdiPlus.Point*)p, points.Length)); + CheckErrorStatus(PInvokeGdiPlus.GdipDrawLinesI(NativeGraphics, pen.NativePen, (GdiPlus.Point*)p, points.Length)); } GC.KeepAlive(pen); @@ -2596,7 +2596,7 @@ void TransformPoints(Drawing2D.CoordinateSpace destSpace, Drawing2D.CoordinateSp { fixed (PointF* p = pts) { - CheckStatus(PInvoke.GdipTransformPoints( + CheckStatus(PInvokeGdiPlus.GdipTransformPoints( NativeGraphics, (GdiPlus.CoordinateSpace)destSpace, (GdiPlus.CoordinateSpace)srcSpace, @@ -2622,7 +2622,7 @@ void TransformPoints(Drawing2D.CoordinateSpace destSpace, Drawing2D.CoordinateSp { fixed (Point* p = pts) { - CheckStatus(PInvoke.GdipTransformPointsI( + CheckStatus(PInvokeGdiPlus.GdipTransformPointsI( NativeGraphics, (GdiPlus.CoordinateSpace)destSpace, (GdiPlus.CoordinateSpace)srcSpace, @@ -2652,14 +2652,14 @@ private static void IgnoreMetafileErrors(Image image, ref Status errorStatus) internal Region? GetRegionIfNotInfinite() { GpRegion* regionHandle; - CheckStatus(PInvoke.GdipCreateRegion(®ionHandle)); + CheckStatus(PInvokeGdiPlus.GdipCreateRegion(®ionHandle)); try { BOOL isInfinite; - PInvoke.GdipGetClip(NativeGraphics, regionHandle); + PInvokeGdiPlus.GdipGetClip(NativeGraphics, regionHandle); - CheckStatus(PInvokeCore.GdipIsInfiniteRegion( + CheckStatus(PInvokeGdiPlus.GdipIsInfiniteRegion( regionHandle, NativeGraphics, &isInfinite)); @@ -2678,7 +2678,7 @@ private static void IgnoreMetafileErrors(Image image, ref Status errorStatus) { if (regionHandle is not null) { - PInvoke.GdipDeleteRegion(regionHandle); + PInvokeGdiPlus.GdipDeleteRegion(regionHandle); } } } @@ -2769,7 +2769,7 @@ public void CopyFromScreen(int sourceX, int sourceY, int destinationX, int desti public Color GetNearestColor(Color color) { uint nearest = (uint)color.ToArgb(); - CheckStatus(PInvoke.GdipGetNearestColor(NativeGraphics, &nearest)); + CheckStatus(PInvokeGdiPlus.GdipGetNearestColor(NativeGraphics, &nearest)); return Color.FromArgb((int)nearest); } @@ -2779,7 +2779,7 @@ public Color GetNearestColor(Color color) public void DrawLine(Pen pen, float x1, float y1, float x2, float y2) { ArgumentNullException.ThrowIfNull(pen); - CheckErrorStatus(PInvoke.GdipDrawLine(NativeGraphics, pen.NativePen, x1, y1, x2, y2)); + CheckErrorStatus(PInvokeGdiPlus.GdipDrawLine(NativeGraphics, pen.NativePen, x1, y1, x2, y2)); GC.KeepAlive(pen); } @@ -2799,7 +2799,7 @@ void DrawBeziers(Pen pen, params ReadOnlySpan points) fixed (PointF* p = points) { - CheckErrorStatus(PInvoke.GdipDrawBeziers( + CheckErrorStatus(PInvokeGdiPlus.GdipDrawBeziers( NativeGraphics, pen.NativePen, (GdiPlus.PointF*)p, points.Length)); @@ -2830,7 +2830,7 @@ void DrawBeziers(Pen pen, params ReadOnlySpan points) fixed (Point* p = points) { - CheckErrorStatus(PInvoke.GdipDrawBeziersI( + CheckErrorStatus(PInvokeGdiPlus.GdipDrawBeziersI( NativeGraphics, pen.NativePen, (GdiPlus.Point*)p, @@ -2848,7 +2848,7 @@ public void FillPath(Brush brush, GraphicsPath path) ArgumentNullException.ThrowIfNull(brush); ArgumentNullException.ThrowIfNull(path); - CheckErrorStatus(PInvoke.GdipFillPath( + CheckErrorStatus(PInvokeGdiPlus.GdipFillPath( NativeGraphics, brush.NativeBrush, path._nativePath)); @@ -2865,7 +2865,7 @@ public void FillRegion(Brush brush, Region region) ArgumentNullException.ThrowIfNull(brush); ArgumentNullException.ThrowIfNull(region); - CheckErrorStatus(PInvoke.GdipFillRegion( + CheckErrorStatus(PInvokeGdiPlus.GdipFillRegion( NativeGraphics, brush.NativeBrush, region.NativeRegion)); @@ -2942,7 +2942,7 @@ public void EnumerateMetafile( ImageAttributes? imageAttr) { using EnumerateMetafileDataAdapter adapter = new(callback); - PInvoke.GdipEnumerateMetafileDestPoint( + PInvokeGdiPlus.GdipEnumerateMetafileDestPoint( NativeGraphics, metafile.Pointer(), (GdiPlus.PointF*)&destPoint, @@ -2971,7 +2971,7 @@ public void EnumerateMetafile( ImageAttributes? imageAttr) { using EnumerateMetafileDataAdapter adapter = new(callback); - PInvoke.GdipEnumerateMetafileDestRect( + PInvokeGdiPlus.GdipEnumerateMetafileDestRect( NativeGraphics, metafile.Pointer(), (RectF*)&destRect, @@ -3006,7 +3006,7 @@ public void EnumerateMetafile( fixed (PointF* p = destPoints) { using EnumerateMetafileDataAdapter adapter = new(callback); - PInvoke.GdipEnumerateMetafileDestPoints( + PInvokeGdiPlus.GdipEnumerateMetafileDestPoints( NativeGraphics, metafile.Pointer(), (GdiPlus.PointF*)p, destPoints.Length, @@ -3035,7 +3035,7 @@ public void EnumerateMetafile( fixed (Point* p = destPoints) { using EnumerateMetafileDataAdapter adapter = new(callback); - PInvoke.GdipEnumerateMetafileDestPointsI( + PInvokeGdiPlus.GdipEnumerateMetafileDestPointsI( NativeGraphics, metafile.Pointer(), (GdiPlus.Point*)p, destPoints.Length, @@ -3059,7 +3059,7 @@ public void EnumerateMetafile( ImageAttributes? imageAttr) { using EnumerateMetafileDataAdapter adapter = new(callback); - PInvoke.GdipEnumerateMetafileSrcRectDestPoint( + PInvokeGdiPlus.GdipEnumerateMetafileSrcRectDestPoint( NativeGraphics, metafile.Pointer(), (GdiPlus.PointF*)&destPoint, @@ -3100,7 +3100,7 @@ public void EnumerateMetafile( ImageAttributes? imageAttr) { using EnumerateMetafileDataAdapter adapter = new(callback); - PInvoke.GdipEnumerateMetafileSrcRectDestRect( + PInvokeGdiPlus.GdipEnumerateMetafileSrcRectDestRect( NativeGraphics, metafile.Pointer(), (RectF*)&destRect, @@ -3141,7 +3141,7 @@ public void EnumerateMetafile( fixed (PointF* p = destPoints) { using EnumerateMetafileDataAdapter adapter = new(callback); - PInvoke.GdipEnumerateMetafileSrcRectDestPoints( + PInvokeGdiPlus.GdipEnumerateMetafileSrcRectDestPoints( NativeGraphics, metafile.Pointer(), (GdiPlus.PointF*)p, destPoints.Length, @@ -3174,7 +3174,7 @@ public void EnumerateMetafile( fixed (Point* p = destPoints) { using EnumerateMetafileDataAdapter adapter = new(callback); - PInvoke.GdipEnumerateMetafileSrcRectDestPointsI( + PInvokeGdiPlus.GdipEnumerateMetafileSrcRectDestPointsI( NativeGraphics, metafile.Pointer(), (GdiPlus.Point*)p, destPoints.Length, @@ -3306,7 +3306,7 @@ private void GetContextInfo(out Matrix3x2 cumulativeTransform, bool calculateCli applyTransform = applyTransform && !offset.IsEmpty; applyClipping = clipRegion is not null; - using var graphicsRegion = applyClipping ? new RegionScope(clipRegion!, this) : default; + using var graphicsRegion = applyClipping ? clipRegion!.GetRegionScope(this) : default; applyClipping = applyClipping && !graphicsRegion!.Region.IsNull; hdc = (HDC)GetHdc(); @@ -3385,7 +3385,7 @@ public RectangleF VisibleClipBounds return ppGraphics.VisibleClipBounds; RectF rect; - CheckStatus(PInvoke.GdipGetVisibleClipBounds(NativeGraphics, &rect)); + CheckStatus(PInvokeGdiPlus.GdipGetVisibleClipBounds(NativeGraphics, &rect)); return rect; } } @@ -3437,7 +3437,7 @@ public GraphicsState Save() { GraphicsContext context = new(this); uint state; - Status status = PInvoke.GdipSaveGraphics(NativeGraphics, &state); + Status status = PInvokeGdiPlus.GdipSaveGraphics(NativeGraphics, &state); GC.KeepAlive(this); if (status != Status.Ok) @@ -3455,7 +3455,7 @@ public GraphicsState Save() public void Restore(GraphicsState gstate) { - CheckStatus(PInvoke.GdipRestoreGraphics(NativeGraphics, (uint)gstate._nativeState)); + CheckStatus(PInvokeGdiPlus.GdipRestoreGraphics(NativeGraphics, (uint)gstate._nativeState)); PopContext(gstate._nativeState); } @@ -3464,7 +3464,7 @@ public GraphicsContainer BeginContainer(RectangleF dstrect, RectangleF srcrect, GraphicsContext context = new(this); uint state; - Status status = PInvoke.GdipBeginContainer(NativeGraphics, (RectF*)&dstrect, (RectF*)&srcrect, (Unit)unit, &state); + Status status = PInvokeGdiPlus.GdipBeginContainer(NativeGraphics, (RectF*)&dstrect, (RectF*)&srcrect, (Unit)unit, &state); GC.KeepAlive(this); if (status != Status.Ok) @@ -3483,7 +3483,7 @@ public GraphicsContainer BeginContainer() { GraphicsContext context = new(this); uint state; - Status status = PInvoke.GdipBeginContainer2(NativeGraphics, &state); + Status status = PInvokeGdiPlus.GdipBeginContainer2(NativeGraphics, &state); GC.KeepAlive(this); if (status != Status.Ok) @@ -3501,7 +3501,7 @@ public GraphicsContainer BeginContainer() public void EndContainer(GraphicsContainer container) { ArgumentNullException.ThrowIfNull(container); - CheckStatus(PInvoke.GdipEndContainer(NativeGraphics, (uint)container._nativeGraphicsContainer)); + CheckStatus(PInvokeGdiPlus.GdipEndContainer(NativeGraphics, (uint)container._nativeGraphicsContainer)); PopContext(container._nativeGraphicsContainer); } @@ -3513,7 +3513,7 @@ public void AddMetafileComment(byte[] data) ArgumentNullException.ThrowIfNull(data); fixed (byte* b = data) { - CheckStatus(PInvoke.GdipComment(NativeGraphics, (uint)data.Length, b)); + CheckStatus(PInvokeGdiPlus.GdipComment(NativeGraphics, (uint)data.Length, b)); } } @@ -3526,7 +3526,7 @@ public static IntPtr GetHalftonePalette() if (s_halftonePalette.IsNull) { GdiPlusInitialization.EnsureInitialized(); - s_halftonePalette = PInvokeCore.GdipCreateHalftonePalette(); + s_halftonePalette = PInvokeGdiPlus.GdipCreateHalftonePalette(); } } } @@ -3598,7 +3598,7 @@ public void DrawCachedBitmap(CachedBitmap cachedBitmap, int x, int y) { ArgumentNullException.ThrowIfNull(cachedBitmap); - CheckStatus(PInvoke.GdipDrawCachedBitmap( + CheckStatus(PInvokeGdiPlus.GdipDrawCachedBitmap( NativeGraphics, (GpCachedBitmap*)cachedBitmap.Handle, x, y)); @@ -3630,7 +3630,7 @@ public void DrawImage( GraphicsUnit srcUnit = GraphicsUnit.Pixel, ImageAttributes? imageAttr = default) { - PInvoke.GdipDrawImageFX( + PInvokeGdiPlus.GdipDrawImageFX( NativeGraphics, image.Pointer(), srcRect.IsEmpty ? null : (RectF*)&srcRect, diff --git a/src/System.Drawing.Common/src/System/Drawing/Icon.cs b/src/System.Drawing.Common/src/System/Drawing/Icon.cs index 57ea0b4e70e..0430d26edb1 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Icon.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Icon.cs @@ -7,7 +7,6 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; -using Windows.Win32.System.Ole; namespace System.Drawing; @@ -804,7 +803,7 @@ public unsafe void Save(Stream outputStream) // converting them to DIBS and saving them into the file. But, in the interest of simplicity, we just // call to OLE to do it for us. - using var iPicture = IPicture.CreateFromIcon(this, copy: false); + using var iPicture = this.CreateIPicture(copy: false); using var iStream = outputStream.ToIStream(makeSeekable: true); iPicture.Value->SaveAsFile(iStream, (BOOL)(-1), pCbSize: null).ThrowOnFailure(); } diff --git a/src/System.Drawing.Common/src/System/Drawing/Image.cs b/src/System.Drawing.Common/src/System/Drawing/Image.cs index 4a1b8349138..ff5d498b14f 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Image.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Image.cs @@ -103,11 +103,11 @@ public static Image FromFile(string filename, bool useEmbeddedColorManagement) { if (useEmbeddedColorManagement) { - PInvoke.GdipLoadImageFromFileICM(fn, &image).ThrowIfFailed(); + PInvokeGdiPlus.GdipLoadImageFromFileICM(fn, &image).ThrowIfFailed(); } else { - PInvoke.GdipLoadImageFromFile(fn, &image).ThrowIfFailed(); + PInvokeGdiPlus.GdipLoadImageFromFile(fn, &image).ThrowIfFailed(); } } @@ -148,7 +148,7 @@ public static Image FromStream(Stream stream, bool useEmbeddedColorManagement, b ValidateImage(image); _nativeImage = image; GdiPlus.ImageType type = default; - PInvoke.GdipGetImageType(_nativeImage, &type).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetImageType(_nativeImage, &type).ThrowIfFailed(); GetAnimatedGifRawData(this, filename: null, stream); return image; } @@ -165,11 +165,11 @@ public static Image FromStream(Stream stream, bool useEmbeddedColorManagement, b if (useEmbeddedColorManagement) { - PInvoke.GdipLoadImageFromStreamICM(stream, &image).ThrowIfFailed(); + PInvokeGdiPlus.GdipLoadImageFromStreamICM(stream, &image).ThrowIfFailed(); } else { - PInvoke.GdipLoadImageFromStream(stream, &image).ThrowIfFailed(); + PInvokeGdiPlus.GdipLoadImageFromStream(stream, &image).ThrowIfFailed(); } return image; @@ -197,7 +197,7 @@ public void Dispose() public object Clone() { GpImage* cloneImage; - PInvoke.GdipCloneImage(_nativeImage, &cloneImage).ThrowIfFailed(); + PInvokeGdiPlus.GdipCloneImage(_nativeImage, &cloneImage).ThrowIfFailed(); ValidateImage(cloneImage); GC.KeepAlive(this); return CreateImageObject(cloneImage); @@ -210,7 +210,7 @@ protected virtual void Dispose(bool disposing) return; } - Status status = !Gdip.Initialized ? Status.Ok : PInvoke.GdipDisposeImage(_nativeImage); + Status status = !Gdip.Initialized ? Status.Ok : PInvokeGdiPlus.GdipDisposeImage(_nativeImage); _nativeImage = null; Debug.Assert(status == Status.Ok, $"GDI+ returned an error status: {status}"); } @@ -230,7 +230,7 @@ public void Save(string filename, ImageFormat format) Guid encoder = format.Encoder; if (encoder == Guid.Empty) { - encoder = ImageCodecInfoHelper.GetEncoderClsid(PInvokeCore.ImageFormatPNG); + encoder = ImageCodecInfoHelper.GetEncoderClsid(PInvokeGdiPlus.ImageFormatPNG); } Save(filename, encoder, null); @@ -272,7 +272,7 @@ private void Save(string filename, Guid encoder, Imaging.EncoderParameters? enco fixed (char* fn = filename) { - PInvoke.GdipSaveImageToFile(_nativeImage, fn, &encoder, nativeParameters).ThrowIfFailed(); + PInvokeGdiPlus.GdipSaveImageToFile(_nativeImage, fn, &encoder, nativeParameters).ThrowIfFailed(); } } finally @@ -343,7 +343,7 @@ public void SaveAdd(Imaging.EncoderParameters? encoderParams) try { - PInvoke.GdipSaveAdd(_nativeImage, nativeParameters).ThrowIfFailed(); + PInvokeGdiPlus.GdipSaveAdd(_nativeImage, nativeParameters).ThrowIfFailed(); } finally { @@ -375,7 +375,7 @@ public void SaveAdd(Image image, Imaging.EncoderParameters? encoderParams) try { - PInvoke.GdipSaveAddImage(_nativeImage, image._nativeImage, nativeParameters).ThrowIfFailed(); + PInvokeGdiPlus.GdipSaveAddImage(_nativeImage, image._nativeImage, nativeParameters).ThrowIfFailed(); } finally { @@ -409,7 +409,7 @@ public SizeF PhysicalDimension float width; float height; - PInvoke.GdipGetImageDimension(_nativeImage, &width, &height).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetImageDimension(_nativeImage, &width, &height).ThrowIfFailed(); GC.KeepAlive(this); return new SizeF(width, height); } @@ -431,7 +431,7 @@ public int Width get { uint width; - PInvoke.GdipGetImageWidth(_nativeImage, &width).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetImageWidth(_nativeImage, &width).ThrowIfFailed(); GC.KeepAlive(this); return (int)width; } @@ -448,7 +448,7 @@ public int Height get { uint height; - PInvoke.GdipGetImageHeight(_nativeImage, &height).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetImageHeight(_nativeImage, &height).ThrowIfFailed(); GC.KeepAlive(this); return (int)height; } @@ -462,7 +462,7 @@ public float HorizontalResolution get { float horzRes; - PInvoke.GdipGetImageHorizontalResolution(_nativeImage, &horzRes).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetImageHorizontalResolution(_nativeImage, &horzRes).ThrowIfFailed(); GC.KeepAlive(this); return horzRes; } @@ -476,7 +476,7 @@ public float VerticalResolution get { float vertRes; - PInvoke.GdipGetImageVerticalResolution(_nativeImage, &vertRes).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetImageVerticalResolution(_nativeImage, &vertRes).ThrowIfFailed(); GC.KeepAlive(this); return vertRes; } @@ -491,7 +491,7 @@ public int Flags get { uint flags; - PInvoke.GdipGetImageFlags(_nativeImage, &flags).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetImageFlags(_nativeImage, &flags).ThrowIfFailed(); GC.KeepAlive(this); return (int)flags; } @@ -505,7 +505,7 @@ public ImageFormat RawFormat get { Guid guid = default; - PInvoke.GdipGetImageRawFormat(_nativeImage, &guid).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetImageRawFormat(_nativeImage, &guid).ThrowIfFailed(); GC.KeepAlive(this); return new ImageFormat(guid); } @@ -525,7 +525,7 @@ public int[] PropertyIdList get { uint count; - PInvoke.GdipGetPropertyCount(_nativeImage, &count).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPropertyCount(_nativeImage, &count).ThrowIfFailed(); if (count == 0) { return []; @@ -534,7 +534,7 @@ public int[] PropertyIdList int[] propid = new int[count]; fixed (int* pPropid = propid) { - PInvoke.GdipGetPropertyIdList(_nativeImage, count, (uint*)pPropid).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPropertyIdList(_nativeImage, count, (uint*)pPropid).ThrowIfFailed(); } GC.KeepAlive(this); @@ -551,7 +551,7 @@ public Imaging.PropertyItem[] PropertyItems get { uint size, count; - PInvoke.GdipGetPropertySize(_nativeImage, &size, &count).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPropertySize(_nativeImage, &size, &count).ThrowIfFailed(); if (size == 0 || count == 0) { @@ -563,7 +563,7 @@ public Imaging.PropertyItem[] PropertyItems fixed (byte* b = buffer) { GdiPlus.PropertyItem* properties = (GdiPlus.PropertyItem*)b; - PInvoke.GdipGetAllPropertyItems(_nativeImage, size, count, properties); + PInvokeGdiPlus.GdipGetAllPropertyItems(_nativeImage, size, count, properties); for (int i = 0; i < count; i++) { @@ -599,12 +599,12 @@ public ColorPalette Palette // sizeof(ColorPalette) + (pal->Count-1)*sizeof(ARGB) int size; - PInvoke.GdipGetImagePaletteSize(_nativeImage, &size).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetImagePaletteSize(_nativeImage, &size).ThrowIfFailed(); using BufferScope buffer = new(size / sizeof(uint)); fixed (uint* b = buffer) { - PInvoke.GdipGetImagePalette(_nativeImage, (GdiPlus.ColorPalette*)b, size).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetImagePalette(_nativeImage, (GdiPlus.ColorPalette*)b, size).ThrowIfFailed(); GC.KeepAlive(this); return ColorPalette.ConvertFromBuffer(buffer); } @@ -614,7 +614,7 @@ public ColorPalette Palette using BufferScope buffer = value.ConvertToBuffer(); fixed (uint* b = buffer) { - PInvoke.GdipSetImagePalette(_nativeImage, (GdiPlus.ColorPalette*)b).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetImagePalette(_nativeImage, (GdiPlus.ColorPalette*)b).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -631,7 +631,7 @@ public Image GetThumbnailImage(int thumbWidth, int thumbHeight, GetThumbnailImag // GDI+ had to ignore the callback as System.Drawing didn't define it correctly so it was eventually removed // completely in Windows 7. As such, we don't need to pass it to GDI+. - PInvoke.GdipGetImageThumbnail( + PInvokeGdiPlus.GdipGetImageThumbnail( this.Pointer(), (uint)thumbWidth, (uint)thumbHeight, @@ -647,11 +647,11 @@ internal static void ValidateImage(GpImage* image) { try { - PInvoke.GdipImageForceValidation(image).ThrowIfFailed(); + PInvokeGdiPlus.GdipImageForceValidation(image).ThrowIfFailed(); } catch { - PInvoke.GdipDisposeImage(image); + PInvokeGdiPlus.GdipDisposeImage(image); throw; } } @@ -663,7 +663,7 @@ public int GetFrameCount(FrameDimension dimension) { Guid dimensionID = dimension.Guid; uint count; - PInvoke.GdipImageGetFrameCount(_nativeImage, &dimensionID, &count).ThrowIfFailed(); + PInvokeGdiPlus.GdipImageGetFrameCount(_nativeImage, &dimensionID, &count).ThrowIfFailed(); GC.KeepAlive(this); return (int)count; } @@ -674,7 +674,7 @@ public int GetFrameCount(FrameDimension dimension) public Imaging.PropertyItem? GetPropertyItem(int propid) { uint size; - PInvoke.GdipGetPropertyItemSize(_nativeImage, (uint)propid, &size).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPropertyItemSize(_nativeImage, (uint)propid, &size).ThrowIfFailed(); if (size == 0) { @@ -685,7 +685,7 @@ public int GetFrameCount(FrameDimension dimension) fixed (byte* b = buffer) { GdiPlus.PropertyItem* property = (GdiPlus.PropertyItem*)b; - PInvoke.GdipGetPropertyItem(_nativeImage, (uint)propid, size, property).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPropertyItem(_nativeImage, (uint)propid, size, property).ThrowIfFailed(); GC.KeepAlive(this); return Imaging.PropertyItem.FromNative(property); } @@ -697,7 +697,7 @@ public int GetFrameCount(FrameDimension dimension) public int SelectActiveFrame(FrameDimension dimension, int frameIndex) { Guid dimensionID = dimension.Guid; - PInvoke.GdipImageSelectActiveFrame(_nativeImage, &dimensionID, (uint)frameIndex).ThrowIfFailed(); + PInvokeGdiPlus.GdipImageSelectActiveFrame(_nativeImage, &dimensionID, (uint)frameIndex).ThrowIfFailed(); GC.KeepAlive(this); return 0; } @@ -717,14 +717,14 @@ public unsafe void SetPropertyItem(Imaging.PropertyItem propitem) value = propItemValue }; - PInvoke.GdipSetPropertyItem(_nativeImage, &native).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPropertyItem(_nativeImage, &native).ThrowIfFailed(); GC.KeepAlive(this); } } public void RotateFlip(RotateFlipType rotateFlipType) { - PInvoke.GdipImageRotateFlip(_nativeImage, (GdiPlus.RotateFlipType)rotateFlipType).ThrowIfFailed(); + PInvokeGdiPlus.GdipImageRotateFlip(_nativeImage, (GdiPlus.RotateFlipType)rotateFlipType).ThrowIfFailed(); GC.KeepAlive(this); } @@ -733,7 +733,7 @@ public void RotateFlip(RotateFlipType rotateFlipType) /// public void RemovePropertyItem(int propid) { - PInvoke.GdipRemovePropertyItem(_nativeImage, (uint)propid).ThrowIfFailed(); + PInvokeGdiPlus.GdipRemovePropertyItem(_nativeImage, (uint)propid).ThrowIfFailed(); GC.KeepAlive(this); } @@ -745,7 +745,7 @@ public void RemovePropertyItem(int propid) Imaging.EncoderParameters parameters; uint size; - PInvoke.GdipGetEncoderParameterListSize(_nativeImage, &encoder, &size).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetEncoderParameterListSize(_nativeImage, &encoder, &size).ThrowIfFailed(); if (size <= 0) { @@ -755,7 +755,7 @@ public void RemovePropertyItem(int propid) using BufferScope buffer = new((int)size); fixed (byte* b = buffer) { - PInvoke.GdipGetEncoderParameterList( + PInvokeGdiPlus.GdipGetEncoderParameterList( _nativeImage, &encoder, size, @@ -779,7 +779,7 @@ public void RemovePropertyItem(int propid) public static Bitmap FromHbitmap(IntPtr hbitmap, IntPtr hpalette) { GpBitmap* bitmap; - PInvoke.GdipCreateBitmapFromHBITMAP((HBITMAP)hbitmap, (HPALETTE)hpalette, &bitmap).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreateBitmapFromHBITMAP((HBITMAP)hbitmap, (HPALETTE)hpalette, &bitmap).ThrowIfFailed(); return new Bitmap(bitmap); } @@ -822,7 +822,7 @@ public unsafe Guid[] FrameDimensionsList get { uint count; - PInvoke.GdipImageGetFrameDimensionsCount(_nativeImage, &count).ThrowIfFailed(); + PInvokeGdiPlus.GdipImageGetFrameDimensionsCount(_nativeImage, &count).ThrowIfFailed(); Debug.Assert(count >= 0, "FrameDimensionsList returns bad count"); if (count <= 0) @@ -833,7 +833,7 @@ public unsafe Guid[] FrameDimensionsList Guid[] guids = new Guid[count]; fixed (Guid* g = guids) { - PInvoke.GdipImageGetFrameDimensionsList(_nativeImage, g, count).ThrowIfFailed(); + PInvokeGdiPlus.GdipImageGetFrameDimensionsList(_nativeImage, g, count).ThrowIfFailed(); } GC.KeepAlive(this); @@ -854,7 +854,7 @@ public unsafe Guid[] FrameDimensionsList internal static Image CreateImageObject(GpImage* nativeImage) { GdiPlus.ImageType imageType = default; - PInvoke.GdipGetImageType(nativeImage, &imageType); + PInvokeGdiPlus.GdipGetImageType(nativeImage, &imageType); return imageType switch { GdiPlus.ImageType.ImageTypeBitmap => new Bitmap((GpBitmap*)nativeImage), @@ -877,7 +877,7 @@ internal static unsafe void GetAnimatedGifRawData(Image image, string? filename, bool animatedGif = false; uint dimensions; - PInvoke.GdipImageGetFrameDimensionsCount(image._nativeImage, &dimensions).ThrowIfFailed(); + PInvokeGdiPlus.GdipImageGetFrameDimensionsCount(image._nativeImage, &dimensions).ThrowIfFailed(); if (dimensions <= 0) { return; @@ -887,7 +887,7 @@ internal static unsafe void GetAnimatedGifRawData(Image image, string? filename, fixed (Guid* g = guids) { - PInvoke.GdipImageGetFrameDimensionsList(image._nativeImage, g, dimensions).ThrowIfFailed(); + PInvokeGdiPlus.GdipImageGetFrameDimensionsList(image._nativeImage, g, dimensions).ThrowIfFailed(); } Guid timeGuid = FrameDimension.Time.Guid; diff --git a/src/System.Drawing.Common/src/System/Drawing/Imaging/CachedBitmap.cs b/src/System.Drawing.Common/src/System/Drawing/Imaging/CachedBitmap.cs index 160e5eff85f..e7fba814f79 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Imaging/CachedBitmap.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Imaging/CachedBitmap.cs @@ -46,7 +46,7 @@ public CachedBitmap(Bitmap bitmap, Graphics graphics) ArgumentNullException.ThrowIfNull(graphics); GpCachedBitmap* cachedBitmap; - PInvoke.GdipCreateCachedBitmap( + PInvokeGdiPlus.GdipCreateCachedBitmap( bitmap.Pointer(), graphics.Pointer(), &cachedBitmap); @@ -63,7 +63,7 @@ private void Dispose(bool disposing) return; } - Status status = PInvoke.GdipDeleteCachedBitmap((GpCachedBitmap*)handle); + Status status = PInvokeGdiPlus.GdipDeleteCachedBitmap((GpCachedBitmap*)handle); if (disposing) { // Don't want to throw on the finalizer thread. diff --git a/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorPalette.cs b/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorPalette.cs index 3cedf01c095..c02303d8a77 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorPalette.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorPalette.cs @@ -103,7 +103,7 @@ internal static ColorPalette InitializePalette( buffer[1] = 256; fixed (void* b = buffer) { - PInvoke.GdipInitializePalette( + PInvokeGdiPlus.GdipInitializePalette( (GdiPlus.ColorPalette*)b, (GdiPlus.PaletteType)fixedPaletteType, colorCount, diff --git a/src/System.Drawing.Common/src/System/Drawing/Imaging/Effects/ColorMatrixEffect.cs b/src/System.Drawing.Common/src/System/Drawing/Imaging/Effects/ColorMatrixEffect.cs index 3366db84678..29e795fc592 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Imaging/Effects/ColorMatrixEffect.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Imaging/Effects/ColorMatrixEffect.cs @@ -26,7 +26,7 @@ public ColorMatrixEffect(ColorMatrix matrix) : base(PInvoke.ColorMatrixEffectGui { fixed (float* p = &matrix.GetPinnableReference()) { - PInvoke.GdipSetEffectParameters(NativeEffect, p, (uint)sizeof(GdiPlus.ColorMatrix)).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetEffectParameters(NativeEffect, p, (uint)sizeof(GdiPlus.ColorMatrix)).ThrowIfFailed(); GC.KeepAlive(this); } diff --git a/src/System.Drawing.Common/src/System/Drawing/Imaging/Effects/Effect.cs b/src/System.Drawing.Common/src/System/Drawing/Imaging/Effects/Effect.cs index a80aff67366..9e9d5b3d257 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Imaging/Effects/Effect.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Imaging/Effects/Effect.cs @@ -17,7 +17,7 @@ public abstract unsafe class Effect : IDisposable private protected Effect(Guid guid) { CGpEffect* nativeEffect; - PInvoke.GdipCreateEffect(guid, &nativeEffect).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreateEffect(guid, &nativeEffect).ThrowIfFailed(); _nativeEffect = nativeEffect; } @@ -31,7 +31,7 @@ private protected void SetParameters(ref T parameters) where T : unmanaged { fixed (T* p = ¶meters) { - PInvoke.GdipSetEffectParameters(NativeEffect, p, (uint)sizeof(T)).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetEffectParameters(NativeEffect, p, (uint)sizeof(T)).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -45,7 +45,7 @@ protected virtual void Dispose(bool disposing) { if (_nativeEffect is not null) { - PInvoke.GdipDeleteEffect(_nativeEffect); + PInvokeGdiPlus.GdipDeleteEffect(_nativeEffect); _nativeEffect = null; } } diff --git a/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageAttributes.cs b/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageAttributes.cs index 755e2540b69..6baedc00592 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageAttributes.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageAttributes.cs @@ -55,7 +55,7 @@ public ImageAttributes() { GpImageAttributes* newImageAttributes; - PInvoke.GdipCreateImageAttributes(&newImageAttributes).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreateImageAttributes(&newImageAttributes).ThrowIfFailed(); SetNativeImageAttributes(newImageAttributes); } @@ -72,7 +72,7 @@ public void Dispose() return; } - Status status = !Gdip.Initialized ? Status.Ok : PInvoke.GdipDisposeImageAttributes(_nativeImageAttributes); + Status status = !Gdip.Initialized ? Status.Ok : PInvokeGdiPlus.GdipDisposeImageAttributes(_nativeImageAttributes); _nativeImageAttributes = null; Debug.Assert(status == Status.Ok, $"GDI+ returned an error status: {status}"); GC.SuppressFinalize(this); @@ -89,7 +89,7 @@ public void Dispose() public object Clone() { GpImageAttributes* clone; - PInvoke.GdipCloneImageAttributes(_nativeImageAttributes, &clone).ThrowIfFailed(); + PInvokeGdiPlus.GdipCloneImageAttributes(_nativeImageAttributes, &clone).ThrowIfFailed(); GC.KeepAlive(this); return new ImageAttributes(clone); @@ -123,7 +123,7 @@ public void SetColorMatrix(ColorMatrix newColorMatrix, ColorMatrixFlag mode, Col /// public void ClearColorMatrix(ColorAdjustType type) { - PInvoke.GdipSetImageAttributesColorMatrix( + PInvokeGdiPlus.GdipSetImageAttributesColorMatrix( _nativeImageAttributes, (GdiPlus.ColorAdjustType)type, false, @@ -156,7 +156,7 @@ public void SetColorMatrices( fixed (void* cm = &newColorMatrix.GetPinnableReference()) fixed (void* gm = &grayMatrix.GetPinnableReference()) { - PInvoke.GdipSetImageAttributesColorMatrix( + PInvokeGdiPlus.GdipSetImageAttributesColorMatrix( _nativeImageAttributes, (GdiPlus.ColorAdjustType)type, enableFlag: true, @@ -169,7 +169,7 @@ public void SetColorMatrices( { fixed (void* cm = &newColorMatrix.GetPinnableReference()) { - PInvoke.GdipSetImageAttributesColorMatrix( + PInvokeGdiPlus.GdipSetImageAttributesColorMatrix( _nativeImageAttributes, (GdiPlus.ColorAdjustType)type, enableFlag: true, @@ -192,7 +192,7 @@ public void SetColorMatrices( private void SetThreshold(float threshold, ColorAdjustType type, bool enableFlag) { - PInvoke.GdipSetImageAttributesThreshold( + PInvokeGdiPlus.GdipSetImageAttributesThreshold( _nativeImageAttributes, (GdiPlus.ColorAdjustType)type, enableFlag, @@ -211,7 +211,7 @@ private void SetThreshold(float threshold, ColorAdjustType type, bool enableFlag private void SetGamma(float gamma, ColorAdjustType type, bool enableFlag) { - PInvoke.GdipSetImageAttributesGamma( + PInvokeGdiPlus.GdipSetImageAttributesGamma( _nativeImageAttributes, (GdiPlus.ColorAdjustType)type, enableFlag, @@ -230,7 +230,7 @@ private void SetGamma(float gamma, ColorAdjustType type, bool enableFlag) private void SetNoOp(ColorAdjustType type, bool enableFlag) { - PInvoke.GdipSetImageAttributesNoOp( + PInvokeGdiPlus.GdipSetImageAttributesNoOp( _nativeImageAttributes, (GdiPlus.ColorAdjustType)type, enableFlag).ThrowIfFailed(); @@ -250,7 +250,7 @@ public void SetColorKey(Color colorLow, Color colorHigh, ColorAdjustType type) = private void SetColorKey(Color colorLow, Color colorHigh, ColorAdjustType type, bool enableFlag) { - PInvoke.GdipSetImageAttributesColorKeys( + PInvokeGdiPlus.GdipSetImageAttributesColorKeys( _nativeImageAttributes, (GdiPlus.ColorAdjustType)type, enableFlag, @@ -272,7 +272,7 @@ public void ClearOutputChannel(ColorAdjustType type) => private void SetOutputChannel(ColorAdjustType type, ColorChannelFlag flags, bool enableFlag) { - PInvoke.GdipSetImageAttributesOutputChannel( + PInvokeGdiPlus.GdipSetImageAttributesOutputChannel( _nativeImageAttributes, (GdiPlus.ColorAdjustType)type, enableFlag, @@ -291,7 +291,7 @@ public void SetOutputChannelColorProfile(string colorProfileFilename, ColorAdjus fixed (char* n = colorProfileFilename) { - PInvoke.GdipSetImageAttributesOutputChannelColorProfile( + PInvokeGdiPlus.GdipSetImageAttributesOutputChannelColorProfile( _nativeImageAttributes, (GdiPlus.ColorAdjustType)type, enableFlag: true, @@ -305,7 +305,7 @@ public void SetOutputChannelColorProfile(string colorProfileFilename, ColorAdjus public void ClearOutputChannelColorProfile(ColorAdjustType type) { - PInvoke.GdipSetImageAttributesOutputChannel( + PInvokeGdiPlus.GdipSetImageAttributesOutputChannel( _nativeImageAttributes, (GdiPlus.ColorAdjustType)type, false, @@ -367,7 +367,7 @@ void SetRemapTable(ColorAdjustType type, params ReadOnlySpan map) fixed (void* m = buffer) { - PInvoke.GdipSetImageAttributesRemapTable( + PInvokeGdiPlus.GdipSetImageAttributesRemapTable( _nativeImageAttributes, (GdiPlus.ColorAdjustType)type, enableFlag: true, @@ -392,7 +392,7 @@ public void SetRemapTable(ColorAdjustType type, params ReadOnlySpan<(Color OldCo fixed (void* m = buffer) { - PInvoke.GdipSetImageAttributesRemapTable( + PInvokeGdiPlus.GdipSetImageAttributesRemapTable( _nativeImageAttributes, (GdiPlus.ColorAdjustType)type, enableFlag: true, @@ -414,7 +414,7 @@ private struct StackBuffer public void ClearRemapTable(ColorAdjustType type) { - PInvoke.GdipSetImageAttributesRemapTable( + PInvokeGdiPlus.GdipSetImageAttributesRemapTable( _nativeImageAttributes, (GdiPlus.ColorAdjustType)type, enableFlag: false, @@ -442,7 +442,7 @@ public void ClearRemapTable(ColorAdjustType type) public void SetWrapMode(Drawing2D.WrapMode mode, Color color, bool clamp) { - PInvoke.GdipSetImageAttributesWrapMode( + PInvokeGdiPlus.GdipSetImageAttributesWrapMode( _nativeImageAttributes, (WrapMode)mode, (uint)color.ToArgb(), @@ -456,7 +456,7 @@ public void GetAdjustedPalette(ColorPalette palette, ColorAdjustType type) using var buffer = palette.ConvertToBuffer(); fixed (void* p = buffer) { - PInvoke.GdipGetImageAttributesAdjustedPalette( + PInvokeGdiPlus.GdipGetImageAttributesAdjustedPalette( _nativeImageAttributes, (GdiPlus.ColorPalette*)p, (GdiPlus.ColorAdjustType)type).ThrowIfFailed(); diff --git a/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageCodecInfo.cs b/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageCodecInfo.cs index ab81457c57b..9fbeea3d0d0 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageCodecInfo.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageCodecInfo.cs @@ -44,13 +44,13 @@ public static ImageCodecInfo[] GetImageDecoders() uint numDecoders; uint size; - PInvoke.GdipGetImageDecodersSize(&numDecoders, &size).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetImageDecodersSize(&numDecoders, &size).ThrowIfFailed(); using BufferScope buffer = new((int)size); fixed (byte* b = buffer) { - PInvoke.GdipGetImageDecoders(numDecoders, size, (GdiPlus.ImageCodecInfo*)b).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetImageDecoders(numDecoders, size, (GdiPlus.ImageCodecInfo*)b).ThrowIfFailed(); imageCodecs = FromNative(new((GdiPlus.ImageCodecInfo*)b, (int)numDecoders)); } @@ -65,13 +65,13 @@ public static ImageCodecInfo[] GetImageEncoders() uint numEncoders; uint size; - PInvokeCore.GdipGetImageEncodersSize(&numEncoders, &size).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetImageEncodersSize(&numEncoders, &size).ThrowIfFailed(); using BufferScope buffer = new((int)size); fixed (byte* b = buffer) { - PInvokeCore.GdipGetImageEncoders(numEncoders, size, (GdiPlus.ImageCodecInfo*)b).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetImageEncoders(numEncoders, size, (GdiPlus.ImageCodecInfo*)b).ThrowIfFailed(); imageCodecs = FromNative(new((GdiPlus.ImageCodecInfo*)b, (int)numEncoders)); } diff --git a/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageFormat.cs b/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageFormat.cs index 47248ce689e..a8f00179769 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageFormat.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageFormat.cs @@ -14,18 +14,18 @@ public sealed class ImageFormat { // Format IDs // private static ImageFormat undefined = new ImageFormat(new Guid("{b96b3ca9-0728-11d3-9d7b-0000f81ef32e}")); - private static readonly ImageFormat s_memoryBMP = new(PInvokeCore.ImageFormatMemoryBMP); - private static readonly ImageFormat s_bmp = new(PInvokeCore.ImageFormatBMP); - private static readonly ImageFormat s_emf = new(PInvokeCore.ImageFormatEMF); - private static readonly ImageFormat s_wmf = new(PInvokeCore.ImageFormatWMF); - private static readonly ImageFormat s_jpeg = new(PInvokeCore.ImageFormatJPEG); - private static readonly ImageFormat s_png = new(PInvokeCore.ImageFormatPNG); - private static readonly ImageFormat s_gif = new(PInvokeCore.ImageFormatGIF); - private static readonly ImageFormat s_tiff = new(PInvokeCore.ImageFormatTIFF); - private static readonly ImageFormat s_exif = new(PInvokeCore.ImageFormatEXIF); - private static readonly ImageFormat s_icon = new(PInvokeCore.ImageFormatIcon); - private static readonly ImageFormat s_heif = new(PInvokeCore.ImageFormatHEIF); - private static readonly ImageFormat s_webp = new(PInvokeCore.ImageFormatWEBP); + private static readonly ImageFormat s_memoryBMP = new(PInvokeGdiPlus.ImageFormatMemoryBMP); + private static readonly ImageFormat s_bmp = new(PInvokeGdiPlus.ImageFormatBMP); + private static readonly ImageFormat s_emf = new(PInvokeGdiPlus.ImageFormatEMF); + private static readonly ImageFormat s_wmf = new(PInvokeGdiPlus.ImageFormatWMF); + private static readonly ImageFormat s_jpeg = new(PInvokeGdiPlus.ImageFormatJPEG); + private static readonly ImageFormat s_png = new(PInvokeGdiPlus.ImageFormatPNG); + private static readonly ImageFormat s_gif = new(PInvokeGdiPlus.ImageFormatGIF); + private static readonly ImageFormat s_tiff = new(PInvokeGdiPlus.ImageFormatTIFF); + private static readonly ImageFormat s_exif = new(PInvokeGdiPlus.ImageFormatEXIF); + private static readonly ImageFormat s_icon = new(PInvokeGdiPlus.ImageFormatIcon); + private static readonly ImageFormat s_heif = new(PInvokeGdiPlus.ImageFormatHEIF); + private static readonly ImageFormat s_webp = new(PInvokeGdiPlus.ImageFormatWEBP); private readonly Guid _guid; @@ -128,62 +128,62 @@ public sealed class ImageFormat /// public override string ToString() { - if (Guid == PInvokeCore.ImageFormatMemoryBMP) + if (Guid == PInvokeGdiPlus.ImageFormatMemoryBMP) { return "MemoryBMP"; } - if (Guid == PInvokeCore.ImageFormatBMP) + if (Guid == PInvokeGdiPlus.ImageFormatBMP) { return "Bmp"; } - if (Guid == PInvokeCore.ImageFormatEMF) + if (Guid == PInvokeGdiPlus.ImageFormatEMF) { return "Emf"; } - if (Guid == PInvokeCore.ImageFormatWMF) + if (Guid == PInvokeGdiPlus.ImageFormatWMF) { return "Wmf"; } - if (Guid == PInvokeCore.ImageFormatGIF) + if (Guid == PInvokeGdiPlus.ImageFormatGIF) { return "Gif"; } - if (Guid == PInvokeCore.ImageFormatJPEG) + if (Guid == PInvokeGdiPlus.ImageFormatJPEG) { return "Jpeg"; } - if (Guid == PInvokeCore.ImageFormatPNG) + if (Guid == PInvokeGdiPlus.ImageFormatPNG) { return "Png"; } - if (Guid == PInvokeCore.ImageFormatTIFF) + if (Guid == PInvokeGdiPlus.ImageFormatTIFF) { return "Tiff"; } - if (Guid == PInvokeCore.ImageFormatEXIF) + if (Guid == PInvokeGdiPlus.ImageFormatEXIF) { return "Exif"; } - if (Guid == PInvokeCore.ImageFormatIcon) + if (Guid == PInvokeGdiPlus.ImageFormatIcon) { return "Icon"; } - if (Guid == PInvokeCore.ImageFormatHEIF) + if (Guid == PInvokeGdiPlus.ImageFormatHEIF) { return "Heif"; } - if (Guid == PInvokeCore.ImageFormatWEBP) + if (Guid == PInvokeGdiPlus.ImageFormatWEBP) { return "Webp"; } diff --git a/src/System.Drawing.Common/src/System/Drawing/Imaging/Metafile.cs b/src/System.Drawing.Common/src/System/Drawing/Imaging/Metafile.cs index 03d895b1f95..e0672c3ca6f 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Imaging/Metafile.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Imaging/Metafile.cs @@ -32,7 +32,7 @@ public Metafile(IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader, bool deleteW fixed (GdiPlus.WmfPlaceableFileHeader* header = &wmfHeader._header) { GpMetafile* metafile; - PInvoke.GdipCreateMetafileFromWmf( + PInvokeGdiPlus.GdipCreateMetafileFromWmf( (HMETAFILE)hmetafile, deleteWmf, header, @@ -49,7 +49,7 @@ public Metafile(IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader, bool deleteW public Metafile(IntPtr henhmetafile, bool deleteEmf) { GpMetafile* metafile; - PInvoke.GdipCreateMetafileFromEmf((HENHMETAFILE)henhmetafile, deleteEmf, &metafile).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreateMetafileFromEmf((HENHMETAFILE)henhmetafile, deleteEmf, &metafile).ThrowIfFailed(); SetNativeImage((GpImage*)metafile); } @@ -63,7 +63,7 @@ public Metafile(string filename) fixed (char* fn = filename) { GpMetafile* metafile; - PInvoke.GdipCreateMetafileFromFile(fn, &metafile).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreateMetafileFromFile(fn, &metafile).ThrowIfFailed(); SetNativeImage((GpImage*)metafile); } } @@ -123,7 +123,7 @@ public Metafile(IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit fra GpMetafile* metafile; fixed (char* d = description) { - PInvoke.GdipRecordMetafile( + PInvokeGdiPlus.GdipRecordMetafile( (HDC)referenceHdc, (GdiPlus.EmfType)type, &rect, @@ -218,7 +218,7 @@ public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect, Meta fixed (char* f = fileName) fixed (char* d = description) { - PInvoke.GdipRecordMetafileFileName( + PInvokeGdiPlus.GdipRecordMetafileFileName( f, (HDC)referenceHdc, (GdiPlus.EmfType)type, @@ -345,7 +345,7 @@ public unsafe Metafile(Stream stream) using var iStream = stream.ToIStream(makeSeekable: true); GpMetafile* metafile = null; - PInvoke.GdipCreateMetafileFromStream(iStream, &metafile).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreateMetafileFromStream(iStream, &metafile).ThrowIfFailed(); SetNativeImage((GpImage*)metafile); } @@ -357,7 +357,7 @@ public Metafile(IntPtr referenceHdc, EmfType emfType, string? description) GpMetafile* metafile; fixed (char* d = description) { - PInvoke.GdipRecordMetafile( + PInvokeGdiPlus.GdipRecordMetafile( (HDC)referenceHdc, (GdiPlus.EmfType)emfType, null, @@ -381,7 +381,7 @@ public Metafile(IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit fram fixed (char* d = desc) { - PInvoke.GdipRecordMetafile( + PInvokeGdiPlus.GdipRecordMetafile( (HDC)referenceHdc, (GdiPlus.EmfType)type, frameRect.IsEmpty ? null : &rect, @@ -405,7 +405,7 @@ public Metafile(string fileName, IntPtr referenceHdc, EmfType type, string? desc fixed (char* f = fileName) fixed (char* d = description) { - PInvoke.GdipRecordMetafileFileName( + PInvokeGdiPlus.GdipRecordMetafileFileName( f, (HDC)referenceHdc, (GdiPlus.EmfType)type, @@ -431,7 +431,7 @@ public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect, Metaf fixed (char* f = fileName) fixed (char* d = description) { - PInvoke.GdipRecordMetafileFileName( + PInvokeGdiPlus.GdipRecordMetafileFileName( f, (HDC)referenceHdc, (GdiPlus.EmfType)type, @@ -455,7 +455,7 @@ public unsafe Metafile(Stream stream, IntPtr referenceHdc, EmfType type, string? GpMetafile* metafile = null; fixed (char* d = description) { - PInvoke.GdipRecordMetafileStream( + PInvokeGdiPlus.GdipRecordMetafileStream( iStream, (HDC)referenceHdc, (GdiPlus.EmfType)type, @@ -480,7 +480,7 @@ public unsafe Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect, fixed (char* d = description) { RectF rect = frameRect; - PInvoke.GdipRecordMetafileStream( + PInvokeGdiPlus.GdipRecordMetafileStream( iStream, (HDC)referenceHdc, (GdiPlus.EmfType)type, @@ -505,7 +505,7 @@ public unsafe Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect, fixed (char* d = description) { RectF rect = (RectangleF)frameRect; - PInvoke.GdipRecordMetafileStream( + PInvokeGdiPlus.GdipRecordMetafileStream( iStream, (HDC)referenceHdc, (GdiPlus.EmfType)type, @@ -538,7 +538,7 @@ public void PlayRecord(EmfPlusRecordType recordType, int flags, int dataSize, by fixed (byte* d = data) { - PInvoke.GdipPlayMetafileRecord( + PInvokeGdiPlus.GdipPlayMetafileRecord( this.Pointer(), (GdiPlus.EmfPlusRecordType)recordType, (uint)flags, @@ -559,7 +559,7 @@ public static MetafileHeader GetMetafileHeader(IntPtr hmetafile, WmfPlaceableFil fixed (GdiPlus.MetafileHeader* mf = &header._header) fixed (GdiPlus.WmfPlaceableFileHeader* wmf = &wmfHeader._header) { - PInvoke.GdipGetMetafileHeaderFromWmf((HMETAFILE)hmetafile, wmf, mf).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetMetafileHeaderFromWmf((HMETAFILE)hmetafile, wmf, mf).ThrowIfFailed(); return header; } } @@ -572,7 +572,7 @@ public static MetafileHeader GetMetafileHeader(IntPtr henhmetafile) MetafileHeader header = new(); fixed (GdiPlus.MetafileHeader* mf = &header._header) { - PInvoke.GdipGetMetafileHeaderFromEmf((HENHMETAFILE)henhmetafile, mf).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetMetafileHeaderFromEmf((HENHMETAFILE)henhmetafile, mf).ThrowIfFailed(); return header; } } @@ -590,7 +590,7 @@ public static MetafileHeader GetMetafileHeader(string fileName) fixed (char* fn = fileName) fixed (GdiPlus.MetafileHeader* mf = &header._header) { - PInvoke.GdipGetMetafileHeaderFromFile(fn, mf).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetMetafileHeaderFromFile(fn, mf).ThrowIfFailed(); return header; } } @@ -607,7 +607,7 @@ public static MetafileHeader GetMetafileHeader(Stream stream) fixed (GdiPlus.MetafileHeader* mf = &header._header) { using var iStream = stream.ToIStream(makeSeekable: true); - PInvoke.GdipGetMetafileHeaderFromStream(iStream, mf).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetMetafileHeaderFromStream(iStream, mf).ThrowIfFailed(); return header; } } @@ -621,7 +621,7 @@ public MetafileHeader GetMetafileHeader() fixed (GdiPlus.MetafileHeader* mf = &header._header) { - PInvoke.GdipGetMetafileHeaderFromMetafile(this.Pointer(), mf).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetMetafileHeaderFromMetafile(this.Pointer(), mf).ThrowIfFailed(); GC.KeepAlive(this); return header; } diff --git a/src/System.Drawing.Common/src/System/Drawing/Pen.cs b/src/System.Drawing.Common/src/System/Drawing/Pen.cs index a46879f81cc..c761df50b02 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Pen.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Pen.cs @@ -45,7 +45,7 @@ public Pen(Color color, float width) _color = color; GpPen* pen; - PInvoke.GdipCreatePen1((uint)color.ToArgb(), width, (int)GraphicsUnit.World, &pen).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreatePen1((uint)color.ToArgb(), width, (int)GraphicsUnit.World, &pen).ThrowIfFailed(); SetNativePen(pen); if (_color.IsSystemColor) @@ -68,7 +68,7 @@ public Pen(Brush brush, float width) { ArgumentNullException.ThrowIfNull(brush); GpPen* pen; - PInvoke.GdipCreatePen2(brush.NativeBrush, width, (int)GraphicsUnit.World, &pen).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreatePen2(brush.NativeBrush, width, (int)GraphicsUnit.World, &pen).ThrowIfFailed(); GC.KeepAlive(brush); SetNativePen(pen); } @@ -88,7 +88,7 @@ internal void SetNativePen(GpPen* nativePen) public object Clone() { GpPen* clonedPen; - PInvoke.GdipClonePen(NativePen, &clonedPen).ThrowIfFailed(); + PInvokeGdiPlus.GdipClonePen(NativePen, &clonedPen).ThrowIfFailed(); GC.KeepAlive(this); return new Pen(clonedPen); } @@ -118,7 +118,7 @@ private void Dispose(bool disposing) if (_nativePen is not null) { - Status status = !Gdip.Initialized ? Status.Ok : PInvoke.GdipDeletePen(NativePen); + Status status = !Gdip.Initialized ? Status.Ok : PInvokeGdiPlus.GdipDeletePen(NativePen); _nativePen = null; Debug.Assert(status == Status.Ok, $"GDI+ returned an error status: {status}"); } @@ -137,7 +137,7 @@ public float Width get { float width; - PInvoke.GdipGetPenWidth(NativePen, &width).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPenWidth(NativePen, &width).ThrowIfFailed(); GC.KeepAlive(this); return width; } @@ -148,7 +148,7 @@ public float Width throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, nameof(Pen))); } - PInvoke.GdipSetPenWidth(NativePen, value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPenWidth(NativePen, value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -163,7 +163,7 @@ public void SetLineCap(LineCap startCap, LineCap endCap, DashCap dashCap) throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, nameof(Pen))); } - PInvoke.GdipSetPenLineCap197819( + PInvokeGdiPlus.GdipSetPenLineCap197819( NativePen, (GdiPlus.LineCap)startCap, (GdiPlus.LineCap)endCap, @@ -180,7 +180,7 @@ public LineCap StartCap get { LineCap startCap; - PInvoke.GdipGetPenStartCap(NativePen, (GdiPlus.LineCap*)&startCap).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPenStartCap(NativePen, (GdiPlus.LineCap*)&startCap).ThrowIfFailed(); GC.KeepAlive(this); return startCap; } @@ -209,7 +209,7 @@ public LineCap StartCap throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, nameof(Pen))); } - PInvoke.GdipSetPenStartCap(NativePen, (GdiPlus.LineCap)value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPenStartCap(NativePen, (GdiPlus.LineCap)value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -222,7 +222,7 @@ public LineCap EndCap get { LineCap endCap; - PInvoke.GdipGetPenEndCap(NativePen, (GdiPlus.LineCap*)&endCap).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPenEndCap(NativePen, (GdiPlus.LineCap*)&endCap).ThrowIfFailed(); GC.KeepAlive(this); return endCap; } @@ -251,7 +251,7 @@ public LineCap EndCap throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, nameof(Pen))); } - PInvoke.GdipSetPenEndCap(NativePen, (GdiPlus.LineCap)value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPenEndCap(NativePen, (GdiPlus.LineCap)value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -264,7 +264,7 @@ public CustomLineCap CustomStartCap get { GpCustomLineCap* lineCap; - PInvoke.GdipGetPenCustomStartCap(NativePen, &lineCap).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPenCustomStartCap(NativePen, &lineCap).ThrowIfFailed(); GC.KeepAlive(this); return CustomLineCap.CreateCustomLineCapObject(lineCap); } @@ -275,7 +275,7 @@ public CustomLineCap CustomStartCap throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, nameof(Pen))); } - PInvoke.GdipSetPenCustomStartCap(NativePen, value is null ? null : value._nativeCap).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPenCustomStartCap(NativePen, value is null ? null : value._nativeCap).ThrowIfFailed(); GC.KeepAlive(value); GC.KeepAlive(this); } @@ -289,7 +289,7 @@ public CustomLineCap CustomEndCap get { GpCustomLineCap* lineCap; - PInvoke.GdipGetPenCustomEndCap(NativePen, &lineCap).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPenCustomEndCap(NativePen, &lineCap).ThrowIfFailed(); GC.KeepAlive(this); return CustomLineCap.CreateCustomLineCapObject(lineCap); } @@ -300,7 +300,7 @@ public CustomLineCap CustomEndCap throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, nameof(Pen))); } - PInvoke.GdipSetPenCustomEndCap(NativePen, value is null ? null : value._nativeCap).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPenCustomEndCap(NativePen, value is null ? null : value._nativeCap).ThrowIfFailed(); GC.KeepAlive(value); GC.KeepAlive(this); } @@ -314,7 +314,7 @@ public DashCap DashCap get { DashCap dashCap; - PInvoke.GdipGetPenDashCap197819(NativePen, (GdiPlus.DashCap*)&dashCap).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPenDashCap197819(NativePen, (GdiPlus.DashCap*)&dashCap).ThrowIfFailed(); GC.KeepAlive(this); return dashCap; } @@ -330,7 +330,7 @@ public DashCap DashCap throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, nameof(Pen))); } - PInvoke.GdipSetPenDashCap197819(NativePen, (GdiPlus.DashCap)value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPenDashCap197819(NativePen, (GdiPlus.DashCap)value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -343,7 +343,7 @@ public LineJoin LineJoin get { LineJoin lineJoin; - PInvoke.GdipGetPenLineJoin(NativePen, (GdiPlus.LineJoin*)&lineJoin).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPenLineJoin(NativePen, (GdiPlus.LineJoin*)&lineJoin).ThrowIfFailed(); GC.KeepAlive(this); return lineJoin; } @@ -359,7 +359,7 @@ public LineJoin LineJoin throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, nameof(Pen))); } - PInvoke.GdipSetPenLineJoin(NativePen, (GdiPlus.LineJoin)value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPenLineJoin(NativePen, (GdiPlus.LineJoin)value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -372,7 +372,7 @@ public float MiterLimit get { float miterLimit; - PInvoke.GdipGetPenMiterLimit(NativePen, &miterLimit).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPenMiterLimit(NativePen, &miterLimit).ThrowIfFailed(); GC.KeepAlive(this); return miterLimit; } @@ -383,7 +383,7 @@ public float MiterLimit throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, nameof(Pen))); } - PInvoke.GdipSetPenMiterLimit(NativePen, value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPenMiterLimit(NativePen, value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -396,7 +396,7 @@ public PenAlignment Alignment get { PenAlignment penMode; - PInvoke.GdipGetPenMode(NativePen, (GdiPlus.PenAlignment*)&penMode).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPenMode(NativePen, (GdiPlus.PenAlignment*)&penMode).ThrowIfFailed(); GC.KeepAlive(this); return penMode; } @@ -412,7 +412,7 @@ public PenAlignment Alignment throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, nameof(Pen))); } - PInvoke.GdipSetPenMode(NativePen, (GdiPlus.PenAlignment)value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPenMode(NativePen, (GdiPlus.PenAlignment)value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -425,7 +425,7 @@ public Matrix Transform get { Matrix matrix = new(); - PInvoke.GdipGetPenTransform(NativePen, matrix.NativeMatrix).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPenTransform(NativePen, matrix.NativeMatrix).ThrowIfFailed(); GC.KeepAlive(this); return matrix; } @@ -438,7 +438,7 @@ public Matrix Transform ArgumentNullException.ThrowIfNull(value); - PInvoke.GdipSetPenTransform(NativePen, value.NativeMatrix).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPenTransform(NativePen, value.NativeMatrix).ThrowIfFailed(); GC.KeepAlive(value); GC.KeepAlive(this); } @@ -449,7 +449,7 @@ public Matrix Transform /// public void ResetTransform() { - PInvoke.GdipResetPenTransform(NativePen).ThrowIfFailed(); + PInvokeGdiPlus.GdipResetPenTransform(NativePen).ThrowIfFailed(); GC.KeepAlive(this); } @@ -471,7 +471,7 @@ public void MultiplyTransform(Matrix matrix, MatrixOrder order) return; } - PInvoke.GdipMultiplyPenTransform(NativePen, matrix.NativeMatrix, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); + PInvokeGdiPlus.GdipMultiplyPenTransform(NativePen, matrix.NativeMatrix, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); GC.KeepAlive(matrix); GC.KeepAlive(this); } @@ -487,7 +487,7 @@ public void MultiplyTransform(Matrix matrix, MatrixOrder order) /// public void TranslateTransform(float dx, float dy, MatrixOrder order) { - PInvoke.GdipTranslatePenTransform(NativePen, dx, dy, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); + PInvokeGdiPlus.GdipTranslatePenTransform(NativePen, dx, dy, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); GC.KeepAlive(this); } @@ -501,7 +501,7 @@ public void TranslateTransform(float dx, float dy, MatrixOrder order) /// public void ScaleTransform(float sx, float sy, MatrixOrder order) { - PInvoke.GdipScalePenTransform(NativePen, sx, sy, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); + PInvokeGdiPlus.GdipScalePenTransform(NativePen, sx, sy, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); GC.KeepAlive(this); } @@ -515,13 +515,13 @@ public void ScaleTransform(float sx, float sy, MatrixOrder order) /// public void RotateTransform(float angle, MatrixOrder order) { - PInvoke.GdipRotatePenTransform(NativePen, angle, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); + PInvokeGdiPlus.GdipRotatePenTransform(NativePen, angle, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); GC.KeepAlive(this); } private void InternalSetColor(Color value) { - PInvoke.GdipSetPenColor(NativePen, (uint)_color.ToArgb()).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPenColor(NativePen, (uint)_color.ToArgb()).ThrowIfFailed(); GC.KeepAlive(this); _color = value; } @@ -534,7 +534,7 @@ public Drawing2D.PenType PenType get { GdiPlus.PenType type; - PInvoke.GdipGetPenFillType(NativePen, &type).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPenFillType(NativePen, &type).ThrowIfFailed(); GC.KeepAlive(this); return (Drawing2D.PenType)type; } @@ -555,7 +555,7 @@ public Color Color } ARGB color; - PInvoke.GdipGetPenColor(NativePen, (uint*)&color).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPenColor(NativePen, (uint*)&color).ThrowIfFailed(); GC.KeepAlive(this); _color = color; } @@ -631,7 +631,7 @@ public Brush Brush } ArgumentNullException.ThrowIfNull(value); - PInvoke.GdipSetPenBrushFill(NativePen, value.Pointer()).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPenBrushFill(NativePen, value.Pointer()).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -639,7 +639,7 @@ public Brush Brush private GpBrush* GetNativeBrush() { GpBrush* nativeBrush; - PInvoke.GdipGetPenBrushFill(NativePen, &nativeBrush).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPenBrushFill(NativePen, &nativeBrush).ThrowIfFailed(); GC.KeepAlive(this); return nativeBrush; } @@ -652,7 +652,7 @@ public DashStyle DashStyle get { DashStyle dashStyle; - PInvoke.GdipGetPenDashStyle(NativePen, (GdiPlus.DashStyle*)&dashStyle).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPenDashStyle(NativePen, (GdiPlus.DashStyle*)&dashStyle).ThrowIfFailed(); GC.KeepAlive(this); return dashStyle; } @@ -668,7 +668,7 @@ public DashStyle DashStyle throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, nameof(Pen))); } - PInvoke.GdipSetPenDashStyle(NativePen, (GdiPlus.DashStyle)value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPenDashStyle(NativePen, (GdiPlus.DashStyle)value).ThrowIfFailed(); GC.KeepAlive(this); // If we just set the pen style to Custom without defining the custom dash pattern, @@ -692,7 +692,7 @@ public DashStyle DashStyle private void EnsureValidDashPattern() { int count; - PInvoke.GdipGetPenDashCount(NativePen, &count); + PInvokeGdiPlus.GdipGetPenDashCount(NativePen, &count); GC.KeepAlive(this); if (count == 0) @@ -710,7 +710,7 @@ public float DashOffset get { float dashOffset; - PInvoke.GdipGetPenDashOffset(NativePen, &dashOffset).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPenDashOffset(NativePen, &dashOffset).ThrowIfFailed(); GC.KeepAlive(this); return dashOffset; } @@ -721,7 +721,7 @@ public float DashOffset throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, nameof(Pen))); } - PInvoke.GdipSetPenDashOffset(NativePen, value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPenDashOffset(NativePen, value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -734,7 +734,7 @@ public float[] DashPattern get { int count; - PInvoke.GdipGetPenDashCount(NativePen, &count).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPenDashCount(NativePen, &count).ThrowIfFailed(); GC.KeepAlive(this); float[] pattern; @@ -745,7 +745,7 @@ public float[] DashPattern pattern = new float[count]; fixed (float* p = pattern) { - PInvoke.GdipGetPenDashArray(NativePen, p, count).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPenDashArray(NativePen, p, count).ThrowIfFailed(); } } else if (DashStyle == DashStyle.Solid && !_dashStyleWasOrIsNotSolid) @@ -781,7 +781,7 @@ public float[] DashPattern fixed (float* f = value) { - PInvoke.GdipSetPenDashArray(NativePen, f, value.Length).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPenDashArray(NativePen, f, value.Length).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -795,7 +795,7 @@ public float[] CompoundArray get { int count; - PInvoke.GdipGetPenCompoundCount(NativePen, &count).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPenCompoundCount(NativePen, &count).ThrowIfFailed(); if (count == 0) { @@ -805,7 +805,7 @@ public float[] CompoundArray float[] array = new float[count]; fixed (float* f = array) { - PInvoke.GdipGetPenCompoundArray(NativePen, f, count).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetPenCompoundArray(NativePen, f, count).ThrowIfFailed(); GC.KeepAlive(this); return array; } @@ -820,7 +820,7 @@ public float[] CompoundArray ArgumentNullException.ThrowIfNull(value); fixed (float* f = value) { - PInvoke.GdipSetPenCompoundArray(NativePen, f, value.Length).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetPenCompoundArray(NativePen, f, value.Length).ThrowIfFailed(); GC.KeepAlive(this); } } diff --git a/src/System.Drawing.Common/src/System/Drawing/Region.cs b/src/System.Drawing.Common/src/System/Drawing/Region.cs index 0001c57e140..6a900bd84e2 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Region.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Region.cs @@ -14,7 +14,7 @@ public sealed unsafe class Region : MarshalByRefObject, IDisposable, IPointer Dispose(); - public void MakeInfinite() => CheckStatus(PInvoke.GdipSetInfinite(NativeRegion)); + public void MakeInfinite() => CheckStatus(PInvokeGdiPlus.GdipSetInfinite(NativeRegion)); - public void MakeEmpty() => CheckStatus(PInvoke.GdipSetEmpty(NativeRegion)); + public void MakeEmpty() => CheckStatus(PInvokeGdiPlus.GdipSetEmpty(NativeRegion)); public void Intersect(RectangleF rect) => - CheckStatus(PInvoke.GdipCombineRegionRect(NativeRegion, (RectF*)&rect, GdiPlus.CombineMode.CombineModeIntersect)); + CheckStatus(PInvokeGdiPlus.GdipCombineRegionRect(NativeRegion, (RectF*)&rect, GdiPlus.CombineMode.CombineModeIntersect)); public void Intersect(Rectangle rect) => Intersect((RectangleF)rect); public void Intersect(GraphicsPath path) { ArgumentNullException.ThrowIfNull(path); - CheckStatus(PInvoke.GdipCombineRegionPath(NativeRegion, path._nativePath, GdiPlus.CombineMode.CombineModeIntersect)); + CheckStatus(PInvokeGdiPlus.GdipCombineRegionPath(NativeRegion, path._nativePath, GdiPlus.CombineMode.CombineModeIntersect)); GC.KeepAlive(path); } public void Intersect(Region region) { ArgumentNullException.ThrowIfNull(region); - CheckStatus(PInvoke.GdipCombineRegionRegion(NativeRegion, region.NativeRegion, GdiPlus.CombineMode.CombineModeIntersect)); + CheckStatus(PInvokeGdiPlus.GdipCombineRegionRegion(NativeRegion, region.NativeRegion, GdiPlus.CombineMode.CombineModeIntersect)); GC.KeepAlive(region); } public void Union(RectangleF rect) => - CheckStatus(PInvoke.GdipCombineRegionRect(NativeRegion, (RectF*)&rect, GdiPlus.CombineMode.CombineModeUnion)); + CheckStatus(PInvokeGdiPlus.GdipCombineRegionRect(NativeRegion, (RectF*)&rect, GdiPlus.CombineMode.CombineModeUnion)); public void Union(Rectangle rect) => Union((RectangleF)rect); public void Union(GraphicsPath path) { ArgumentNullException.ThrowIfNull(path); - CheckStatus(PInvoke.GdipCombineRegionPath(NativeRegion, path._nativePath, GdiPlus.CombineMode.CombineModeUnion)); + CheckStatus(PInvokeGdiPlus.GdipCombineRegionPath(NativeRegion, path._nativePath, GdiPlus.CombineMode.CombineModeUnion)); GC.KeepAlive(path); } public void Union(Region region) { ArgumentNullException.ThrowIfNull(region); - CheckStatus(PInvoke.GdipCombineRegionRegion(NativeRegion, region.NativeRegion, GdiPlus.CombineMode.CombineModeUnion)); + CheckStatus(PInvokeGdiPlus.GdipCombineRegionRegion(NativeRegion, region.NativeRegion, GdiPlus.CombineMode.CombineModeUnion)); GC.KeepAlive(region); } public void Xor(RectangleF rect) => - CheckStatus(PInvoke.GdipCombineRegionRect(NativeRegion, (RectF*)&rect, GdiPlus.CombineMode.CombineModeXor)); + CheckStatus(PInvokeGdiPlus.GdipCombineRegionRect(NativeRegion, (RectF*)&rect, GdiPlus.CombineMode.CombineModeXor)); public void Xor(Rectangle rect) => Xor((RectangleF)rect); public void Xor(GraphicsPath path) { ArgumentNullException.ThrowIfNull(path); - CheckStatus(PInvoke.GdipCombineRegionPath(NativeRegion, path._nativePath, GdiPlus.CombineMode.CombineModeXor)); + CheckStatus(PInvokeGdiPlus.GdipCombineRegionPath(NativeRegion, path._nativePath, GdiPlus.CombineMode.CombineModeXor)); GC.KeepAlive(path); } public void Xor(Region region) { ArgumentNullException.ThrowIfNull(region); - CheckStatus(PInvoke.GdipCombineRegionRegion(NativeRegion, region.NativeRegion, GdiPlus.CombineMode.CombineModeXor)); + CheckStatus(PInvokeGdiPlus.GdipCombineRegionRegion(NativeRegion, region.NativeRegion, GdiPlus.CombineMode.CombineModeXor)); GC.KeepAlive(region); } public void Exclude(RectangleF rect) => - CheckStatus(PInvoke.GdipCombineRegionRect(NativeRegion, (RectF*)&rect, GdiPlus.CombineMode.CombineModeExclude)); + CheckStatus(PInvokeGdiPlus.GdipCombineRegionRect(NativeRegion, (RectF*)&rect, GdiPlus.CombineMode.CombineModeExclude)); public void Exclude(Rectangle rect) => Exclude((RectangleF)rect); public void Exclude(GraphicsPath path) { ArgumentNullException.ThrowIfNull(path); - CheckStatus(PInvoke.GdipCombineRegionPath(NativeRegion, path._nativePath, GdiPlus.CombineMode.CombineModeExclude)); + CheckStatus(PInvokeGdiPlus.GdipCombineRegionPath(NativeRegion, path._nativePath, GdiPlus.CombineMode.CombineModeExclude)); GC.KeepAlive(path); } public void Exclude(Region region) { ArgumentNullException.ThrowIfNull(region); - CheckStatus(PInvoke.GdipCombineRegionRegion(NativeRegion, region.NativeRegion, GdiPlus.CombineMode.CombineModeExclude)); + CheckStatus(PInvokeGdiPlus.GdipCombineRegionRegion(NativeRegion, region.NativeRegion, GdiPlus.CombineMode.CombineModeExclude)); GC.KeepAlive(region); } public void Complement(RectangleF rect) => - CheckStatus(PInvoke.GdipCombineRegionRect(NativeRegion, (RectF*)&rect, GdiPlus.CombineMode.CombineModeComplement)); + CheckStatus(PInvokeGdiPlus.GdipCombineRegionRect(NativeRegion, (RectF*)&rect, GdiPlus.CombineMode.CombineModeComplement)); public void Complement(Rectangle rect) => Complement((RectangleF)rect); public void Complement(GraphicsPath path) { ArgumentNullException.ThrowIfNull(path); - CheckStatus(PInvoke.GdipCombineRegionPath(NativeRegion, path._nativePath, GdiPlus.CombineMode.CombineModeComplement)); + CheckStatus(PInvokeGdiPlus.GdipCombineRegionPath(NativeRegion, path._nativePath, GdiPlus.CombineMode.CombineModeComplement)); GC.KeepAlive(path); } public void Complement(Region region) { ArgumentNullException.ThrowIfNull(region); - CheckStatus(PInvoke.GdipCombineRegionRegion(NativeRegion, region.NativeRegion, GdiPlus.CombineMode.CombineModeComplement)); + CheckStatus(PInvokeGdiPlus.GdipCombineRegionRegion(NativeRegion, region.NativeRegion, GdiPlus.CombineMode.CombineModeComplement)); GC.KeepAlive(region); } - public void Translate(float dx, float dy) => CheckStatus(PInvoke.GdipTranslateRegion(NativeRegion, dx, dy)); + public void Translate(float dx, float dy) => CheckStatus(PInvokeGdiPlus.GdipTranslateRegion(NativeRegion, dx, dy)); public void Translate(int dx, int dy) => Translate((float)dx, dy); @@ -209,7 +209,7 @@ public void Transform(Matrix matrix) { ArgumentNullException.ThrowIfNull(matrix); - CheckStatus(PInvoke.GdipTransformRegion(NativeRegion, matrix.NativeMatrix)); + CheckStatus(PInvokeGdiPlus.GdipTransformRegion(NativeRegion, matrix.NativeMatrix)); GC.KeepAlive(matrix); } @@ -217,7 +217,7 @@ public RectangleF GetBounds(Graphics g) { ArgumentNullException.ThrowIfNull(g); RectF bounds; - CheckStatus(PInvoke.GdipGetRegionBounds(NativeRegion, g.NativeGraphics, &bounds)); + CheckStatus(PInvokeGdiPlus.GdipGetRegionBounds(NativeRegion, g.NativeGraphics, &bounds)); GC.KeepAlive(g); return bounds; } @@ -226,7 +226,7 @@ public IntPtr GetHrgn(Graphics g) { ArgumentNullException.ThrowIfNull(g); HRGN hrgn; - CheckStatus(PInvokeCore.GdipGetRegionHRgn(NativeRegion, g.NativeGraphics, &hrgn)); + CheckStatus(PInvokeGdiPlus.GdipGetRegionHRgn(NativeRegion, g.NativeGraphics, &hrgn)); GC.KeepAlive(g); return hrgn; } @@ -235,7 +235,7 @@ public bool IsEmpty(Graphics g) { ArgumentNullException.ThrowIfNull(g); BOOL isEmpty; - CheckStatus(PInvoke.GdipIsEmptyRegion(NativeRegion, g.NativeGraphics, &isEmpty)); + CheckStatus(PInvokeGdiPlus.GdipIsEmptyRegion(NativeRegion, g.NativeGraphics, &isEmpty)); GC.KeepAlive(g); return isEmpty; } @@ -244,7 +244,7 @@ public bool IsInfinite(Graphics g) { ArgumentNullException.ThrowIfNull(g); BOOL isInfinite; - CheckStatus(PInvokeCore.GdipIsInfiniteRegion(NativeRegion, g.NativeGraphics, &isInfinite)); + CheckStatus(PInvokeGdiPlus.GdipIsInfiniteRegion(NativeRegion, g.NativeGraphics, &isInfinite)); return isInfinite; } @@ -253,7 +253,7 @@ public bool Equals(Region region, Graphics g) ArgumentNullException.ThrowIfNull(region); ArgumentNullException.ThrowIfNull(g); BOOL isEqual; - CheckStatus(PInvoke.GdipIsEqualRegion(NativeRegion, region.NativeRegion, g.NativeGraphics, &isEqual)); + CheckStatus(PInvokeGdiPlus.GdipIsEqualRegion(NativeRegion, region.NativeRegion, g.NativeGraphics, &isEqual)); GC.KeepAlive(g); GC.KeepAlive(region); return isEqual; @@ -262,7 +262,7 @@ public bool Equals(Region region, Graphics g) public RegionData? GetRegionData() { uint regionSize; - CheckStatus(PInvoke.GdipGetRegionDataSize(NativeRegion, ®ionSize)); + CheckStatus(PInvokeGdiPlus.GdipGetRegionDataSize(NativeRegion, ®ionSize)); if (regionSize == 0) return null; @@ -270,7 +270,7 @@ public bool Equals(Region region, Graphics g) byte[] regionData = new byte[regionSize]; fixed (byte* rd = regionData) { - CheckStatus(PInvoke.GdipGetRegionData(NativeRegion, rd, regionSize, ®ionSize)); + CheckStatus(PInvokeGdiPlus.GdipGetRegionData(NativeRegion, rd, regionSize, ®ionSize)); } return new RegionData(regionData); @@ -285,7 +285,7 @@ public bool Equals(Region region, Graphics g) public bool IsVisible(PointF point, Graphics? g) { BOOL isVisible; - CheckStatus(PInvoke.GdipIsVisibleRegionPoint( + CheckStatus(PInvokeGdiPlus.GdipIsVisibleRegionPoint( NativeRegion, point.X, point.Y, @@ -305,7 +305,7 @@ public bool IsVisible(PointF point, Graphics? g) public bool IsVisible(RectangleF rect, Graphics? g) { BOOL isVisible; - CheckStatus(PInvoke.GdipIsVisibleRegionRect( + CheckStatus(PInvokeGdiPlus.GdipIsVisibleRegionRect( NativeRegion, rect.X, rect.Y, rect.Width, rect.Height, g is null ? null : g.NativeGraphics, @@ -334,7 +334,7 @@ public RectangleF[] GetRegionScans(Matrix matrix) ArgumentNullException.ThrowIfNull(matrix); uint count; - CheckStatus(PInvoke.GdipGetRegionScansCount( + CheckStatus(PInvokeGdiPlus.GdipGetRegionScansCount( NativeRegion, &count, matrix.NativeMatrix)); @@ -348,7 +348,7 @@ public RectangleF[] GetRegionScans(Matrix matrix) fixed (RectangleF* r = rectangles) { - CheckStatus(PInvoke.GdipGetRegionScans( + CheckStatus(PInvokeGdiPlus.GdipGetRegionScans( NativeRegion, (RectF*)r, (int*)&count, diff --git a/src/System.Drawing.Common/src/System/Drawing/SolidBrush.cs b/src/System.Drawing.Common/src/System/Drawing/SolidBrush.cs index 8c8a6ab3a4c..1937ea30b59 100644 --- a/src/System.Drawing.Common/src/System/Drawing/SolidBrush.cs +++ b/src/System.Drawing.Common/src/System/Drawing/SolidBrush.cs @@ -16,7 +16,7 @@ public SolidBrush(Color color) _color = color; GpSolidFill* nativeBrush; - PInvoke.GdipCreateSolidFill((ARGB)_color, &nativeBrush).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreateSolidFill((ARGB)_color, &nativeBrush).ThrowIfFailed(); SetNativeBrushInternal((GpBrush*)nativeBrush); if (_color.IsSystemColor) @@ -36,7 +36,7 @@ internal SolidBrush(GpSolidFill* nativeBrush) public override object Clone() { GpBrush* clonedBrush; - PInvoke.GdipCloneBrush(NativeBrush, &clonedBrush).ThrowIfFailed(); + PInvokeGdiPlus.GdipCloneBrush(NativeBrush, &clonedBrush).ThrowIfFailed(); GC.KeepAlive(this); // Clones of immutable brushes are not immutable. @@ -64,7 +64,7 @@ public Color Color if (_color == Color.Empty) { ARGB color; - PInvoke.GdipGetSolidFillColor((GpSolidFill*)NativeBrush, (uint*)&color).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetSolidFillColor((GpSolidFill*)NativeBrush, (uint*)&color).ThrowIfFailed(); GC.KeepAlive(this); _color = color; } @@ -97,7 +97,7 @@ public Color Color // Sets the color even if the brush is considered immutable. private void InternalSetColor(Color value) { - PInvoke.GdipSetSolidFillColor((GpSolidFill*)NativeBrush, (ARGB)value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetSolidFillColor((GpSolidFill*)NativeBrush, (ARGB)value).ThrowIfFailed(); GC.KeepAlive(this); _color = value; } diff --git a/src/System.Drawing.Common/src/System/Drawing/StringFormat.cs b/src/System.Drawing.Common/src/System/Drawing/StringFormat.cs index 094ef3543ff..b8db14354e5 100644 --- a/src/System.Drawing.Common/src/System/Drawing/StringFormat.cs +++ b/src/System.Drawing.Common/src/System/Drawing/StringFormat.cs @@ -37,7 +37,7 @@ public StringFormat(StringFormatFlags options) : this(options, 0) public StringFormat(StringFormatFlags options, int language) { GpStringFormat* format; - PInvoke.GdipCreateStringFormat((int)options, (ushort)language, &format).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreateStringFormat((int)options, (ushort)language, &format).ThrowIfFailed(); _nativeFormat = format; } @@ -49,7 +49,7 @@ public StringFormat(StringFormat format) { ArgumentNullException.ThrowIfNull(format); GpStringFormat* newFormat; - PInvoke.GdipCloneStringFormat(format._nativeFormat, &newFormat).ThrowIfFailed(); + PInvokeGdiPlus.GdipCloneStringFormat(format._nativeFormat, &newFormat).ThrowIfFailed(); _nativeFormat = newFormat; GC.KeepAlive(format); } @@ -72,7 +72,7 @@ private void Dispose(bool disposing) #if DEBUG Status status = !Gdip.Initialized ? Status.Ok : #endif - PInvoke.GdipDeleteStringFormat(_nativeFormat); + PInvokeGdiPlus.GdipDeleteStringFormat(_nativeFormat); #if DEBUG Debug.Assert(status == Status.Ok, $"GDI+ returned an error status: {status}"); #endif @@ -106,13 +106,13 @@ public StringFormatFlags FormatFlags get { StringFormatFlags format; - PInvoke.GdipGetStringFormatFlags(_nativeFormat, (int*)&format).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetStringFormatFlags(_nativeFormat, (int*)&format).ThrowIfFailed(); GC.KeepAlive(this); return format; } set { - PInvoke.GdipSetStringFormatFlags(_nativeFormat, (int)value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetStringFormatFlags(_nativeFormat, (int)value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -129,7 +129,7 @@ public void SetMeasurableCharacterRanges(CharacterRange[] ranges) GdiPlus.CharacterRange stub; fixed (void* r = ranges) { - PInvoke.GdipSetStringFormatMeasurableCharacterRanges( + PInvokeGdiPlus.GdipSetStringFormatMeasurableCharacterRanges( _nativeFormat, ranges.Length, r is null ? &stub : (GdiPlus.CharacterRange*)r).ThrowIfFailed(); @@ -146,7 +146,7 @@ public StringAlignment Alignment get { StringAlignment alignment; - PInvoke.GdipGetStringFormatAlign(_nativeFormat, (GdiPlus.StringAlignment*)&alignment).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetStringFormatAlign(_nativeFormat, (GdiPlus.StringAlignment*)&alignment).ThrowIfFailed(); GC.KeepAlive(this); return alignment; } @@ -157,7 +157,7 @@ public StringAlignment Alignment throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(StringAlignment)); } - PInvoke.GdipSetStringFormatAlign(_nativeFormat, (GdiPlus.StringAlignment)value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetStringFormatAlign(_nativeFormat, (GdiPlus.StringAlignment)value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -170,7 +170,7 @@ public StringAlignment LineAlignment get { StringAlignment alignment; - PInvoke.GdipGetStringFormatLineAlign(_nativeFormat, (GdiPlus.StringAlignment*)&alignment).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetStringFormatLineAlign(_nativeFormat, (GdiPlus.StringAlignment*)&alignment).ThrowIfFailed(); GC.KeepAlive(this); return alignment; } @@ -181,7 +181,7 @@ public StringAlignment LineAlignment throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(StringAlignment)); } - PInvoke.GdipSetStringFormatLineAlign(_nativeFormat, (GdiPlus.StringAlignment)value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetStringFormatLineAlign(_nativeFormat, (GdiPlus.StringAlignment)value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -194,7 +194,7 @@ public HotkeyPrefix HotkeyPrefix get { HotkeyPrefix hotkeyPrefix; - PInvoke.GdipGetStringFormatHotkeyPrefix(_nativeFormat, (int*)&hotkeyPrefix).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetStringFormatHotkeyPrefix(_nativeFormat, (int*)&hotkeyPrefix).ThrowIfFailed(); GC.KeepAlive(this); return hotkeyPrefix; } @@ -205,7 +205,7 @@ public HotkeyPrefix HotkeyPrefix throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(HotkeyPrefix)); } - PInvoke.GdipSetStringFormatHotkeyPrefix(_nativeFormat, (int)value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetStringFormatHotkeyPrefix(_nativeFormat, (int)value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -227,7 +227,7 @@ public void SetTabStops(float firstTabOffset, float[] tabStops) float stub; fixed (float* ts = tabStops) { - PInvoke.GdipSetStringFormatTabStops( + PInvokeGdiPlus.GdipSetStringFormatTabStops( _nativeFormat, firstTabOffset, tabStops.Length, @@ -242,7 +242,7 @@ public void SetTabStops(float firstTabOffset, float[] tabStops) public float[] GetTabStops(out float firstTabOffset) { int count; - PInvoke.GdipGetStringFormatTabStopCount(_nativeFormat, &count).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetStringFormatTabStopCount(_nativeFormat, &count).ThrowIfFailed(); if (count == 0) { @@ -255,7 +255,7 @@ public float[] GetTabStops(out float firstTabOffset) fixed (float* fto = &firstTabOffset) fixed (float* ts = tabStops) { - PInvoke.GdipGetStringFormatTabStops(_nativeFormat, count, fto, ts).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetStringFormatTabStops(_nativeFormat, count, fto, ts).ThrowIfFailed(); GC.KeepAlive(this); return tabStops; } @@ -272,7 +272,7 @@ public StringTrimming Trimming get { StringTrimming trimming; - PInvoke.GdipGetStringFormatTrimming(_nativeFormat, (GdiPlus.StringTrimming*)&trimming).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetStringFormatTrimming(_nativeFormat, (GdiPlus.StringTrimming*)&trimming).ThrowIfFailed(); GC.KeepAlive(this); return trimming; } @@ -283,7 +283,7 @@ public StringTrimming Trimming throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(StringTrimming)); } - PInvoke.GdipSetStringFormatTrimming(_nativeFormat, (GdiPlus.StringTrimming)value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetStringFormatTrimming(_nativeFormat, (GdiPlus.StringTrimming)value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -308,7 +308,7 @@ public static StringFormat GenericDefault get { GpStringFormat* format; - PInvoke.GdipStringFormatGetGenericDefault(&format).ThrowIfFailed(); + PInvokeGdiPlus.GdipStringFormatGetGenericDefault(&format).ThrowIfFailed(); return new StringFormat(format); } } @@ -334,14 +334,14 @@ public static StringFormat GenericTypographic get { GpStringFormat* format; - PInvoke.GdipStringFormatGetGenericTypographic(&format).ThrowIfFailed(); + PInvokeGdiPlus.GdipStringFormatGetGenericTypographic(&format).ThrowIfFailed(); return new StringFormat(format); } } public void SetDigitSubstitution(int language, StringDigitSubstitute substitute) { - PInvoke.GdipSetStringFormatDigitSubstitution( + PInvokeGdiPlus.GdipSetStringFormatDigitSubstitution( _nativeFormat, (ushort)language, (GdiPlus.StringDigitSubstitute)substitute).ThrowIfFailed(); @@ -357,7 +357,7 @@ public StringDigitSubstitute DigitSubstitutionMethod get { StringDigitSubstitute digitSubstitute; - PInvoke.GdipGetStringFormatDigitSubstitution( + PInvokeGdiPlus.GdipGetStringFormatDigitSubstitution( _nativeFormat, null, (GdiPlus.StringDigitSubstitute*)&digitSubstitute).ThrowIfFailed(); @@ -375,7 +375,7 @@ public int DigitSubstitutionLanguage get { ushort language; - PInvoke.GdipGetStringFormatDigitSubstitution(_nativeFormat, &language, null).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetStringFormatDigitSubstitution(_nativeFormat, &language, null).ThrowIfFailed(); GC.KeepAlive(this); return language; } @@ -384,7 +384,7 @@ public int DigitSubstitutionLanguage internal int GetMeasurableCharacterRangeCount() { int count; - PInvoke.GdipGetStringFormatMeasurableCharacterRangeCount(_nativeFormat, &count).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetStringFormatMeasurableCharacterRangeCount(_nativeFormat, &count).ThrowIfFailed(); GC.KeepAlive(this); return count; } diff --git a/src/System.Drawing.Common/src/System/Drawing/Text/FontCollection.cs b/src/System.Drawing.Common/src/System/Drawing/Text/FontCollection.cs index c0df0f77e44..99662d1ac3c 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Text/FontCollection.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Text/FontCollection.cs @@ -32,7 +32,7 @@ public FontFamily[] Families get { int numFound; - PInvoke.GdipGetFontCollectionFamilyCount(_nativeFontCollection, &numFound).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetFontCollectionFamilyCount(_nativeFontCollection, &numFound).ThrowIfFailed(); if (numFound == 0) { @@ -44,7 +44,7 @@ public FontFamily[] Families GpFontFamily*[] gpFamilies = new GpFontFamily*[numFound]; fixed (GpFontFamily** f = gpFamilies) { - PInvoke.GdipGetFontCollectionFamilyList(_nativeFontCollection, numFound, f, &numFound).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetFontCollectionFamilyList(_nativeFontCollection, numFound, f, &numFound).ThrowIfFailed(); } Debug.Assert(gpFamilies.Length == numFound, "GDI+ can't give a straight answer about how many fonts there are"); diff --git a/src/System.Drawing.Common/src/System/Drawing/Text/InstalledFontCollection.cs b/src/System.Drawing.Common/src/System/Drawing/Text/InstalledFontCollection.cs index 9a83743e3d8..606da6cd3ad 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Text/InstalledFontCollection.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Text/InstalledFontCollection.cs @@ -21,7 +21,7 @@ public InstalledFontCollection() : base(Create()) private static GpFontCollection* Create() { GpFontCollection* fontCollection; - PInvoke.GdipNewInstalledFontCollection(&fontCollection).ThrowIfFailed(); + PInvokeGdiPlus.GdipNewInstalledFontCollection(&fontCollection).ThrowIfFailed(); return fontCollection; } diff --git a/src/System.Drawing.Common/src/System/Drawing/Text/PrivateFontCollection.cs b/src/System.Drawing.Common/src/System/Drawing/Text/PrivateFontCollection.cs index 8d8586ff8b6..61bcae624ee 100644 --- a/src/System.Drawing.Common/src/System/Drawing/Text/PrivateFontCollection.cs +++ b/src/System.Drawing.Common/src/System/Drawing/Text/PrivateFontCollection.cs @@ -20,7 +20,7 @@ public PrivateFontCollection() : base(Create()) private static GpFontCollection* Create() { GpFontCollection* fontCollection; - PInvoke.GdipNewPrivateFontCollection(&fontCollection).ThrowIfFailed(); + PInvokeGdiPlus.GdipNewPrivateFontCollection(&fontCollection).ThrowIfFailed(); return fontCollection; } @@ -33,7 +33,7 @@ protected override void Dispose(bool disposing) if (nativeFontCollection is not null) { - Status status = PInvoke.GdipDeletePrivateFontCollection(&nativeFontCollection); + Status status = PInvokeGdiPlus.GdipDeletePrivateFontCollection(&nativeFontCollection); if (disposing) { Debug.Assert(status == Status.Ok, $"GDI+ returned an error status: {status}"); @@ -57,7 +57,7 @@ public void AddFontFile(string filename) fixed (char* p = filename) { - PInvoke.GdipPrivateAddFontFile(this.Pointer(), p).ThrowIfFailed(); + PInvokeGdiPlus.GdipPrivateAddFontFile(this.Pointer(), p).ThrowIfFailed(); GC.KeepAlive(this); } @@ -70,7 +70,7 @@ public void AddFontFile(string filename) /// public void AddMemoryFont(IntPtr memory, int length) { - PInvoke.GdipPrivateAddMemoryFont(this.Pointer(), (void*)memory, length).ThrowIfFailed(); + PInvokeGdiPlus.GdipPrivateAddMemoryFont(this.Pointer(), (void*)memory, length).ThrowIfFailed(); GC.KeepAlive(this); } diff --git a/src/System.Drawing.Common/src/System/Drawing/TextureBrush.cs b/src/System.Drawing.Common/src/System/Drawing/TextureBrush.cs index 2b74629ec55..098441d9780 100644 --- a/src/System.Drawing.Common/src/System/Drawing/TextureBrush.cs +++ b/src/System.Drawing.Common/src/System/Drawing/TextureBrush.cs @@ -28,7 +28,7 @@ public TextureBrush(Image image, Drawing2D.WrapMode wrapMode) } GpTexture* brush; - PInvoke.GdipCreateTexture(image.Pointer(), (WrapMode)wrapMode, &brush).ThrowIfFailed(); + PInvokeGdiPlus.GdipCreateTexture(image.Pointer(), (WrapMode)wrapMode, &brush).ThrowIfFailed(); GC.KeepAlive(image); SetNativeBrushInternal((GpBrush*)brush); } @@ -43,7 +43,7 @@ public TextureBrush(Image image, Drawing2D.WrapMode wrapMode, RectangleF dstRect } GpTexture* brush; - PInvoke.GdipCreateTexture2( + PInvokeGdiPlus.GdipCreateTexture2( image.Pointer(), (WrapMode)wrapMode, dstRect.X, dstRect.Y, dstRect.Width, dstRect.Height, &brush).ThrowIfFailed(); @@ -64,7 +64,7 @@ public TextureBrush(Image image, RectangleF dstRect, ImageAttributes? imageAttr) ArgumentNullException.ThrowIfNull(image); GpTexture* brush; - PInvoke.GdipCreateTextureIA( + PInvokeGdiPlus.GdipCreateTextureIA( image.Pointer(), imageAttr is null ? null : imageAttr._nativeImageAttributes, dstRect.X, @@ -94,7 +94,7 @@ internal TextureBrush(GpTexture* nativeBrush) public override object Clone() { GpBrush* cloneBrush; - PInvoke.GdipCloneBrush(NativeBrush, &cloneBrush).ThrowIfFailed(); + PInvokeGdiPlus.GdipCloneBrush(NativeBrush, &cloneBrush).ThrowIfFailed(); GC.KeepAlive(this); return new TextureBrush((GpTexture*)cloneBrush); @@ -105,14 +105,14 @@ public Matrix Transform get { Matrix matrix = new(); - PInvoke.GdipGetTextureTransform((GpTexture*)NativeBrush, matrix.NativeMatrix).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetTextureTransform((GpTexture*)NativeBrush, matrix.NativeMatrix).ThrowIfFailed(); GC.KeepAlive(this); return matrix; } set { ArgumentNullException.ThrowIfNull(value); - PInvoke.GdipSetTextureTransform((GpTexture*)NativeBrush, value.NativeMatrix).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetTextureTransform((GpTexture*)NativeBrush, value.NativeMatrix).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -122,7 +122,7 @@ public Drawing2D.WrapMode WrapMode get { WrapMode mode; - PInvoke.GdipGetTextureWrapMode((GpTexture*)NativeBrush, &mode).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetTextureWrapMode((GpTexture*)NativeBrush, &mode).ThrowIfFailed(); GC.KeepAlive(this); return (Drawing2D.WrapMode)mode; } @@ -133,7 +133,7 @@ public Drawing2D.WrapMode WrapMode throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(Drawing2D.WrapMode)); } - PInvoke.GdipSetTextureWrapMode((GpTexture*)NativeBrush, (WrapMode)value).ThrowIfFailed(); + PInvokeGdiPlus.GdipSetTextureWrapMode((GpTexture*)NativeBrush, (WrapMode)value).ThrowIfFailed(); GC.KeepAlive(this); } } @@ -143,7 +143,7 @@ public Image Image get { GpImage* image; - PInvoke.GdipGetTextureImage((GpTexture*)NativeBrush, &image).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetTextureImage((GpTexture*)NativeBrush, &image).ThrowIfFailed(); GC.KeepAlive(this); return Image.CreateImageObject(image); } @@ -151,7 +151,7 @@ public Image Image public void ResetTransform() { - PInvoke.GdipResetTextureTransform((GpTexture*)NativeBrush).ThrowIfFailed(); + PInvokeGdiPlus.GdipResetTextureTransform((GpTexture*)NativeBrush).ThrowIfFailed(); GC.KeepAlive(this); } @@ -166,7 +166,7 @@ public void MultiplyTransform(Matrix matrix, MatrixOrder order) return; } - PInvoke.GdipMultiplyTextureTransform( + PInvokeGdiPlus.GdipMultiplyTextureTransform( (GpTexture*)NativeBrush, matrix.NativeMatrix, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); @@ -179,7 +179,7 @@ public void MultiplyTransform(Matrix matrix, MatrixOrder order) public void TranslateTransform(float dx, float dy, MatrixOrder order) { - PInvoke.GdipTranslateTextureTransform( + PInvokeGdiPlus.GdipTranslateTextureTransform( (GpTexture*)NativeBrush, dx, dy, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); @@ -191,7 +191,7 @@ public void TranslateTransform(float dx, float dy, MatrixOrder order) public void ScaleTransform(float sx, float sy, MatrixOrder order) { - PInvoke.GdipScaleTextureTransform( + PInvokeGdiPlus.GdipScaleTextureTransform( (GpTexture*)NativeBrush, sx, sy, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); @@ -203,7 +203,7 @@ public void ScaleTransform(float sx, float sy, MatrixOrder order) public void RotateTransform(float angle, MatrixOrder order) { - PInvoke.GdipRotateTextureTransform( + PInvokeGdiPlus.GdipRotateTextureTransform( (GpTexture*)NativeBrush, angle, (GdiPlus.MatrixOrder)order).ThrowIfFailed(); diff --git a/src/System.Drawing.Common/src/Windows/Win32/PInvoke.cs b/src/System.Drawing.Common/src/Windows/Win32/PInvoke.cs deleted file mode 100644 index edd40371aec..00000000000 --- a/src/System.Drawing.Common/src/Windows/Win32/PInvoke.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Drawing; - -namespace Windows.Win32; - -internal static partial class PInvoke -{ - static PInvoke() - { - // Ensure GDI+ is initialized before the first PInvoke call. Note that this has to happen after - // the DPI awareness context is set for scaling to occur correctly. - bool initialized = Gdip.Initialized; - Debug.Assert(initialized); - } -} diff --git a/src/System.Private.Windows.Core/src/NativeMethods.txt b/src/System.Private.Windows.Core/src/NativeMethods.txt index 8cf1d9a8816..5f8fab573cb 100644 --- a/src/System.Private.Windows.Core/src/NativeMethods.txt +++ b/src/System.Private.Windows.Core/src/NativeMethods.txt @@ -63,7 +63,6 @@ E_PENDING E_POINTER E_UNEXPECTED EM_* -EncoderParameters EndPaint EnumChildWindows EnumDisplayMonitors @@ -77,26 +76,6 @@ GetCurrentThreadId GetSysColorBrush GetWindowText GetWindowTextLength -// All callers of these APIs MUST call GdiPlusInitialization.EnsureInitialized() before use. -// There is no easy way to do this in Core as we want to make sure it is only done when needed. -// (If using another GDI+ handle or wrapped object you can assume GDI+ is initialized.) -GdipBitmapLockBits -GdipBitmapUnlockBits -GdipCreateFromHWND -GdipCreateHalftonePalette -GdipDeleteGraphics -GdipCreateHBITMAPFromBitmap -GdipGetHemfFromMetafile -GdipGetImageBounds -GdipGetImageEncoders -GdipGetImageEncodersSize -GdipGetImagePixelFormat -GdipGetImageRawFormat -GdipGetRegionHRgn -GdipIsInfiniteRegion -GdiplusStartup -GdiplusStartupInputEx -GdipSaveImageToStream GET_CLASS_LONG_INDEX GetClientRect GetClipRgn @@ -125,10 +104,6 @@ GlobalLock GlobalReAlloc GlobalSize GlobalUnlock -GpBitmap -GpGraphics -GpImage -GpRegion HBITMAP HBMMENU_* HBRUSH @@ -147,7 +122,6 @@ HWND_* IDI_* IEnumUnknown IGlobalInterfaceTable -ImageFormat* ImageLockMode INPLACE_E_NOTOOLSPACE IntersectClipRect @@ -190,15 +164,12 @@ OLE_E_PROMPTSAVECANCELLED OleCreatePictureIndirect PeekMessage PostMessage -PixelFormat* POINTS PRINTDLGEX_FLAGS PropVariantClear PWSTR RealizePalette -Rect RECT -RectF REGDB_E_CLASSNOTREG ReleaseDC RestoreDC diff --git a/src/System.Private.Windows.Core/src/Properties/AssemblyInfo.cs b/src/System.Private.Windows.Core/src/Properties/AssemblyInfo.cs index 8607a14ec88..83219b2ba9d 100644 --- a/src/System.Private.Windows.Core/src/Properties/AssemblyInfo.cs +++ b/src/System.Private.Windows.Core/src/Properties/AssemblyInfo.cs @@ -10,6 +10,7 @@ [assembly: InternalsVisibleTo($"System.Windows.Forms.Design.Editors, PublicKey={PublicKeys.Ecma}")] [assembly: InternalsVisibleTo($"System.Windows.Forms.Primitives, PublicKey={PublicKeys.Ecma}")] [assembly: InternalsVisibleTo($"System.Drawing.Common, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"System.Private.Windows.GdiPlus, PublicKey={PublicKeys.Ecma}")] [assembly: InternalsVisibleTo($"System.Windows.Forms.Design.Tests, PublicKey={PublicKeys.Ecma}")] [assembly: InternalsVisibleTo($"System.Windows.Forms.Primitives.Tests, PublicKey={PublicKeys.Ecma}")] diff --git a/src/System.Private.Windows.Core/src/Resources/SR.resx b/src/System.Private.Windows.Core/src/Resources/SR.resx index d99f2b67c4e..d58708177e9 100644 --- a/src/System.Private.Windows.Core/src/Resources/SR.resx +++ b/src/System.Private.Windows.Core/src/Resources/SR.resx @@ -98,87 +98,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Function was ended. - - - File access is denied. - - - A Graphics object cannot be created from an image that has an indexed pixel format. - - - SetPixel is not supported for images with indexed pixel formats. - - - Destination points define a parallelogram which must have a length of 3. These points will represent the upper-left, upper-right, and lower-left coordinates (defined in that order). - - - Destination points must be an array with a length of 3 or 4. A length of 3 defines a parallelogram with the upper-left, upper-right, and lower-left corners. A length of 4 defines a quadrilateral with the fourth element of the array specifying the lower-right coordinate. - - - File not found. - - - Font '{0}' cannot be found. - - - Font '{0}' does not support style '{1}'. - - - A generic error occurred in GDI+. - - - Buffer is too small (internal GDI+ error). - - - Parameter is not valid. - - - Rectangle '{0}' cannot have a width or height equal to 0. - - - Operation requires a transformation of the image from GDI+ to GDI. GDI does not support images with a width or height greater than 32767. - - - Out of memory. - - - Not implemented. - - - GDI+ is not properly initialized (internal GDI+ error). - - - Only TrueType fonts are supported. '{0}' is not a TrueType font. - - - Only TrueType fonts are supported. This is not a TrueType font. - - - Object is currently in use elsewhere. - - - Overflow error. - - - Property cannot be found. - - - Property is not supported. - - - Unknown GDI+ error occurred. - - - Image format is unknown. - - - Current version of GDI+ does not support this feature. - - - Bitmap region is already locked. - Unhandled VT: {0}. diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/RegionScope.cs b/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/RegionScope.cs index 64c4aeb8354..0372a5981f8 100644 --- a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/RegionScope.cs +++ b/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/RegionScope.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Drawing; -using Windows.Win32.Graphics.GdiPlus; namespace Windows.Win32.Graphics.Gdi; @@ -58,48 +57,9 @@ public RegionScope(HDC hdc) } /// - /// Creates a native region from a GDI+ . + /// Creates a region scope with the given . /// - public RegionScope(IPointer region, IPointer graphics) - { - InitializeFromGdiPlus(region.GetPointer(), graphics.GetPointer()); - GC.KeepAlive(region); - GC.KeepAlive(graphics); - } - - private void InitializeFromGdiPlus(GpRegion* region, GpGraphics* graphics) - { - BOOL isInfinite; - PInvokeCore.GdipIsInfiniteRegion(region, graphics, &isInfinite).ThrowIfFailed(); - - if (isInfinite) - { - // An infinite region would cover the entire device region which is the same as - // not having a clipping region. Observe that this is not the same as having an - // empty region, which when clipping to it has the effect of excluding the entire - // device region. - // - // To remove the clip region from a dc the SelectClipRgn() function needs to be - // called with a null region ptr - that's why we use the empty constructor here. - // GDI+ will return IntPtr.Zero for Region.GetHrgn(Graphics) when the region is - // Infinite. - - Region = default; - return; - } - - HRGN hrgn; - PInvokeCore.GdipGetRegionHRgn(region, graphics, &hrgn).ThrowIfFailed(); - Region = hrgn; - } - - public RegionScope(IPointer region, HWND hwnd) - { - GpGraphics* graphics = null; - PInvokeCore.GdipCreateFromHWND(hwnd, &graphics).ThrowIfFailed(); - InitializeFromGdiPlus(region.GetPointer(), graphics); - GC.KeepAlive(region); - } + public RegionScope(HRGN region) => Region = region; /// /// Returns true if this represents a null HRGN. diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/SelectPaletteScope.cs b/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/SelectPaletteScope.cs index 11330ccd401..0538e369c6d 100644 --- a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/SelectPaletteScope.cs +++ b/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/SelectPaletteScope.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using Windows.Win32.Graphics.GdiPlus; - namespace Windows.Win32.Graphics.Gdi; /// @@ -23,8 +21,6 @@ internal readonly ref struct SelectPaletteScope public HDC HDC { get; } public HPALETTE HPALETTE { get; } - private static HPALETTE s_halftonePalette; - public SelectPaletteScope(HDC hdc, HPALETTE hpalette, bool forceBackground, bool realizePalette) { HDC = hdc; @@ -35,40 +31,6 @@ public SelectPaletteScope(HDC hdc, HPALETTE hpalette, bool forceBackground, bool } } - /// - /// Uses the GDI+ halftone palette for the given if the color depth is 8 bpp or less. - /// - public static SelectPaletteScope HalftonePalette(HDC hdc, bool forceBackground, bool realizePalette) - { - if (PInvokeCore.GetDeviceCaps(hdc, GET_DEVICE_CAPS_INDEX.BITSPIXEL) > 8) - { - // https://docs.microsoft.com/windows/win32/api/Gdiplusgraphics/nf-gdiplusgraphics-graphics-gethalftonepalette - // The purpose of the Graphics::GetHalftonePalette method is to enable GDI+ to produce a better - // quality halftone when the display uses 8 bits per pixel. This method allocates a palette of - // 256 entries (each of which are 4 bytes a piece). - // - // Doing this is a bit pointless when the color depth is much higher (the normal scenario). As such - // we'll skip doing this unless we see 8bpp or less. -#if DEBUG - return new SelectPaletteScope(); -#else - return default; -#endif - } - - if (s_halftonePalette.IsNull) - { - GdiPlusInitialization.EnsureInitialized(); - s_halftonePalette = PInvokeCore.GdipCreateHalftonePalette(); - } - - return new SelectPaletteScope( - hdc, - s_halftonePalette, - forceBackground, - realizePalette); - } - public static implicit operator HPALETTE(in SelectPaletteScope paletteScope) => paletteScope.HPALETTE; public void Dispose() diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/GpImageExtensions.cs b/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/GpImageExtensions.cs deleted file mode 100644 index 73130473cf2..00000000000 --- a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/GpImageExtensions.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Drawing; -using System.Runtime.CompilerServices; - -namespace Windows.Win32.Graphics.GdiPlus; - -internal static unsafe class GpImageExtensions -{ - [SkipLocalsInit] - internal static RectangleF GetImageBounds(this IPointer image) - { - RectangleF bounds; - Unit unit; - - PInvokeCore.GdipGetImageBounds(image.GetPointer(), (RectF*)&bounds, &unit).ThrowIfFailed(); - GC.KeepAlive(image); - return bounds; - } - - [SkipLocalsInit] - internal static PixelFormat GetPixelFormat(this IPointer image) - { - int format; - - Status status = PInvokeCore.GdipGetImagePixelFormat(image.GetPointer(), &format); - GC.KeepAlive(image); - return status == Status.Ok ? (PixelFormat)format : PixelFormat.Undefined; - } -} diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/GpMetafileExtensions.cs b/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/GpMetafileExtensions.cs deleted file mode 100644 index b12db4b3d7c..00000000000 --- a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/GpMetafileExtensions.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace Windows.Win32.Graphics.GdiPlus; - -internal static unsafe class GpMetafileExtensions -{ - public static HENHMETAFILE GetHENHMETAFILE(this IPointer metafile) - { - HENHMETAFILE hemf; - PInvokeCore.GdipGetHemfFromMetafile(metafile.GetPointer(), &hemf).ThrowIfFailed(); - GC.KeepAlive(metafile); - return hemf; - } -} diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/System/Ole/IPictureDisp.cs b/src/System.Private.Windows.Core/src/Windows/Win32/System/Ole/IPictureDisp.cs deleted file mode 100644 index 044575e811e..00000000000 --- a/src/System.Private.Windows.Core/src/Windows/Win32/System/Ole/IPictureDisp.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Drawing; - -namespace Windows.Win32.System.Ole; - -internal unsafe partial struct IPictureDisp -{ - public static object CreateObjectFromImage(IImage image) - { - // GetObjectForIUnknown increments the ref count so we need to dispose. - using ComScope picture = CreateFromImage(image); - return (Interface)ComHelpers.GetObjectForIUnknown(picture); - } - - public static ComScope CreateFromImage(IImage image) - { - PICTDESC desc = PICTDESC.FromImage(image); - ComScope picture = new(null); - PInvokeCore.OleCreatePictureIndirect(&desc, IID.Get(), fOwn: true, picture).ThrowOnFailure(); - return picture; - } -} diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/System/Ole/PICTDESC.cs b/src/System.Private.Windows.Core/src/Windows/Win32/System/Ole/PICTDESC.cs deleted file mode 100644 index db7bf3fd517..00000000000 --- a/src/System.Private.Windows.Core/src/Windows/Win32/System/Ole/PICTDESC.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Drawing; -using Windows.Win32.Graphics.GdiPlus; - -namespace Windows.Win32.System.Ole; - -internal partial struct PICTDESC -{ - public static PICTDESC FromBitmap(IPointer bitmap, HPALETTE paletteHandle = default) - { - PICTDESC desc = new() - { - picType = PICTYPE.PICTYPE_BITMAP - }; - - desc.Anonymous.bmp.hbitmap = bitmap.GetHBITMAP(); - desc.Anonymous.bmp.hpal = paletteHandle; - return desc; - } - - public static unsafe PICTDESC FromIcon(IIcon icon, bool copy) - { - PICTDESC desc = new() - { - picType = PICTYPE.PICTYPE_ICON - }; - - Size size = icon.Size; - desc.Anonymous.icon.hicon = copy ? - (HICON)PInvokeCore.CopyImage( - (HANDLE)icon.Handle, - GDI_IMAGE_TYPE.IMAGE_ICON, - size.Width, - size.Height, - IMAGE_FLAGS.LR_DEFAULTCOLOR).Value - : icon.Handle; - - GC.KeepAlive(icon); - return desc; - } - - public static PICTDESC FromMetafile(IPointer metafile) - { - PICTDESC desc = new() - { - picType = PICTYPE.PICTYPE_ENHMETAFILE - }; - - desc.Anonymous.emf.hemf = metafile.GetHENHMETAFILE(); - return desc; - } - - /// - /// Create a struct describing the given . - /// - /// The image type isn't supported. - public static PICTDESC FromImage(IImage image) => image switch - { - IPointer bitmap => FromBitmap(bitmap), - IPointer metafile => FromMetafile(metafile), - _ => throw new InvalidOperationException() - }; -} diff --git a/src/System.Private.Windows.GdiPlus/GlobalUsings.cs b/src/System.Private.Windows.GdiPlus/GlobalUsings.cs new file mode 100644 index 00000000000..bfd91645675 --- /dev/null +++ b/src/System.Private.Windows.GdiPlus/GlobalUsings.cs @@ -0,0 +1,8 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +global using System.Diagnostics; +global using System.Diagnostics.CodeAnalysis; +global using Windows.Win32.Foundation; +global using Windows.Win32.Graphics.Gdi; +global using Windows.Win32.UI.WindowsAndMessaging; diff --git a/src/System.Private.Windows.GdiPlus/NativeMethods.json b/src/System.Private.Windows.GdiPlus/NativeMethods.json new file mode 100644 index 00000000000..9a0d0e74c3e --- /dev/null +++ b/src/System.Private.Windows.GdiPlus/NativeMethods.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://aka.ms/CsWin32.schema.json", + "className": "PInvokeGdiPlus", + "allowMarshaling": false, + "useSafeHandles": false, + "comInterop": { + "preserveSigMethods": [ + "*" + ] + } +} \ No newline at end of file diff --git a/src/System.Private.Windows.GdiPlus/NativeMethods.txt b/src/System.Private.Windows.GdiPlus/NativeMethods.txt new file mode 100644 index 00000000000..e6a6ec926f4 --- /dev/null +++ b/src/System.Private.Windows.GdiPlus/NativeMethods.txt @@ -0,0 +1,535 @@ +EncoderParameters +GdipAddPathArc +GdipAddPathBezier +GdipAddPathBeziers +GdipAddPathBeziersI +GdipAddPathClosedCurve2 +GdipAddPathClosedCurve2I +GdipAddPathCurve2 +GdipAddPathCurve2I +GdipAddPathCurve3 +GdipAddPathCurve3I +GdipAddPathEllipse +GdipAddPathLine +GdipAddPathLine2 +GdipAddPathLine2I +GdipAddPathPath +GdipAddPathPie +GdipAddPathPolygon +GdipAddPathPolygonI +GdipAddPathRectangle +GdipAddPathRectangles +GdipAddPathRectanglesI +GdipAddPathString +GdipBeginContainer +GdipBeginContainer2 +GdipBitmapApplyEffect +GdipBitmapConvertFormat +GdipBitmapGetPixel +GdipBitmapLockBits +GdipBitmapSetPixel +GdipBitmapSetResolution +GdipBitmapUnlockBits +GdipClearPathMarkers +GdipCloneBitmapArea +GdipCloneBitmapAreaI +GdipCloneBrush +GdipCloneCustomLineCap +GdipCloneFont +GdipCloneFontFamily +GdipCloneImage +GdipCloneImageAttributes +GdipCloneMatrix +GdipClonePath +GdipClonePen +GdipCloneRegion +GdipCloneStringFormat +GdipClosePathFigure +GdipClosePathFigures +GdipCombineRegionPath +GdipCombineRegionRect +GdipCombineRegionRegion +GdipComment +GdipCreateAdjustableArrowCap +GdipCreateBitmapFromFile +GdipCreateBitmapFromFileICM +GdipCreateBitmapFromGraphics +GdipCreateBitmapFromHBITMAP +GdipCreateBitmapFromHICON +GdipCreateBitmapFromResource +GdipCreateBitmapFromScan0 +GdipCreateBitmapFromStream +GdipCreateBitmapFromStreamICM +GdipCreateCachedBitmap +GdipCreateCustomLineCap +GdipCreateEffect +GdipCreateFont +GdipCreateFontFamilyFromName +GdipCreateFontFromDC +GdipCreateFontFromLogfont +GdipCreateFromHDC +GdipCreateFromHDC2 +GdipCreateFromHWND +GdipCreateHalftonePalette +GdipCreateHatchBrush +GdipCreateHBITMAPFromBitmap +GdipCreateHICONFromBitmap +GdipCreateImageAttributes +GdipCreateLineBrush +GdipCreateLineBrushFromRect +GdipCreateLineBrushFromRectWithAngle +GdipCreateMatrix +GdipCreateMatrix2 +GdipCreateMatrix3 +GdipCreateMatrix3I +GdipCreateMetafileFromEmf +GdipCreateMetafileFromFile +GdipCreateMetafileFromStream +GdipCreateMetafileFromWmf +GdipCreatePath +GdipCreatePath2 +GdipCreatePath2I +GdipCreatePathGradient +GdipCreatePathGradientFromPath +GdipCreatePathGradientI +GdipCreatePathIter +GdipCreatePen1 +GdipCreatePen2 +GdipCreateRegion +GdipCreateRegionHrgn +GdipCreateRegionPath +GdipCreateRegionRect +GdipCreateRegionRgnData +GdipCreateSolidFill +GdipCreateStringFormat +GdipCreateTexture +GdipCreateTexture2 +GdipCreateTextureIA +GdipDeleteBrush +GdipDeleteCachedBitmap +GdipDeleteCustomLineCap +GdipDeleteCustomLineCap +GdipDeleteEffect +GdipDeleteFont +GdipDeleteFontFamily +GdipDeleteGraphics +GdipDeleteMatrix +GdipDeletePath +GdipDeletePathIter +GdipDeletePen +GdipDeletePrivateFontCollection +GdipDeleteRegion +GdipDeleteStringFormat +GdipDisposeImage +GdipDisposeImage +GdipDisposeImageAttributes +GdipDrawArc +GdipDrawBezier +GdipDrawBeziers +GdipDrawBeziersI +GdipDrawCachedBitmap +GdipDrawClosedCurve +GdipDrawClosedCurve2 +GdipDrawClosedCurve2I +GdipDrawClosedCurveI +GdipDrawCurve +GdipDrawCurve2 +GdipDrawCurve2I +GdipDrawCurve3 +GdipDrawCurve3I +GdipDrawCurveI +GdipDrawEllipse +GdipDrawImage +GdipDrawImageFX +GdipDrawImagePointRect +GdipDrawImagePoints +GdipDrawImagePointsI +GdipDrawImagePointsRect +GdipDrawImagePointsRectI +GdipDrawImageRect +GdipDrawImageRectRect +GdipDrawLine +GdipDrawLines +GdipDrawLinesI +GdipDrawPath +GdipDrawPie +GdipDrawPolygon +GdipDrawPolygonI +GdipDrawRectangle +GdipDrawRectangles +GdipDrawRectanglesI +GdipDrawString +GdipEndContainer +GdipEnumerateMetafileDestPoint +GdipEnumerateMetafileDestPoints +GdipEnumerateMetafileDestPointsI +GdipEnumerateMetafileDestRect +GdipEnumerateMetafileSrcRectDestPoint +GdipEnumerateMetafileSrcRectDestPoints +GdipEnumerateMetafileSrcRectDestPointsI +GdipEnumerateMetafileSrcRectDestRect +GdipFillClosedCurve +GdipFillClosedCurve2 +GdipFillClosedCurve2I +GdipFillClosedCurveI +GdipFillEllipse +GdipFillPath +GdipFillPie +GdipFillPolygon +GdipFillPolygonI +GdipFillRectangle +GdipFillRectangles +GdipFillRectanglesI +GdipFillRegion +GdipFlattenPath +GdipFlush +GdipGetAdjustableArrowCapFillState +GdipGetAdjustableArrowCapHeight +GdipGetAdjustableArrowCapMiddleInset +GdipGetAdjustableArrowCapWidth +GdipGetAllPropertyItems +GdipGetCellAscent +GdipGetCellDescent +GdipGetClip +GdipGetClipBounds +GdipGetCompositingMode +GdipGetCompositingQuality +GdipGetCustomLineCapBaseCap +GdipGetCustomLineCapBaseInset +GdipGetCustomLineCapStrokeCaps +GdipGetCustomLineCapStrokeJoin +GdipGetCustomLineCapType +GdipGetCustomLineCapWidthScale +GdipGetDC +GdipGetDpiX +GdipGetDpiY +GdipGetEmHeight +GdipGetEncoderParameterList +GdipGetEncoderParameterListSize +GdipGetFamily +GdipGetFamilyName +GdipGetFontCollectionFamilyCount +GdipGetFontCollectionFamilyList +GdipGetFontHeight +GdipGetFontHeightGivenDPI +GdipGetFontSize +GdipGetFontStyle +GdipGetFontUnit +GdipGetGenericFontFamilyMonospace +GdipGetGenericFontFamilySansSerif +GdipGetGenericFontFamilySerif +GdipGetHatchBackgroundColor +GdipGetHatchForegroundColor +GdipGetHatchStyle +GdipGetHemfFromMetafile +GdipGetImageAttributesAdjustedPalette +GdipGetImageBounds +GdipGetImageDecoders +GdipGetImageDecodersSize +GdipGetImageDimension +GdipGetImageEncoders +GdipGetImageEncodersSize +GdipGetImageFlags +GdipGetImageGraphicsContext +GdipGetImageHeight +GdipGetImageHorizontalResolution +GdipGetImagePalette +GdipGetImagePaletteSize +GdipGetImagePixelFormat +GdipGetImageRawFormat +GdipGetImageRawFormat +GdipGetImageThumbnail +GdipGetImageType +GdipGetImageVerticalResolution +GdipGetImageWidth +GdipGetInterpolationMode +GdipGetLineBlend +GdipGetLineBlendCount +GdipGetLineColors +GdipGetLineGammaCorrection +GdipGetLinePresetBlend +GdipGetLinePresetBlendCount +GdipGetLineRect +GdipGetLineSpacing +GdipGetLineTransform +GdipGetLineWrapMode +GdipGetLogFont +GdipGetMatrixElements +GdipGetMetafileHeaderFromEmf +GdipGetMetafileHeaderFromFile +GdipGetMetafileHeaderFromMetafile +GdipGetMetafileHeaderFromStream +GdipGetMetafileHeaderFromWmf +GdipGetNearestColor +GdipGetPageScale +GdipGetPageUnit +GdipGetPathData +GdipGetPathFillMode +GdipGetPathGradientBlend +GdipGetPathGradientBlendCount +GdipGetPathGradientCenterColor +GdipGetPathGradientCenterPoint +GdipGetPathGradientFocusScales +GdipGetPathGradientPresetBlend +GdipGetPathGradientPresetBlendCount +GdipGetPathGradientRect +GdipGetPathGradientSurroundColorCount +GdipGetPathGradientSurroundColorsWithCount +GdipGetPathGradientTransform +GdipGetPathGradientWrapMode +GdipGetPathLastPoint +GdipGetPathPoints +GdipGetPathTypes +GdipGetPathWorldBounds +GdipGetPenBrushFill +GdipGetPenColor +GdipGetPenCompoundArray +GdipGetPenCompoundCount +GdipGetPenCustomEndCap +GdipGetPenCustomStartCap +GdipGetPenDashArray +GdipGetPenDashCap197819 +GdipGetPenDashCount +GdipGetPenDashOffset +GdipGetPenDashStyle +GdipGetPenEndCap +GdipGetPenFillType +GdipGetPenLineJoin +GdipGetPenMiterLimit +GdipGetPenMode +GdipGetPenStartCap +GdipGetPenTransform +GdipGetPenWidth +GdipGetPixelOffsetMode +GdipGetPointCount +GdipGetPropertyCount +GdipGetPropertyIdList +GdipGetPropertyItem +GdipGetPropertyItemSize +GdipGetPropertySize +GdipGetRegionBounds +GdipGetRegionData +GdipGetRegionDataSize +GdipGetRegionHRgn +GdipGetRegionScans +GdipGetRegionScansCount +GdipGetRenderingOrigin +GdipGetSmoothingMode +GdipGetSolidFillColor +GdipGetStringFormatAlign +GdipGetStringFormatDigitSubstitution +GdipGetStringFormatFlags +GdipGetStringFormatHotkeyPrefix +GdipGetStringFormatLineAlign +GdipGetStringFormatMeasurableCharacterRangeCount +GdipGetStringFormatTabStopCount +GdipGetStringFormatTabStops +GdipGetStringFormatTrimming +GdipGetTextContrast +GdipGetTextRenderingHint +GdipGetTextureImage +GdipGetTextureTransform +GdipGetTextureWrapMode +GdipGetVisibleClipBounds +GdipGetWorldTransform +GdipGraphicsClear +GdipImageForceValidation +GdipImageGetFrameCount +GdipImageGetFrameDimensionsCount +GdipImageGetFrameDimensionsList +GdipImageRotateFlip +GdipImageSelectActiveFrame +GdipInitializePalette +GdipInvertMatrix +GdipIsClipEmpty +GdipIsEmptyRegion +GdipIsEqualRegion +GdipIsInfiniteRegion +GdipIsMatrixEqual +GdipIsMatrixIdentity +GdipIsMatrixInvertible +GdipIsOutlineVisiblePathPoint +GdipIsStyleAvailable +GdipIsVisibleClipEmpty +GdipIsVisiblePathPoint +GdipIsVisiblePoint +GdipIsVisibleRect +GdipIsVisibleRegionPoint +GdipIsVisibleRegionRect +GdipLoadImageFromFile +GdipLoadImageFromFileICM +GdipLoadImageFromStream +GdipLoadImageFromStreamICM +GdiplusStartup +GdiplusStartupInputEx +GdipMeasureCharacterRanges +GdipMeasureString +GdipMultiplyLineTransform +GdipMultiplyMatrix +GdipMultiplyPathGradientTransform +GdipMultiplyPenTransform +GdipMultiplyTextureTransform +GdipMultiplyWorldTransform +GdipNewInstalledFontCollection +GdipNewPrivateFontCollection +GdipPathIterCopyData +GdipPathIterEnumerate +GdipPathIterGetCount +GdipPathIterGetSubpathCount +GdipPathIterHasCurve +GdipPathIterIsValid +GdipPathIterNextMarker +GdipPathIterNextMarkerPath +GdipPathIterNextPathType +GdipPathIterNextSubpath +GdipPathIterNextSubpathPath +GdipPathIterRewind +GdipPlayMetafileRecord +GdipPrivateAddFontFile +GdipPrivateAddMemoryFont +GdipRecordMetafile +GdipRecordMetafileFileName +GdipRecordMetafileStream +GdipReleaseDC +GdipRemovePropertyItem +GdipResetClip +GdipResetLineTransform +GdipResetPath +GdipResetPathGradientTransform +GdipResetPenTransform +GdipResetTextureTransform +GdipResetWorldTransform +GdipRestoreGraphics +GdipReversePath +GdipRotateLineTransform +GdipRotateMatrix +GdipRotatePathGradientTransform +GdipRotatePenTransform +GdipRotateTextureTransform +GdipRotateWorldTransform +GdipSaveAdd +GdipSaveAddImage +GdipSaveGraphics +GdipSaveImageToFile +GdipSaveImageToStream +GdipScaleLineTransform +GdipScaleMatrix +GdipScalePathGradientTransform +GdipScalePenTransform +GdipScaleTextureTransform +GdipScaleWorldTransform +GdipSetAdjustableArrowCapFillState +GdipSetAdjustableArrowCapHeight +GdipSetAdjustableArrowCapMiddleInset +GdipSetAdjustableArrowCapWidth +GdipSetClipGraphics +GdipSetClipPath +GdipSetClipRect +GdipSetClipRegion +GdipSetCompositingMode +GdipSetCompositingQuality +GdipSetCustomLineCapBaseCap +GdipSetCustomLineCapBaseInset +GdipSetCustomLineCapStrokeCaps +GdipSetCustomLineCapStrokeJoin +GdipSetCustomLineCapWidthScale +GdipSetEffectParameters +GdipSetEmpty +GdipSetImageAttributesColorKeys +GdipSetImageAttributesColorMatrix +GdipSetImageAttributesGamma +GdipSetImageAttributesNoOp +GdipSetImageAttributesOutputChannel +GdipSetImageAttributesOutputChannelColorProfile +GdipSetImageAttributesRemapTable +GdipSetImageAttributesThreshold +GdipSetImageAttributesWrapMode +GdipSetImagePalette +GdipSetInfinite +GdipSetInterpolationMode +GdipSetLineBlend +GdipSetLineColors +GdipSetLineGammaCorrection +GdipSetLineLinearBlend +GdipSetLinePresetBlend +GdipSetLineSigmaBlend +GdipSetLineTransform +GdipSetLineWrapMode +GdipSetMatrixElements +GdipSetPageScale +GdipSetPageUnit +GdipSetPathFillMode +GdipSetPathGradientBlend +GdipSetPathGradientCenterColor +GdipSetPathGradientCenterPoint +GdipSetPathGradientFocusScales +GdipSetPathGradientLinearBlend +GdipSetPathGradientPresetBlend +GdipSetPathGradientSigmaBlend +GdipSetPathGradientSurroundColorsWithCount +GdipSetPathGradientTransform +GdipSetPathGradientWrapMode +GdipSetPathMarker +GdipSetPenBrushFill +GdipSetPenColor +GdipSetPenCompoundArray +GdipSetPenCustomEndCap +GdipSetPenCustomStartCap +GdipSetPenDashArray +GdipSetPenDashCap197819 +GdipSetPenDashOffset +GdipSetPenDashStyle +GdipSetPenEndCap +GdipSetPenLineCap197819 +GdipSetPenLineJoin +GdipSetPenMiterLimit +GdipSetPenMode +GdipSetPenStartCap +GdipSetPenTransform +GdipSetPenWidth +GdipSetPixelOffsetMode +GdipSetPropertyItem +GdipSetRenderingOrigin +GdipSetSmoothingMode +GdipSetSolidFillColor +GdipSetStringFormatAlign +GdipSetStringFormatDigitSubstitution +GdipSetStringFormatFlags +GdipSetStringFormatHotkeyPrefix +GdipSetStringFormatLineAlign +GdipSetStringFormatMeasurableCharacterRanges +GdipSetStringFormatTabStops +GdipSetStringFormatTrimming +GdipSetTextContrast +GdipSetTextRenderingHint +GdipSetTextureTransform +GdipSetTextureWrapMode +GdipSetWorldTransform +GdipShearMatrix +GdipStartPathFigure +GdipStringFormatGetGenericDefault +GdipStringFormatGetGenericTypographic +GdipTransformMatrixPoints +GdipTransformMatrixPointsI +GdipTransformPath +GdipTransformPoints +GdipTransformPointsI +GdipTransformRegion +GdipTranslateClip +GdipTranslateLineTransform +GdipTranslateMatrix +GdipTranslatePathGradientTransform +GdipTranslatePenTransform +GdipTranslateRegion +GdipTranslateTextureTransform +GdipTranslateWorldTransform +GdipVectorTransformMatrixPoints +GdipVectorTransformMatrixPointsI +GdipWarpPath +GdipWidenPath +GpBitmap +GpGraphics +GpImage +GpRegion +ImageFormat* +PixelFormat* \ No newline at end of file diff --git a/src/System.Private.Windows.GdiPlus/Properties/AssemblyInfo.cs b/src/System.Private.Windows.GdiPlus/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..8607a14ec88 --- /dev/null +++ b/src/System.Private.Windows.GdiPlus/Properties/AssemblyInfo.cs @@ -0,0 +1,67 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Runtime.CompilerServices; + +[assembly: System.Runtime.InteropServices.ComVisible(false)] + +[assembly: InternalsVisibleTo($"System.Windows.Forms, PublicKey={PublicKeys.Ecma}")] +[assembly: InternalsVisibleTo($"System.Windows.Forms.Design, PublicKey={PublicKeys.Ecma}")] +[assembly: InternalsVisibleTo($"System.Windows.Forms.Design.Editors, PublicKey={PublicKeys.Ecma}")] +[assembly: InternalsVisibleTo($"System.Windows.Forms.Primitives, PublicKey={PublicKeys.Ecma}")] +[assembly: InternalsVisibleTo($"System.Drawing.Common, PublicKey={PublicKeys.Open}")] + +[assembly: InternalsVisibleTo($"System.Windows.Forms.Design.Tests, PublicKey={PublicKeys.Ecma}")] +[assembly: InternalsVisibleTo($"System.Windows.Forms.Primitives.Tests, PublicKey={PublicKeys.Ecma}")] +[assembly: InternalsVisibleTo($"System.Windows.Forms.Primitives.TestUtilities, PublicKey={PublicKeys.Ecma}")] +[assembly: InternalsVisibleTo($"System.Windows.Forms.Tests, PublicKey={PublicKeys.Ecma}")] +[assembly: InternalsVisibleTo($"System.Private.Windows.Core.Tests, PublicKey={PublicKeys.Ecma}")] +[assembly: InternalsVisibleTo($"BinaryFormatTests, PublicKey={PublicKeys.Ecma}")] +[assembly: InternalsVisibleTo($"System.Windows.Forms.TestUtilities, PublicKey={PublicKeys.Ecma}")] +[assembly: InternalsVisibleTo($"System.Windows.Forms.UI.IntegrationTests, PublicKey={PublicKeys.Ecma}")] +[assembly: InternalsVisibleTo($"System.Windows.Forms.Interop.Tests, PublicKey={PublicKeys.Ecma}")] +[assembly: InternalsVisibleTo($"System.Drawing.Common.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"WinformsControlsTest, PublicKey={PublicKeys.Ecma}")] +[assembly: InternalsVisibleTo($"System.Windows.Forms.IntegrationTests.Common, PublicKey={PublicKeys.Ecma}")] +[assembly: InternalsVisibleTo($"NativeHost.ManagedControl, PublicKey={PublicKeys.Ecma}")] +[assembly: InternalsVisibleTo($"ScratchProjectWithInternals, PublicKey={PublicKeys.Ecma}")] +[assembly: InternalsVisibleTo($"ComDisabled.Tests, PublicKey={PublicKeys.Ecma}")] + +// This is needed in order to Moq internal interfaces for testing +[assembly: InternalsVisibleTo($"DynamicProxyGenAssembly2, PublicKey={PublicKeys.Moq}")] + +// WPF assemblies +[assembly: InternalsVisibleTo($"PresentationBuildTasks, PublicKey={PublicKeys.MicrosoftShared}")] +[assembly: InternalsVisibleTo($"PresentationCore, PublicKey={PublicKeys.MicrosoftShared}")] +[assembly: InternalsVisibleTo($"PresentationFramework, PublicKey={PublicKeys.MicrosoftShared}")] +[assembly: InternalsVisibleTo($"PresentationUI, PublicKey={PublicKeys.MicrosoftShared}")] +[assembly: InternalsVisibleTo($"ReachFramework, PublicKey={PublicKeys.MicrosoftShared}")] +[assembly: InternalsVisibleTo($"System.Printing, PublicKey={PublicKeys.MicrosoftShared}")] +[assembly: InternalsVisibleTo($"System.Windows.Controls.Ribbon, PublicKey={PublicKeys.Ecma}")] +[assembly: InternalsVisibleTo($"System.Windows.Input.Manipulations, PublicKey={PublicKeys.Ecma}")] +[assembly: InternalsVisibleTo($"System.Windows.Presentation, PublicKey={PublicKeys.Ecma}")] +[assembly: InternalsVisibleTo($"System.Windows.Primitives, PublicKey={PublicKeys.MicrosoftShared}")] +[assembly: InternalsVisibleTo($"System.Xaml, PublicKey={PublicKeys.Ecma}")] +[assembly: InternalsVisibleTo($"UIAutomationClient, PublicKey={PublicKeys.MicrosoftShared}")] +[assembly: InternalsVisibleTo($"UIAutomationClientSideProviders, PublicKey={PublicKeys.Ecma}")] +[assembly: InternalsVisibleTo($"UIAutomationProvider, PublicKey={PublicKeys.MicrosoftShared}")] +[assembly: InternalsVisibleTo($"UIAutomationTypes, PublicKey={PublicKeys.MicrosoftShared}")] +[assembly: InternalsVisibleTo($"WindowsBase, PublicKey={PublicKeys.MicrosoftShared}")] +[assembly: InternalsVisibleTo($"WindowsFormsIntegration, PublicKey={PublicKeys.MicrosoftShared}")] + +[assembly: InternalsVisibleTo($"PresentationBuildTasks.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"PresentationCore.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"PresentationFramework.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"PresentationUI.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"ReachFramework.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"System.Windows.Controls.Ribbon.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"System.Windows.Input.Manipulations.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"System.Windows.Presentation.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"System.Windows.Primitives.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"System.Xaml.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"UIAutomationClient.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"UIAutomationClientSideProviders.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"UIAutomationProvider.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"UIAutomationTypes.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"WindowsBase.Tests, PublicKey={PublicKeys.Open}")] +[assembly: InternalsVisibleTo($"WindowsFormsIntegration.Tests, PublicKey={PublicKeys.Open}")] diff --git a/src/System.Private.Windows.GdiPlus/Resources/SR.resx b/src/System.Private.Windows.GdiPlus/Resources/SR.resx new file mode 100644 index 00000000000..820bcdefd68 --- /dev/null +++ b/src/System.Private.Windows.GdiPlus/Resources/SR.resx @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Function was ended. + + + File access is denied. + + + A Graphics object cannot be created from an image that has an indexed pixel format. + + + SetPixel is not supported for images with indexed pixel formats. + + + Destination points define a parallelogram which must have a length of 3. These points will represent the upper-left, upper-right, and lower-left coordinates (defined in that order). + + + Destination points must be an array with a length of 3 or 4. A length of 3 defines a parallelogram with the upper-left, upper-right, and lower-left corners. A length of 4 defines a quadrilateral with the fourth element of the array specifying the lower-right coordinate. + + + File not found. + + + Font '{0}' cannot be found. + + + Font '{0}' does not support style '{1}'. + + + A generic error occurred in GDI+. + + + Buffer is too small (internal GDI+ error). + + + Parameter is not valid. + + + Rectangle '{0}' cannot have a width or height equal to 0. + + + Operation requires a transformation of the image from GDI+ to GDI. GDI does not support images with a width or height greater than 32767. + + + Out of memory. + + + Not implemented. + + + GDI+ is not properly initialized (internal GDI+ error). + + + Only TrueType fonts are supported. '{0}' is not a TrueType font. + + + Only TrueType fonts are supported. This is not a TrueType font. + + + Object is currently in use elsewhere. + + + Overflow error. + + + Property cannot be found. + + + Property is not supported. + + + Unknown GDI+ error occurred. + + + Image format is unknown. + + + Current version of GDI+ does not support this feature. + + + Bitmap region is already locked. + + + System.Drawing.Common is not supported on non-Windows platforms. See https://aka.ms/systemdrawingnonwindows for more information. + + diff --git a/src/System.Private.Windows.GdiPlus/System.Private.Windows.GdiPlus.csproj b/src/System.Private.Windows.GdiPlus/System.Private.Windows.GdiPlus.csproj new file mode 100644 index 00000000000..61d6d5dc738 --- /dev/null +++ b/src/System.Private.Windows.GdiPlus/System.Private.Windows.GdiPlus.csproj @@ -0,0 +1,49 @@ + + + + System.Private.Windows.GdiPlus + $(NetCurrent);$(NetPrevious);$(NetMinimum) + + + true + enable + ECMA + + $(NoWarn);CS8981 + + $(NoWarn);CS3016;SYSLIB5005 + true + true + false + + true + false + + + + + + + + + + + + + + + false + System.Private.Windows.GdiPlus.Resources.SR + true + + + + diff --git a/src/System.Private.Windows.Core/src/System/Drawing/ApplyGraphicsProperties.cs b/src/System.Private.Windows.GdiPlus/System/Drawing/ApplyGraphicsProperties.cs similarity index 100% rename from src/System.Private.Windows.Core/src/System/Drawing/ApplyGraphicsProperties.cs rename to src/System.Private.Windows.GdiPlus/System/Drawing/ApplyGraphicsProperties.cs diff --git a/src/System.Private.Windows.Core/src/System/Drawing/CoreImageExtensions.cs b/src/System.Private.Windows.GdiPlus/System/Drawing/CoreImageExtensions.cs similarity index 74% rename from src/System.Private.Windows.Core/src/System/Drawing/CoreImageExtensions.cs rename to src/System.Private.Windows.GdiPlus/System/Drawing/CoreImageExtensions.cs index c678c822556..770d251fd0c 100644 --- a/src/System.Private.Windows.Core/src/System/Drawing/CoreImageExtensions.cs +++ b/src/System.Private.Windows.GdiPlus/System/Drawing/CoreImageExtensions.cs @@ -18,28 +18,28 @@ internal static void Save(this IImage image, Stream stream, Guid encoder, Guid f throw new ArgumentNullException(nameof(encoder)); } - if (format == PInvokeCore.ImageFormatGIF && image.Data is { } rawData && rawData.Length > 0) + if (format == PInvokeGdiPlus.ImageFormatGIF && image.Data is { } rawData && rawData.Length > 0) { stream.Write(rawData); return; } using var iStream = stream.ToIStream(); - PInvokeCore.GdipSaveImageToStream(image.GetPointer(), iStream, &encoder, encoderParameters).ThrowIfFailed(); + PInvokeGdiPlus.GdipSaveImageToStream(image.GetPointer(), iStream, &encoder, encoderParameters).ThrowIfFailed(); } internal static void Save(this IImage image, MemoryStream stream) { Guid format = default; - PInvokeCore.GdipGetImageRawFormat(image.GetPointer(), &format).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetImageRawFormat(image.GetPointer(), &format).ThrowIfFailed(); Guid encoder = ImageCodecInfoHelper.GetEncoderClsid(format); // Jpeg loses data, so we don't want to use it to serialize. We'll use PNG instead. // If we don't find an Encoder (for things like Icon), we just switch back to PNG. - if (format == PInvokeCore.ImageFormatJPEG || encoder == Guid.Empty) + if (format == PInvokeGdiPlus.ImageFormatJPEG || encoder == Guid.Empty) { - format = PInvokeCore.ImageFormatPNG; + format = PInvokeGdiPlus.ImageFormatPNG; encoder = ImageCodecInfoHelper.GetEncoderClsid(format); } diff --git a/src/System.Private.Windows.Core/src/System/Drawing/IGraphics.cs b/src/System.Private.Windows.GdiPlus/System/Drawing/IGraphics.cs similarity index 100% rename from src/System.Private.Windows.Core/src/System/Drawing/IGraphics.cs rename to src/System.Private.Windows.GdiPlus/System/Drawing/IGraphics.cs diff --git a/src/System.Private.Windows.Core/src/System/Drawing/IGraphicsContextInfo.cs b/src/System.Private.Windows.GdiPlus/System/Drawing/IGraphicsContextInfo.cs similarity index 100% rename from src/System.Private.Windows.Core/src/System/Drawing/IGraphicsContextInfo.cs rename to src/System.Private.Windows.GdiPlus/System/Drawing/IGraphicsContextInfo.cs diff --git a/src/System.Private.Windows.Core/src/System/Drawing/IIcon.cs b/src/System.Private.Windows.GdiPlus/System/Drawing/IIcon.cs similarity index 100% rename from src/System.Private.Windows.Core/src/System/Drawing/IIcon.cs rename to src/System.Private.Windows.GdiPlus/System/Drawing/IIcon.cs diff --git a/src/System.Private.Windows.GdiPlus/System/Drawing/IIconExtensions.cs b/src/System.Private.Windows.GdiPlus/System/Drawing/IIconExtensions.cs new file mode 100644 index 00000000000..7af0f66c470 --- /dev/null +++ b/src/System.Private.Windows.GdiPlus/System/Drawing/IIconExtensions.cs @@ -0,0 +1,47 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Runtime.InteropServices; +using Windows.Win32; +using Windows.Win32.System.Ole; + +namespace System.Drawing; + +public static unsafe class IIconExtensions +{ + internal static unsafe PICTDESC CreatePICTDESC(this IIcon icon, bool copy) + { + PICTDESC desc = new() + { + picType = PICTYPE.PICTYPE_ICON + }; + + Size size = icon.Size; + desc.Anonymous.icon.hicon = copy ? + (HICON)PInvokeCore.CopyImage( + (HANDLE)icon.Handle, + GDI_IMAGE_TYPE.IMAGE_ICON, + size.Width, + size.Height, + IMAGE_FLAGS.LR_DEFAULTCOLOR).Value + : icon.Handle; + + GC.KeepAlive(icon); + return desc; + } + + internal static object CreateIPictureRCW(this IIcon icon, bool copy) + { + // GetObjectForIUnknown increments the ref count so we need to dispose. + using ComScope picture = icon.CreateIPicture(copy); + return Marshal.GetObjectForIUnknown(picture); + } + + internal static ComScope CreateIPicture(this IIcon icon, bool copy) + { + PICTDESC desc = icon.CreatePICTDESC(copy); + ComScope picture = new(null); + PInvokeCore.OleCreatePictureIndirect(&desc, IID.Get(), fOwn: copy, picture).ThrowOnFailure(); + return picture; + } +} diff --git a/src/System.Private.Windows.Core/src/System/Drawing/IImage.cs b/src/System.Private.Windows.GdiPlus/System/Drawing/IImage.cs similarity index 100% rename from src/System.Private.Windows.Core/src/System/Drawing/IImage.cs rename to src/System.Private.Windows.GdiPlus/System/Drawing/IImage.cs diff --git a/src/System.Private.Windows.Core/src/System/Drawing/ImageCodecInfoHelper.cs b/src/System.Private.Windows.GdiPlus/System/Drawing/ImageCodecInfoHelper.cs similarity index 90% rename from src/System.Private.Windows.Core/src/System/Drawing/ImageCodecInfoHelper.cs rename to src/System.Private.Windows.GdiPlus/System/Drawing/ImageCodecInfoHelper.cs index 4e33755bcff..b97615c639a 100644 --- a/src/System.Private.Windows.Core/src/System/Drawing/ImageCodecInfoHelper.cs +++ b/src/System.Private.Windows.GdiPlus/System/Drawing/ImageCodecInfoHelper.cs @@ -41,13 +41,13 @@ private static unsafe (Guid Format, Guid Encoder)[] Encoders uint numEncoders; uint size; - PInvokeCore.GdipGetImageEncodersSize(&numEncoders, &size).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetImageEncodersSize(&numEncoders, &size).ThrowIfFailed(); using BufferScope buffer = new((int)size); fixed (byte* b = buffer) { - PInvokeCore.GdipGetImageEncoders(numEncoders, size, (ImageCodecInfo*)b).ThrowIfFailed(); + PInvokeGdiPlus.GdipGetImageEncoders(numEncoders, size, (ImageCodecInfo*)b).ThrowIfFailed(); ReadOnlySpan codecInfo = new((ImageCodecInfo*)b, (int)numEncoders); s_encoders = new (Guid Format, Guid Encoder)[codecInfo.Length]; diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/DeviceContextHdcScope.cs b/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/Gdi/DeviceContextHdcScope.cs similarity index 100% rename from src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/DeviceContextHdcScope.cs rename to src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/Gdi/DeviceContextHdcScope.cs diff --git a/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/Gdi/HdcExtensions.cs b/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/Gdi/HdcExtensions.cs new file mode 100644 index 00000000000..6f9289d9a8c --- /dev/null +++ b/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/Gdi/HdcExtensions.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Windows.Win32.Graphics.GdiPlus; + +namespace Windows.Win32.Graphics.Gdi; + +internal static class HdcExtensions +{ + private static HPALETTE s_halftonePalette; + + /// + public static SelectPaletteScope HalftonePalette(this GetDcScope hdc, bool forceBackground, bool realizePalette) => + HalftonePalette(hdc.HDC, forceBackground, realizePalette); + + /// + /// Uses the GDI+ halftone palette for the given if the color depth is 8 bpp or less. + /// + public static SelectPaletteScope HalftonePalette(this T hdc, bool forceBackground, bool realizePalette) + where T : IHandle + { + if (PInvokeCore.GetDeviceCaps(hdc.Handle, GET_DEVICE_CAPS_INDEX.BITSPIXEL) > 8) + { + // https://docs.microsoft.com/windows/win32/api/Gdiplusgraphics/nf-gdiplusgraphics-graphics-gethalftonepalette + // The purpose of the Graphics::GetHalftonePalette method is to enable GDI+ to produce a better + // quality halftone when the display uses 8 bits per pixel. This method allocates a palette of + // 256 entries (each of which are 4 bytes a piece). + // + // Doing this is a bit pointless when the color depth is much higher (the normal scenario). As such + // we'll skip doing this unless we see 8bpp or less. +#if DEBUG + return new SelectPaletteScope(); +#else + return default; +#endif + } + + if (s_halftonePalette.IsNull) + { + GdiPlusInitialization.EnsureInitialized(); + s_halftonePalette = PInvokeGdiPlus.GdipCreateHalftonePalette(); + } + + return new SelectPaletteScope( + hdc.Handle, + s_halftonePalette, + forceBackground, + realizePalette); + } +} diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/IGraphicsHdcProvider.cs b/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/Gdi/IGraphicsHdcProvider.cs similarity index 100% rename from src/System.Private.Windows.Core/src/Windows/Win32/Graphics/Gdi/IGraphicsHdcProvider.cs rename to src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/Gdi/IGraphicsHdcProvider.cs diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/EncoderParameters.cs b/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/EncoderParameters.cs similarity index 100% rename from src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/EncoderParameters.cs rename to src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/EncoderParameters.cs diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/GdiPlusInitialization.cs b/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/GdiPlusInitialization.cs similarity index 69% rename from src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/GdiPlusInitialization.cs rename to src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/GdiPlusInitialization.cs index b399831ef0f..6600bf57e4d 100644 --- a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/GdiPlusInitialization.cs +++ b/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/GdiPlusInitialization.cs @@ -8,7 +8,7 @@ namespace Windows.Win32.Graphics.GdiPlus; /// internal static partial class GdiPlusInitialization { - private static readonly nuint s_initToken = Init(); + private static nuint s_initToken; private static unsafe nuint Init() { @@ -19,12 +19,12 @@ private static unsafe nuint Init() nuint token; GdiplusStartupInputEx startup = GdiplusStartupInputEx.GetDefault(); - PInvokeCore.GdiplusStartup(&token, (GdiplusStartupInput*)&startup, null).ThrowIfFailed(); + PInvokeGdiPlus.GdiplusStartup(&token, (GdiplusStartupInput*)&startup, null).ThrowIfFailed(); return token; } /// - /// Returns true if GDI+ has been started. + /// Attempts to ensure that GGI+ is initialized. Returns if GDI+ has been started. /// /// /// @@ -33,11 +33,21 @@ private static unsafe nuint Init() /// so it is not necessary for methods defined there. /// /// - /// We don't do this implicitly in the Core assembly to avoid unnecessary loading of GDI+. - /// - /// /// https://github.com/microsoft/CsWin32/issues/1308 tracks a proposal to make this more automatic. /// /// - internal static bool EnsureInitialized() => s_initToken != 0; + internal static bool EnsureInitialized() + { + if (s_initToken == 0) + { + s_initToken = Init(); + } + + return IsInitialized; + } + + /// + /// Returns if GDI+ has been started. + /// + internal static bool IsInitialized => s_initToken != 0; } diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/GdiplusStartupInputEx.cs b/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/GdiplusStartupInputEx.cs similarity index 100% rename from src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/GdiplusStartupInputEx.cs rename to src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/GdiplusStartupInputEx.cs diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/GpBitmapExtensions.cs b/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/GpBitmapExtensions.cs similarity index 59% rename from src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/GpBitmapExtensions.cs rename to src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/GpBitmapExtensions.cs index 7e8c09236ae..0cd5a54ca34 100644 --- a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/GpBitmapExtensions.cs +++ b/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/GpBitmapExtensions.cs @@ -3,6 +3,8 @@ using System.Drawing; using System.Runtime.CompilerServices; +using DrawingColor = System.Drawing.Color; +using Windows.Win32.System.Ole; namespace Windows.Win32.Graphics.GdiPlus; @@ -16,7 +18,7 @@ public static void LockBits( ref BitmapData data) { // LockBits always creates a temporary copy of the data. - PInvokeCore.GdipBitmapLockBits( + PInvokeGdiPlus.GdipBitmapLockBits( bitmap.GetPointer(), rect.IsEmpty ? null : (Rect*)&rect, (uint)flags, @@ -28,16 +30,16 @@ public static void LockBits( public static void UnlockBits(this IPointer bitmap, ref BitmapData data) { - PInvokeCore.GdipBitmapUnlockBits(bitmap.GetPointer(), (BitmapData*)Unsafe.AsPointer(ref data)).ThrowIfFailed(); + PInvokeGdiPlus.GdipBitmapUnlockBits(bitmap.GetPointer(), (BitmapData*)Unsafe.AsPointer(ref data)).ThrowIfFailed(); GC.KeepAlive(bitmap); } - public static HBITMAP GetHBITMAP(this IPointer bitmap) => bitmap.GetHBITMAP(Color.LightGray); + public static HBITMAP GetHBITMAP(this IPointer bitmap) => bitmap.GetHBITMAP(DrawingColor.LightGray); - public static HBITMAP GetHBITMAP(this IPointer bitmap, Color background) + public static HBITMAP GetHBITMAP(this IPointer bitmap, DrawingColor background) { HBITMAP hbitmap; - PInvokeCore.GdipCreateHBITMAPFromBitmap( + PInvokeGdiPlus.GdipCreateHBITMAPFromBitmap( bitmap.GetPointer(), &hbitmap, (uint)ColorTranslator.ToWin32(background)).ThrowIfFailed(); @@ -45,4 +47,19 @@ public static HBITMAP GetHBITMAP(this IPointer bitmap, Color backgroun GC.KeepAlive(bitmap); return hbitmap; } + + /// + /// Creates a structure from the specified . + /// + public static PICTDESC CreatePICTDESC(this IPointer bitmap, HPALETTE paletteHandle = default) + { + PICTDESC desc = new() + { + picType = PICTYPE.PICTYPE_BITMAP + }; + + desc.Anonymous.bmp.hbitmap = bitmap.GetHBITMAP(); + desc.Anonymous.bmp.hpal = paletteHandle; + return desc; + } } diff --git a/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/GpImageExtensions.cs b/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/GpImageExtensions.cs new file mode 100644 index 00000000000..15be356d18e --- /dev/null +++ b/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/GpImageExtensions.cs @@ -0,0 +1,73 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Drawing; +using System.Runtime.CompilerServices; +using Windows.Win32.System.Ole; + +namespace Windows.Win32.Graphics.GdiPlus; + +internal static unsafe class GpImageExtensions +{ + [SkipLocalsInit] + internal static RectangleF GetImageBounds(this IPointer image) + { + RectangleF bounds; + Unit unit; + + PInvokeGdiPlus.GdipGetImageBounds(image.GetPointer(), (RectF*)&bounds, &unit).ThrowIfFailed(); + GC.KeepAlive(image); + return bounds; + } + + [SkipLocalsInit] + internal static PixelFormat GetPixelFormat(this IPointer image) + { + int format; + + Status status = PInvokeGdiPlus.GdipGetImagePixelFormat(image.GetPointer(), &format); + GC.KeepAlive(image); + return status == Status.Ok ? (PixelFormat)format : PixelFormat.Undefined; + } + + /// + /// Create a struct describing the given . + /// + /// The image type isn't supported. + public static PICTDESC CreatePICTDESC(this IPointer image) => image switch + { + IPointer bitmap => bitmap.CreatePICTDESC(), + IPointer metafile => metafile.CreatePICTDESC(), + _ => throw new InvalidOperationException() + }; + + public static IPictureDisp.Interface CreateIPictureDispRCW(this IPointer image) + { + // GetObjectForIUnknown increments the ref count so we need to dispose. + using ComScope picture = image.CreateIPictureDisp(); + return (IPictureDisp.Interface)ComHelpers.GetObjectForIUnknown(picture); + } + + public static ComScope CreateIPictureDisp(this IPointer image) + { + PICTDESC desc = image.CreatePICTDESC(); + ComScope picture = new(null); + PInvokeCore.OleCreatePictureIndirect(&desc, IID.Get(), fOwn: true, picture).ThrowOnFailure(); + return picture; + } + + public static object CreateIPictureRCW(this IPointer image) + { + // GetObjectForIUnknown increments the ref count so we need to dispose. + using ComScope picture = image.CreateIPicture(); + return (IPicture.Interface)ComHelpers.GetObjectForIUnknown(picture); + } + + public static ComScope CreateIPicture(this IPointer image) + { + PICTDESC desc = image.CreatePICTDESC(); + ComScope picture = new(null); + PInvokeCore.OleCreatePictureIndirect(&desc, IID.Get(), fOwn: true, picture).ThrowOnFailure(); + return picture; + } +} diff --git a/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/GpMetafileExtensions.cs b/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/GpMetafileExtensions.cs new file mode 100644 index 00000000000..8ebcfa800aa --- /dev/null +++ b/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/GpMetafileExtensions.cs @@ -0,0 +1,31 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Windows.Win32.System.Ole; + +namespace Windows.Win32.Graphics.GdiPlus; + +internal static unsafe class GpMetafileExtensions +{ + public static HENHMETAFILE GetHENHMETAFILE(this IPointer metafile) + { + HENHMETAFILE hemf; + PInvokeGdiPlus.GdipGetHemfFromMetafile(metafile.GetPointer(), &hemf).ThrowIfFailed(); + GC.KeepAlive(metafile); + return hemf; + } + + /// + /// Creates a structure from the specified . + /// + public static PICTDESC CreatePICTDESC(this IPointer metafile) + { + PICTDESC desc = new() + { + picType = PICTYPE.PICTYPE_ENHMETAFILE + }; + + desc.Anonymous.emf.hemf = metafile.GetHENHMETAFILE(); + return desc; + } +} diff --git a/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/GpRegionExtensions.cs b/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/GpRegionExtensions.cs new file mode 100644 index 00000000000..8c06bcc40f9 --- /dev/null +++ b/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/GpRegionExtensions.cs @@ -0,0 +1,55 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Windows.Win32.Graphics.GdiPlus; + +internal static unsafe class GpRegionExtensions +{ + /// + /// Creates a native region from a GDI+ and . + /// + public static RegionScope GetRegionScope(this IPointer region, IPointer graphics) + { + RegionScope scope = new(InitializeFromGdiPlus(region.GetPointer(), graphics.GetPointer())); + GC.KeepAlive(region); + GC.KeepAlive(graphics); + return scope; + } + + /// + /// Creates a native region from a GDI+ and . + /// + public static RegionScope GetRegionScope(this IPointer region, HWND hwnd) + { + GpGraphics* graphics = null; + PInvokeGdiPlus.GdipCreateFromHWND(hwnd, &graphics).ThrowIfFailed(); + RegionScope scope = new(InitializeFromGdiPlus(region.GetPointer(), graphics)); + GC.KeepAlive(region); + return scope; + } + + private static HRGN InitializeFromGdiPlus(GpRegion* region, GpGraphics* graphics) + { + BOOL isInfinite; + PInvokeGdiPlus.GdipIsInfiniteRegion(region, graphics, &isInfinite).ThrowIfFailed(); + + if (isInfinite) + { + // An infinite region would cover the entire device region which is the same as + // not having a clipping region. Observe that this is not the same as having an + // empty region, which when clipping to it has the effect of excluding the entire + // device region. + // + // To remove the clip region from a dc the SelectClipRgn() function needs to be + // called with a null region ptr - that's why we use the empty constructor here. + // GDI+ will return IntPtr.Zero for Region.GetHrgn(Graphics) when the region is + // Infinite. + + return HRGN.Null; + } + + HRGN hrgn; + PInvokeGdiPlus.GdipGetRegionHRgn(region, graphics, &hrgn).ThrowIfFailed(); + return hrgn; + } +} diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/PixelFormat.cs b/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/PixelFormat.cs similarity index 92% rename from src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/PixelFormat.cs rename to src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/PixelFormat.cs index e404ff0e819..dd26dd5dea5 100644 --- a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/PixelFormat.cs +++ b/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/PixelFormat.cs @@ -9,39 +9,39 @@ internal enum PixelFormat /// Specifies that pixel data contains color indexed values which means they are an index to colors in the /// system color table, as opposed to individual color values. /// - Indexed = (int)PInvokeCore.PixelFormatIndexed, + Indexed = (int)PInvokeGdiPlus.PixelFormatIndexed, /// /// Specifies that pixel data contains GDI colors. /// - Gdi = (int)PInvokeCore.PixelFormatGDI, + Gdi = (int)PInvokeGdiPlus.PixelFormatGDI, /// /// Specifies that pixel data contains alpha values that are not pre-multiplied. /// - Alpha = (int)PInvokeCore.PixelFormatAlpha, + Alpha = (int)PInvokeGdiPlus.PixelFormatAlpha, /// /// Specifies that pixel format contains pre-multiplied alpha values. /// - PAlpha = (int)PInvokeCore.PixelFormatPAlpha, + PAlpha = (int)PInvokeGdiPlus.PixelFormatPAlpha, /// /// Specifies that pixel format contains extended color values of 16 bits per channel. /// - Extended = (int)PInvokeCore.PixelFormatExtended, + Extended = (int)PInvokeGdiPlus.PixelFormatExtended, - Canonical = (int)PInvokeCore.PixelFormatCanonical, + Canonical = (int)PInvokeGdiPlus.PixelFormatCanonical, /// /// Specifies that pixel format is undefined. /// - Undefined = (int)PInvokeCore.PixelFormatUndefined, + Undefined = (int)PInvokeGdiPlus.PixelFormatUndefined, /// /// Specifies that pixel format doesn't matter. /// - DontCare = (int)PInvokeCore.PixelFormatDontCare, + DontCare = (int)PInvokeGdiPlus.PixelFormatDontCare, /// /// Specifies that pixel format is 1 bit per pixel indexed color. The color table therefore has two colors in it. diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/Rect.cs b/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/Rect.cs similarity index 100% rename from src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/Rect.cs rename to src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/Rect.cs diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/RectF.cs b/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/RectF.cs similarity index 100% rename from src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/RectF.cs rename to src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/RectF.cs diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/StatusExtensions.cs b/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/StatusExtensions.cs similarity index 98% rename from src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/StatusExtensions.cs rename to src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/StatusExtensions.cs index c3121563abb..3914f4f2378 100644 --- a/src/System.Private.Windows.Core/src/Windows/Win32/Graphics/GdiPlus/StatusExtensions.cs +++ b/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/GdiPlus/StatusExtensions.cs @@ -1,8 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Private.Windows.Core.Resources; using System.Runtime.InteropServices; +using System.Private.Windows.GdiPlus.Resources; namespace Windows.Win32.Graphics.GdiPlus; diff --git a/src/System.Private.Windows.GdiPlus/Windows/Win32/PInvokeGdiPlus.cs b/src/System.Private.Windows.GdiPlus/Windows/Win32/PInvokeGdiPlus.cs new file mode 100644 index 00000000000..c3c93115353 --- /dev/null +++ b/src/System.Private.Windows.GdiPlus/Windows/Win32/PInvokeGdiPlus.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Reflection; +using System.Runtime.InteropServices; +using Windows.Win32.Graphics.GdiPlus; +using System.Private.Windows.GdiPlus.Resources; + +namespace Windows.Win32; + +internal static partial class PInvokeGdiPlus +{ + static PInvokeGdiPlus() + { + // Ensure GDI+ is initialized before the first PInvoke call. Note that this has to happen after + // the DPI awareness context is set for scaling to occur correctly. + if (!OperatingSystem.IsWindows()) + { + NativeLibrary.SetDllImportResolver(Assembly.GetExecutingAssembly(), static (_, _, _) => + throw new PlatformNotSupportedException(SR.PlatformNotSupported_Unix)); + } + + bool initialized = GdiPlusInitialization.EnsureInitialized(); + + Debug.Assert(initialized); + } +} diff --git a/src/System.Private.Windows.Core/src/Windows/Win32/System/Ole/IPicture.cs b/src/System.Private.Windows.GdiPlus/Windows/Win32/System/Ole/IPicture.cs similarity index 78% rename from src/System.Private.Windows.Core/src/Windows/Win32/System/Ole/IPicture.cs rename to src/System.Private.Windows.GdiPlus/Windows/Win32/System/Ole/IPicture.cs index 55e49ff7102..88b1bb760a4 100644 --- a/src/System.Private.Windows.Core/src/Windows/Win32/System/Ole/IPicture.cs +++ b/src/System.Private.Windows.GdiPlus/Windows/Win32/System/Ole/IPicture.cs @@ -3,21 +3,22 @@ using System.Drawing; using System.Runtime.InteropServices; +using Windows.Win32.Graphics.GdiPlus; namespace Windows.Win32.System.Ole; -internal unsafe partial struct IPicture +internal static unsafe class IPictureExtensions { - public static object CreateObjectFromImage(IImage image) + public static object CreateObjectFromImage(IPointer image) { // GetObjectForIUnknown increments the ref count so we need to dispose. using ComScope picture = CreateFromImage(image); return Marshal.GetObjectForIUnknown(picture); } - public static ComScope CreateFromImage(IImage image) + public static ComScope CreateFromImage(IPointer image) { - PICTDESC desc = PICTDESC.FromImage(image); + PICTDESC desc = image.CreatePICTDESC(); ComScope picture = new(null); PInvokeCore.OleCreatePictureIndirect(&desc, IID.Get(), fOwn: true, picture).ThrowOnFailure(); return picture; @@ -32,7 +33,7 @@ public static object CreateObjectFromIcon(IIcon icon, bool copy) public static ComScope CreateFromIcon(IIcon icon, bool copy) { - PICTDESC desc = PICTDESC.FromIcon(icon, copy); + PICTDESC desc = icon.CreatePICTDESC(copy); ComScope picture = new(null); PInvokeCore.OleCreatePictureIndirect(&desc, IID.Get(), fOwn: copy, picture).ThrowOnFailure(); return picture; diff --git a/src/System.Windows.Forms.Primitives/src/System.Windows.Forms.Primitives.csproj b/src/System.Windows.Forms.Primitives/src/System.Windows.Forms.Primitives.csproj index 456903a6e82..027b42e8757 100644 --- a/src/System.Windows.Forms.Primitives/src/System.Windows.Forms.Primitives.csproj +++ b/src/System.Windows.Forms.Primitives/src/System.Windows.Forms.Primitives.csproj @@ -36,6 +36,7 @@ + diff --git a/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Ole32/IPictureTests.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Ole32/IPictureTests.cs index 80368a8c9b7..35c870a1780 100644 --- a/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Ole32/IPictureTests.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Ole32/IPictureTests.cs @@ -3,6 +3,7 @@ using System.Drawing; using System.Windows.Forms.Primitives.Tests.Interop.Mocks; +using Windows.Win32.Graphics.GdiPlus; using Windows.Win32.System.Com; using Windows.Win32.System.Ole; using Windows.Win32.System.Variant; @@ -17,7 +18,7 @@ public void GetIPictureFromCursor() { using MockCursor arrow = new(PInvoke.IDC_ARROW); - using var picture = IPicture.CreateFromIcon(Icon.FromHandle(arrow.Handle), copy: true); + using var picture = Icon.FromHandle(arrow.Handle).CreateIPicture(copy: true); Assert.False(picture.IsNull); picture.Value->get_Type(out PICTYPE type); Assert.Equal(PICTYPE.PICTYPE_ICON, type); @@ -34,7 +35,7 @@ public void GetIPictureFromImage() using MockCursor arrow = new(PInvoke.IDC_ARROW); using Icon icon = Icon.FromHandle(arrow.Handle); using Bitmap bitmap = icon.ToBitmap(); - using var picture = IPicture.CreateFromImage(bitmap); + using var picture = bitmap.CreateIPicture(); Assert.False(picture.IsNull); picture.Value->get_Type(out PICTYPE type); Assert.Equal(PICTYPE.PICTYPE_BITMAP, type); @@ -50,7 +51,7 @@ public void GetIPictureDispFromImage() { using Icon icon = SystemIcons.Question; using Bitmap bitmap = icon.ToBitmap(); - using var picture = IPictureDisp.CreateFromImage(bitmap); + using var picture = bitmap.CreateIPictureDisp(); Assert.False(picture.IsNull); using VARIANT variant = default; @@ -70,7 +71,7 @@ public void GetPictureFromIPicture() { using Icon icon = SystemIcons.Exclamation; using Bitmap bitmap = icon.ToBitmap(); - using var picture = IPicture.CreateFromImage(bitmap); + using var picture = bitmap.CreateIPicture(); Assert.False(picture.IsNull); using Image? image = ImageExtensions.ToImage(picture); Assert.NotNull(image); @@ -81,7 +82,7 @@ public void GetPictureFromIPicture() public void GetPictureFromIPictureDisp() { using Bitmap bitmap = new(100, 200); - using var picture = IPictureDisp.CreateFromImage(bitmap); + using var picture = bitmap.CreateIPictureDisp(); Assert.False(picture.IsNull); using Image? image = ImageExtensions.ToImage(picture); Assert.NotNull(image); diff --git a/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Oleaut32/ITypeInfoTests.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Oleaut32/ITypeInfoTests.cs index 2dc5baab52b..7a9289e3818 100644 --- a/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Oleaut32/ITypeInfoTests.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Oleaut32/ITypeInfoTests.cs @@ -5,6 +5,7 @@ using Windows.Win32.System.Com; using Windows.Win32.System.Ole; using Windows.Win32.System.Variant; +using Windows.Win32.Graphics.GdiPlus; namespace System.Windows.Forms.Primitives.Tests.Interop.Oleaut32; @@ -15,7 +16,7 @@ public class ITypeInfoTests public unsafe void ITypeInfo_AddressOfMember_Invoke_Success() { using Bitmap image = new(16, 32); - using var iPictureDisp = IPictureDisp.CreateFromImage(image); + using var iPictureDisp = image.CreateIPictureDisp(); Assert.False(iPictureDisp.IsNull); using ComScope typeInfo = new(null); ((IDispatch*)iPictureDisp.Value)->GetTypeInfo(0, PInvokeCore.GetThreadLocale(), typeInfo); @@ -29,7 +30,7 @@ public unsafe void ITypeInfo_AddressOfMember_Invoke_Success() public unsafe void ITypeInfo_CreateInstance_Invoke_Success() { using Bitmap image = new(16, 32); - using var iPictureDisp = IPictureDisp.CreateFromImage(image); + using var iPictureDisp = image.CreateIPictureDisp(); Assert.False(iPictureDisp.IsNull); using ComScope typeInfo = new(null); ((IDispatch*)iPictureDisp.Value)->GetTypeInfo(0, PInvokeCore.GetThreadLocale(), typeInfo); @@ -43,7 +44,7 @@ public unsafe void ITypeInfo_CreateInstance_Invoke_Success() public unsafe void ITypeInfo_GetContainingTypeLib_Invoke_Success() { using Bitmap image = new(16, 32); - using var iPictureDisp = IPictureDisp.CreateFromImage(image); + using var iPictureDisp = image.CreateIPictureDisp(); Assert.False(iPictureDisp.IsNull); using ComScope typeInfo = new(null); ((IDispatch*)iPictureDisp.Value)->GetTypeInfo(0, PInvokeCore.GetThreadLocale(), typeInfo); @@ -59,7 +60,7 @@ public unsafe void ITypeInfo_GetContainingTypeLib_Invoke_Success() public unsafe void ITypeInfo_GetDllEntry_Invoke_Success() { using Bitmap image = new(16, 32); - using var iPictureDisp = IPictureDisp.CreateFromImage(image); + using var iPictureDisp = image.CreateIPictureDisp(); Assert.False(iPictureDisp.IsNull); using ComScope typeInfo = new(null); ((IDispatch*)iPictureDisp.Value)->GetTypeInfo(0, PInvokeCore.GetThreadLocale(), typeInfo); @@ -79,7 +80,7 @@ public unsafe void ITypeInfo_GetDllEntry_Invoke_Success() public unsafe void ITypeInfo_GetDocumentation_Invoke_Success() { using Bitmap image = new(16, 32); - using var iPictureDisp = IPictureDisp.CreateFromImage(image); + using var iPictureDisp = image.CreateIPictureDisp(); Assert.False(iPictureDisp.IsNull); using ComScope typeInfo = new(null); ((IDispatch*)iPictureDisp.Value)->GetTypeInfo(0, PInvokeCore.GetThreadLocale(), typeInfo); @@ -99,7 +100,7 @@ public unsafe void ITypeInfo_GetDocumentation_Invoke_Success() public unsafe void ITypeInfo_GetFuncDesc_Invoke_Success() { using Bitmap image = new(16, 32); - using var iPictureDisp = IPictureDisp.CreateFromImage(image); + using var iPictureDisp = image.CreateIPictureDisp(); Assert.False(iPictureDisp.IsNull); using ComScope typeInfo = new(null); ((IDispatch*)iPictureDisp.Value)->GetTypeInfo(0, PInvokeCore.GetThreadLocale(), typeInfo); @@ -133,7 +134,7 @@ public unsafe void ITypeInfo_GetFuncDesc_Invoke_Success() public unsafe void ITypeInfo_GetIDsOfNames_Invoke_Success() { using Bitmap image = new(16, 32); - using var iPictureDisp = IPictureDisp.CreateFromImage(image); + using var iPictureDisp = image.CreateIPictureDisp(); Assert.False(iPictureDisp.IsNull); using ComScope typeInfo = new(null); ((IDispatch*)iPictureDisp.Value)->GetTypeInfo(0, PInvokeCore.GetThreadLocale(), typeInfo); @@ -148,7 +149,7 @@ public unsafe void ITypeInfo_GetIDsOfNames_Invoke_Success() { typeInfo.Value->GetIDsOfNames(pRgszNames, (uint)rgszNames.Length, pRgDispId); Assert.Equal([width, other], rgszNames); - Assert.Equal(new int[] { (int)PInvokeCore.DISPID_PICT_WIDTH, PInvokeCore.DISPID_UNKNOWN }, rgDispId); + Assert.Equal([(int)PInvokeCore.DISPID_PICT_WIDTH, PInvokeCore.DISPID_UNKNOWN], rgDispId); } } } @@ -157,7 +158,7 @@ public unsafe void ITypeInfo_GetIDsOfNames_Invoke_Success() public unsafe void ITypeInfo_GetImplTypeFlags_Invoke_Success() { using Bitmap image = new(16, 32); - using var iPictureDisp = IPictureDisp.CreateFromImage(image); + using var iPictureDisp = image.CreateIPictureDisp(); Assert.False(iPictureDisp.IsNull); using ComScope typeInfo = new(null); ((IDispatch*)iPictureDisp.Value)->GetTypeInfo(0, PInvokeCore.GetThreadLocale(), typeInfo); @@ -171,7 +172,7 @@ public unsafe void ITypeInfo_GetImplTypeFlags_Invoke_Success() public unsafe void ITypeInfo_GetMops_Invoke_Success() { using Bitmap image = new(16, 32); - using var iPictureDisp = IPictureDisp.CreateFromImage(image); + using var iPictureDisp = image.CreateIPictureDisp(); Assert.False(iPictureDisp.IsNull); using ComScope typeInfo = new(null); ((IDispatch*)iPictureDisp.Value)->GetTypeInfo(0, PInvokeCore.GetThreadLocale(), typeInfo); @@ -185,7 +186,7 @@ public unsafe void ITypeInfo_GetMops_Invoke_Success() public unsafe void ITypeInfo_GetNames_Invoke_Success() { using Bitmap image = new(16, 32); - using var iPictureDisp = IPictureDisp.CreateFromImage(image); + using var iPictureDisp = image.CreateIPictureDisp(); Assert.False(iPictureDisp.IsNull); using ComScope typeInfo = new(null); ((IDispatch*)iPictureDisp.Value)->GetTypeInfo(0, PInvokeCore.GetThreadLocale(), typeInfo); @@ -207,7 +208,7 @@ public unsafe void ITypeInfo_GetNames_Invoke_Success() public unsafe void ITypeInfo_GetRefTypeInfo_Invoke_Success() { using Bitmap image = new(16, 32); - using var iPictureDisp = IPictureDisp.CreateFromImage(image); + using var iPictureDisp = image.CreateIPictureDisp(); Assert.False(iPictureDisp.IsNull); using ComScope typeInfo = new(null); ((IDispatch*)iPictureDisp.Value)->GetTypeInfo(0, PInvokeCore.GetThreadLocale(), typeInfo); @@ -224,7 +225,7 @@ public unsafe void ITypeInfo_GetRefTypeInfo_Invoke_Success() public unsafe void ITypeInfo_GetRefTypeOfImplType_Invoke_Success() { using Bitmap image = new(16, 32); - using var iPictureDisp = IPictureDisp.CreateFromImage(image); + using var iPictureDisp = image.CreateIPictureDisp(); Assert.False(iPictureDisp.IsNull); using ComScope typeInfo = new(null); ((IDispatch*)iPictureDisp.Value)->GetTypeInfo(0, PInvokeCore.GetThreadLocale(), typeInfo); @@ -238,7 +239,7 @@ public unsafe void ITypeInfo_GetRefTypeOfImplType_Invoke_Success() public unsafe void ITypeInfo_GetTypeAttr_Invoke_Success() { using Bitmap image = new(16, 32); - using var iPictureDisp = IPictureDisp.CreateFromImage(image); + using var iPictureDisp = image.CreateIPictureDisp(); Assert.False(iPictureDisp.IsNull); using ComScope typeInfo = new(null); ((IDispatch*)iPictureDisp.Value)->GetTypeInfo(0, PInvokeCore.GetThreadLocale(), typeInfo); @@ -277,7 +278,7 @@ public unsafe void ITypeInfo_GetTypeAttr_Invoke_Success() public unsafe void ITypeInfo_GetTypeComp_Invoke_Success() { using Bitmap image = new(16, 32); - using var iPictureDisp = IPictureDisp.CreateFromImage(image); + using var iPictureDisp = image.CreateIPictureDisp(); Assert.False(iPictureDisp.IsNull); using ComScope typeInfo = new(null); ((IDispatch*)iPictureDisp.Value)->GetTypeInfo(0, PInvokeCore.GetThreadLocale(), typeInfo); @@ -290,7 +291,7 @@ public unsafe void ITypeInfo_GetTypeComp_Invoke_Success() public unsafe void ITypeInfo_GetVarDesc_Invoke_Success() { using Bitmap image = new(16, 32); - using var iPictureDisp = IPictureDisp.CreateFromImage(image); + using var iPictureDisp = image.CreateIPictureDisp(); Assert.False(iPictureDisp.IsNull); using ComScope typeInfo = new(null); ((IDispatch*)iPictureDisp.Value)->GetTypeInfo(0, PInvokeCore.GetThreadLocale(), typeInfo); @@ -319,7 +320,7 @@ public unsafe void ITypeInfo_GetVarDesc_Invoke_Success() public unsafe void ITypeInfo_Invoke_Invoke_Success() { using Bitmap image = new(16, 32); - using var iPictureDisp = IPictureDisp.CreateFromImage(image); + using var iPictureDisp = image.CreateIPictureDisp(); Assert.False(iPictureDisp.IsNull); using ComScope typeInfo = new(null); ((IDispatch*)iPictureDisp.Value)->GetTypeInfo(0, PInvokeCore.GetThreadLocale(), typeInfo); diff --git a/src/System.Windows.Forms.Primitives/tests/UnitTests/Windows/Win32/System/Com/IDispatchTests.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/Windows/Win32/System/Com/IDispatchTests.cs index 6861c57751d..5699190ff48 100644 --- a/src/System.Windows.Forms.Primitives/tests/UnitTests/Windows/Win32/System/Com/IDispatchTests.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/Windows/Win32/System/Com/IDispatchTests.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Drawing; -using Windows.Win32.System.Ole; +using Windows.Win32.Graphics.GdiPlus; using Windows.Win32.System.Variant; namespace Windows.Win32.System.Com.Tests; @@ -14,7 +14,7 @@ public partial class IDispatchTests public unsafe void IDispatch_GetIDsOfNames_Invoke_Success() { using Bitmap image = new(16, 32); - using var picture = IPictureDisp.CreateFromImage(image); + using var picture = image.CreateIPictureDisp(); Assert.False(picture.IsNull); Guid riid = Guid.Empty; @@ -29,7 +29,7 @@ public unsafe void IDispatch_GetIDsOfNames_Invoke_Success() picture.Value->GetIDsOfNames(&riid, pRgszNames, (uint)rgszNames.Length, PInvokeCore.GetThreadLocale(), pRgDispId); Assert.Equal([width, other], rgszNames); - Assert.Equal(new int[] { (int)PInvokeCore.DISPID_PICT_WIDTH, PInvokeCore.DISPID_UNKNOWN }, rgDispId); + Assert.Equal([(int)PInvokeCore.DISPID_PICT_WIDTH, PInvokeCore.DISPID_UNKNOWN], rgDispId); } } } @@ -38,7 +38,7 @@ public unsafe void IDispatch_GetIDsOfNames_Invoke_Success() public unsafe void IDispatch_GetTypeInfo_Invoke_Success() { using Bitmap image = new(16, 16); - using var picture = IPictureDisp.CreateFromImage(image); + using var picture = image.CreateIPictureDisp(); Assert.False(picture.IsNull); using ComScope typeInfo = new(null); @@ -49,7 +49,7 @@ public unsafe void IDispatch_GetTypeInfo_Invoke_Success() public unsafe void IDispatch_GetTypeInfoCount_Invoke_Success() { using Bitmap image = new(16, 16); - using var picture = IPictureDisp.CreateFromImage(image); + using var picture = image.CreateIPictureDisp(); Assert.False(picture.IsNull); uint ctInfo = uint.MaxValue; @@ -61,7 +61,7 @@ public unsafe void IDispatch_GetTypeInfoCount_Invoke_Success() public unsafe void IDispatch_Invoke_Invoke_Success() { using Bitmap image = new(16, 32); - using var picture = IPictureDisp.CreateFromImage(image); + using var picture = image.CreateIPictureDisp(); Assert.False(picture.IsNull); using VARIANT varResult = default; diff --git a/src/System.Windows.Forms/src/GlobalUsings.cs b/src/System.Windows.Forms/src/GlobalUsings.cs index e4fa790eeef..b07ec1ab7ee 100644 --- a/src/System.Windows.Forms/src/GlobalUsings.cs +++ b/src/System.Windows.Forms/src/GlobalUsings.cs @@ -15,3 +15,7 @@ global using Windows.Win32.UI.WindowsAndMessaging; global using PCWSTR = Windows.Win32.Foundation.PCWSTR; global using PWSTR = Windows.Win32.Foundation.PWSTR; + +global using Color = System.Drawing.Color; +global using Point = System.Drawing.Point; +global using PointF = System.Drawing.PointF; diff --git a/src/System.Windows.Forms/src/System/Resources/DataNodeInfo.cs b/src/System.Windows.Forms/src/System/Resources/DataNodeInfo.cs index cb4c5c5c695..7183063475c 100644 --- a/src/System.Windows.Forms/src/System/Resources/DataNodeInfo.cs +++ b/src/System.Windows.Forms/src/System/Resources/DataNodeInfo.cs @@ -1,10 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; - namespace System.Resources; - internal class DataNodeInfo { public required string Name { get; set; } diff --git a/src/System.Windows.Forms/src/System/Resources/ResXDataNode.cs b/src/System.Windows.Forms/src/System/Resources/ResXDataNode.cs index 4559b2790ae..87f6631f9c8 100644 --- a/src/System.Windows.Forms/src/System/Resources/ResXDataNode.cs +++ b/src/System.Windows.Forms/src/System/Resources/ResXDataNode.cs @@ -3,7 +3,6 @@ using System.ComponentModel; using System.ComponentModel.Design; -using System.Drawing; using System.Formats.Nrbf; using System.Globalization; using System.Reflection; diff --git a/src/System.Windows.Forms/src/System/Resources/ResXResourceReader.cs b/src/System.Windows.Forms/src/System/Resources/ResXResourceReader.cs index db0c682ed29..ff75d8f25b1 100644 --- a/src/System.Windows.Forms/src/System/Resources/ResXResourceReader.cs +++ b/src/System.Windows.Forms/src/System/Resources/ResXResourceReader.cs @@ -3,7 +3,6 @@ using System.Collections; using System.ComponentModel.Design; -using System.Drawing; using System.Globalization; using System.Reflection; using System.Runtime.Serialization; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.OleInterfaces.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.OleInterfaces.cs index 5b400ffc955..59dd64568e4 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.OleInterfaces.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.OleInterfaces.cs @@ -3,7 +3,6 @@ using System.ComponentModel; using System.ComponentModel.Design; -using System.Drawing; using System.Runtime.InteropServices; using Windows.Win32.System.Com; using Windows.Win32.System.Ole; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.cs index 741b948bbae..93ce4ee65c3 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.cs @@ -10,6 +10,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Microsoft.VisualStudio.Shell; +using Windows.Win32.Graphics.GdiPlus; using Windows.Win32.System.Com; using Windows.Win32.System.Com.StructuredStorage; using Windows.Win32.System.Ole; @@ -3527,22 +3528,20 @@ private ComScope TryGetComScope(out HRESULT hr) where T : unmanaged, IComI /// Maps from a System.Drawing.Image to an OLE IPicture /// [EditorBrowsable(EditorBrowsableState.Advanced)] - protected static object? GetIPictureFromPicture(Image? image) - => image is null ? null : IPicture.CreateObjectFromImage(image); + protected static object? GetIPictureFromPicture(Image? image) => image?.CreateIPictureRCW(); /// /// Maps from a System.Drawing.Cursor to an OLE IPicture /// [EditorBrowsable(EditorBrowsableState.Advanced)] protected static object? GetIPictureFromCursor(Cursor? cursor) - => cursor is null ? null : IPicture.CreateObjectFromIcon(Icon.FromHandle(cursor.Handle), copy: true); + => cursor is null ? null : Icon.FromHandle(cursor.Handle).CreateIPictureRCW(copy: true); /// /// Maps from a System.Drawing.Image to an OLE IPictureDisp /// [EditorBrowsable(EditorBrowsableState.Advanced)] - protected static object? GetIPictureDispFromPicture(Image? image) - => image is null ? null : IPictureDisp.CreateObjectFromImage(image); + protected static object? GetIPictureDispFromPicture(Image? image) => image?.CreateIPictureDispRCW(); /// /// Maps from an OLE IPicture to a System.Drawing.Image diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ComponentModel/COM2Interop/COM2PictureConverter.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ComponentModel/COM2Interop/COM2PictureConverter.cs index 0943905e3b9..79181ada0b3 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/ComponentModel/COM2Interop/COM2PictureConverter.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/ComponentModel/COM2Interop/COM2PictureConverter.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Drawing; +using Windows.Win32.Graphics.GdiPlus; using Windows.Win32.System.Com; using Windows.Win32.System.Ole; using Windows.Win32.System.Variant; @@ -103,11 +104,11 @@ public override VARIANT ConvertManagedToNative(object? managedValue, Com2Propert PICTDESC pictdesc; if (managedValue is Icon icon) { - pictdesc = PICTDESC.FromIcon(icon, copy: false); + pictdesc = icon.CreatePICTDESC(copy: false); } else if (managedValue is Bitmap bitmap) { - pictdesc = PICTDESC.FromBitmap(bitmap); + pictdesc = bitmap.CreatePICTDESC(); own = true; } else diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Control.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Control.cs index 6129e480b90..97fb2978718 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Control.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Control.cs @@ -12,6 +12,7 @@ using System.Windows.Forms.Layout; using System.Windows.Forms.Primitives; using Windows.Win32.Graphics.Dwm; +using Windows.Win32.Graphics.GdiPlus; using Windows.Win32.System.Ole; using Windows.Win32.UI.Accessibility; using Windows.Win32.UI.Input.KeyboardAndMouse; @@ -2742,7 +2743,7 @@ public Region? Region // If we're an ActiveX control, clone the region so it can potentially be modified using Region? regionCopy = IsActiveX ? ActiveXMergeRegion(region.Clone()) : null; - using RegionScope regionHandle = new(regionCopy ?? region, HWND); + using RegionScope regionHandle = (regionCopy ?? region).GetRegionScope(HWND); if (PInvoke.SetWindowRgn(this, regionHandle, PInvoke.IsWindowVisible(this)) != 0) { @@ -5774,7 +5775,7 @@ public unsafe void Invalidate(Region? region, bool invalidateChildren) else if (IsHandleCreated) { using Graphics graphics = CreateGraphicsInternal(); - using RegionScope regionHandle = new(region, graphics); + using RegionScope regionHandle = region.GetRegionScope(graphics); if (invalidateChildren) { @@ -11713,7 +11714,7 @@ private void WmPaint(ref Message m) PaintEventArgs? pevent = null; using var paletteScope = doubleBuffered || usingBeginPaint - ? SelectPaletteScope.HalftonePalette(dc, forceBackground: false, realizePalette: false) + ? dc.HalftonePalette(forceBackground: false, realizePalette: false) : default; bool paintBackground = (usingBeginPaint && GetStyle(ControlStyles.AllPaintingInWmPaint)) || doubleBuffered; @@ -11814,8 +11815,7 @@ private void WmQueryNewPalette(ref Message m) using GetDcScope dc = new(HWND); // We don't want to unset the palette in this case so we don't do this in a using. - var paletteScope = SelectPaletteScope.HalftonePalette( - dc, + var paletteScope = dc.HalftonePalette( forceBackground: true, realizePalette: true); diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/ButtonInternal/ButtonBaseAdapter.ColorData.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/ButtonInternal/ButtonBaseAdapter.ColorData.cs index ef7456749f9..2c8bca588b0 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/ButtonInternal/ButtonBaseAdapter.ColorData.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/ButtonInternal/ButtonBaseAdapter.ColorData.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; - namespace System.Windows.Forms.ButtonInternal; internal abstract partial class ButtonBaseAdapter diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/ButtonInternal/CheckBoxFlatAdapter.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/ButtonInternal/CheckBoxFlatAdapter.cs index da2f5503bd6..c14017ce380 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/ButtonInternal/CheckBoxFlatAdapter.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/ButtonInternal/CheckBoxFlatAdapter.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; - namespace System.Windows.Forms.ButtonInternal; internal class CheckBoxFlatAdapter : CheckBoxBaseAdapter diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/ButtonInternal/RadioButtonFlatAdapter.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/ButtonInternal/RadioButtonFlatAdapter.cs index 4ffc36558ee..9986c57642c 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/ButtonInternal/RadioButtonFlatAdapter.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/ButtonInternal/RadioButtonFlatAdapter.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; - namespace System.Windows.Forms.ButtonInternal; internal class RadioButtonFlatAdapter : RadioButtonBaseAdapter diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/ButtonInternal/RadioButtonPopupAdapter.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/ButtonInternal/RadioButtonPopupAdapter.cs index 72f809d1103..bf3aa38a2fd 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/ButtonInternal/RadioButtonPopupAdapter.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/ButtonInternal/RadioButtonPopupAdapter.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; - namespace System.Windows.Forms.ButtonInternal; internal class RadioButtonPopupAdapter : RadioButtonFlatAdapter diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/FlatButtonAppearance.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/FlatButtonAppearance.cs index a787a881f3f..2377fbf24f9 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/FlatButtonAppearance.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/FlatButtonAppearance.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.ComponentModel; -using System.Drawing; using System.Windows.Forms.Layout; namespace System.Windows.Forms; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridView.AccessibleObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridView.AccessibleObject.cs index ac88d2bd798..b5601cea4d0 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridView.AccessibleObject.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridView.AccessibleObject.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; using Windows.Win32.System.Variant; using Windows.Win32.UI.Accessibility; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewColumnCollection.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewColumnCollection.cs index 4698f893bc2..81ff68ba2c6 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewColumnCollection.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewColumnCollection.cs @@ -3,7 +3,6 @@ using System.Collections; using System.ComponentModel; -using System.Drawing; using System.Globalization; namespace System.Windows.Forms; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewComboBoxEditingControl.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewComboBoxEditingControl.cs index 5841b04a53f..f48dc4b8920 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewComboBoxEditingControl.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewComboBoxEditingControl.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; using System.Globalization; namespace System.Windows.Forms; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewRowCollection.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewRowCollection.cs index 9f9c64dfad5..19912a705e5 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewRowCollection.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewRowCollection.cs @@ -4,7 +4,6 @@ using System.Collections; using System.ComponentModel; using System.ComponentModel.Design.Serialization; -using System.Drawing; namespace System.Windows.Forms; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewTextBoxEditingControl.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewTextBoxEditingControl.cs index a3630dc7be2..417f826298f 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewTextBoxEditingControl.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/DataGridView/DataGridViewTextBoxEditingControl.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; - namespace System.Windows.Forms; public partial class DataGridViewTextBoxEditingControl : TextBox, IDataGridViewEditingControl diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Labels/LinkLabel.LinkLabelAccessibleObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Labels/LinkLabel.LinkLabelAccessibleObject.cs index 224fc19d68f..9c11c829872 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Labels/LinkLabel.LinkLabelAccessibleObject.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Labels/LinkLabel.LinkLabelAccessibleObject.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; using Windows.Win32.System.Variant; using Windows.Win32.UI.Accessibility; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ListView/SearchForVirtualItemEventArgs.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ListView/SearchForVirtualItemEventArgs.cs index 5eebab61e46..d97e008af04 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ListView/SearchForVirtualItemEventArgs.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ListView/SearchForVirtualItemEventArgs.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; - namespace System.Windows.Forms; public class SearchForVirtualItemEventArgs : EventArgs diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/MonthCalendar/MonthCalendar.CalendarButtonAccessibleObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/MonthCalendar/MonthCalendar.CalendarButtonAccessibleObject.cs index 8686ea2ca16..ce98bdd5a53 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/MonthCalendar/MonthCalendar.CalendarButtonAccessibleObject.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/MonthCalendar/MonthCalendar.CalendarButtonAccessibleObject.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; using System.Runtime.InteropServices; using Windows.Win32.System.Variant; using Windows.Win32.UI.Accessibility; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/MonthCalendar/MonthCalendar.HitTestInfo.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/MonthCalendar/MonthCalendar.HitTestInfo.cs index ab54d00d5d3..f8e29eb1e91 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/MonthCalendar/MonthCalendar.HitTestInfo.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/MonthCalendar/MonthCalendar.HitTestInfo.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; - namespace System.Windows.Forms; public partial class MonthCalendar diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/MonthCalendar/MonthCalendar.MonthCalendarAccessibleObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/MonthCalendar/MonthCalendar.MonthCalendarAccessibleObject.cs index eb83ec73391..349b630d740 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/MonthCalendar/MonthCalendar.MonthCalendarAccessibleObject.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/MonthCalendar/MonthCalendar.MonthCalendarAccessibleObject.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; using Windows.Win32.System.Variant; using Windows.Win32.UI.Accessibility; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGrid.PropertyGridAccessibleObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGrid.PropertyGridAccessibleObject.cs index d3f8c4d2b61..eefb4a58a4c 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGrid.PropertyGridAccessibleObject.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGrid.PropertyGridAccessibleObject.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; using Windows.Win32.UI.Accessibility; namespace System.Windows.Forms; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.PropertyGridViewAccessibleObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.PropertyGridViewAccessibleObject.cs index b02aca6f787..1674c705b59 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.PropertyGridViewAccessibleObject.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.PropertyGridViewAccessibleObject.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; using Windows.Win32.System.Variant; using Windows.Win32.UI.Accessibility; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ProfessionalColors.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ProfessionalColors.cs index 15d17221538..58d8f37d3bd 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ProfessionalColors.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ProfessionalColors.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; using System.Windows.Forms.VisualStyles; using Microsoft.Win32; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStrip.ToolStripAccessibleObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStrip.ToolStripAccessibleObject.cs index 18c757157cb..47b042846d2 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStrip.ToolStripAccessibleObject.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStrip.ToolStripAccessibleObject.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; using Windows.Win32.UI.Accessibility; namespace System.Windows.Forms; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripDropTargetManager.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripDropTargetManager.cs index 0a308152211..50801bccfc1 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripDropTargetManager.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripDropTargetManager.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; using System.Runtime.InteropServices; namespace System.Windows.Forms; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripLocationCancelEventArgs.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripLocationCancelEventArgs.cs index e26ae7e936e..dc58d496f91 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripLocationCancelEventArgs.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripLocationCancelEventArgs.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.ComponentModel; -using System.Drawing; namespace System.Windows.Forms; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripManager.ModalMenuFilter.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripManager.ModalMenuFilter.cs index 839fb73d14c..ecf6d481ca6 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripManager.ModalMenuFilter.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripManager.ModalMenuFilter.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; - namespace System.Windows.Forms; public static partial class ToolStripManager diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/WebBrowser/HtmlDocument.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/WebBrowser/HtmlDocument.cs index bafcff24a98..d5f946e2eb4 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/WebBrowser/HtmlDocument.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/WebBrowser/HtmlDocument.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.ComponentModel; -using System.Drawing; using System.Globalization; using Windows.Win32.System.Com; using Windows.Win32.System.Variant; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/WebBrowser/HtmlElementEventArgs.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/WebBrowser/HtmlElementEventArgs.cs index 43e59c79814..691c2f4adb9 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/WebBrowser/HtmlElementEventArgs.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/WebBrowser/HtmlElementEventArgs.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.ComponentModel; -using System.Drawing; using Windows.Win32.Web.MsHtml; namespace System.Windows.Forms; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/WebBrowser/WebBrowser.WebBrowserSite.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/WebBrowser/WebBrowser.WebBrowserSite.cs index aa74967acbe..85ba16c1c86 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/WebBrowser/WebBrowser.WebBrowserSite.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/WebBrowser/WebBrowser.WebBrowserSite.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; using Windows.Win32.System.Ole; using static Interop.Mshtml; using ComTypes = System.Runtime.InteropServices.ComTypes; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/WebBrowser/WebBrowserSiteBase.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/WebBrowser/WebBrowserSiteBase.cs index c4a8fb551a9..c5b4892e793 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/WebBrowser/WebBrowserSiteBase.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/WebBrowser/WebBrowserSiteBase.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.ComponentModel.Design; -using System.Drawing; using System.Runtime.InteropServices; using Windows.Win32.System.Com; using Windows.Win32.System.Ole; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Dialogs/CommonDialogs/ColorDialog.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Dialogs/CommonDialogs/ColorDialog.cs index 094742ce449..583e88b9d79 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Dialogs/CommonDialogs/ColorDialog.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Dialogs/CommonDialogs/ColorDialog.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.ComponentModel; -using System.Drawing; using System.Runtime.InteropServices; using Windows.Win32.UI.Controls.Dialogs; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ErrorProvider/ErrorProvider.ErrorWindow.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ErrorProvider/ErrorProvider.ErrorWindow.cs index 36632ed6eb4..0f0c6032144 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/ErrorProvider/ErrorProvider.ErrorWindow.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/ErrorProvider/ErrorProvider.ErrorWindow.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Drawing; +using Windows.Win32.Graphics.GdiPlus; namespace System.Windows.Forms; @@ -373,7 +374,7 @@ public unsafe void Update(bool timerCaused) MirrorDcIfNeeded(hdc); using Graphics g = hdc.CreateGraphics(); - using RegionScope windowRegionHandle = new(windowRegion, g); + using RegionScope windowRegionHandle = windowRegion.GetRegionScope(g); if (PInvoke.SetWindowRgn(this, windowRegionHandle, fRedraw: true) != 0) { // The HWnd owns the region. diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Help/HelpEventArgs.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Help/HelpEventArgs.cs index 0bc252340d0..423729b9712 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Help/HelpEventArgs.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Help/HelpEventArgs.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; - namespace System.Windows.Forms; /// diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Input/HandledMouseEventArgs.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Input/HandledMouseEventArgs.cs index f8ef02a5966..cc62be2fe8d 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Input/HandledMouseEventArgs.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Input/HandledMouseEventArgs.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; - namespace System.Windows.Forms; public class HandledMouseEventArgs : MouseEventArgs diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Input/MouseEventArgs.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Input/MouseEventArgs.cs index 9ce58ef91c0..636bc6e5e59 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Input/MouseEventArgs.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Input/MouseEventArgs.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; - namespace System.Windows.Forms; /// diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Rendering/DrawingEventArgs.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Rendering/DrawingEventArgs.cs index ddedef20fc4..6d500208f98 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Rendering/DrawingEventArgs.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Rendering/DrawingEventArgs.cs @@ -99,8 +99,7 @@ internal Graphics GetOrCreateGraphicsInternal(Action? creationAction = Debug.Assert(!_hdc.IsNull); // We need to manually unset the palette here so this scope shouldn't be disposed - var paletteScope = SelectPaletteScope.HalftonePalette( - _hdc, + var paletteScope = _hdc.HalftonePalette( forceBackground: false, realizePalette: false); diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Rendering/ScreenDcCache.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Rendering/ScreenDcCache.cs index 1759623b303..f7912c6bcba 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Rendering/ScreenDcCache.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Rendering/ScreenDcCache.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; using System.Numerics; namespace System.Windows.Forms; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Scrolling/ScrollBar.ScrollBarAccessibleObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Scrolling/ScrollBar.ScrollBarAccessibleObject.cs index 25739d36dc3..9d66f518e23 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Scrolling/ScrollBar.ScrollBarAccessibleObject.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Scrolling/ScrollBar.ScrollBarAccessibleObject.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; using Windows.Win32.System.Variant; using Windows.Win32.UI.Accessibility; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ToolTip/ToolTip.TipInfo.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ToolTip/ToolTip.TipInfo.cs index 43f2edd5d55..2c8add859f8 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/ToolTip/ToolTip.TipInfo.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/ToolTip/ToolTip.TipInfo.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Drawing; - namespace System.Windows.Forms; public partial class ToolTip diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ComponentModel/Com2Interop/ComNativeDescriptorTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ComponentModel/Com2Interop/ComNativeDescriptorTests.cs index 3bd912db6ca..3c1a8a41892 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ComponentModel/Com2Interop/ComNativeDescriptorTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ComponentModel/Com2Interop/ComNativeDescriptorTests.cs @@ -6,6 +6,7 @@ using System.Drawing; using System.Runtime.InteropServices; using System.Windows.Forms.Tests.TestResources; +using Windows.Win32.Graphics.GdiPlus; using Windows.Win32.System.Com; using Windows.Win32.System.Ole; using Windows.Win32.System.Variant; @@ -20,7 +21,7 @@ public unsafe class ComNativeDescriptorTests public void ComNativeDescriptor_GetProperties_FromIPictureDisp_ComInterop() { using Bitmap bitmap = new(10, 20); - object iPictureDisp = IPictureDisp.CreateObjectFromImage(bitmap); + object iPictureDisp = bitmap.CreateIPictureDispRCW(); Assert.NotNull(iPictureDisp); ValidateIPictureDispProperties(iPictureDisp, TypeDescriptor.GetProperties(iPictureDisp)); @@ -30,7 +31,7 @@ public void ComNativeDescriptor_GetProperties_FromIPictureDisp_ComInterop() public void ComNativeDescriptor_GetProperties_FromIPictureDisp_ComWrappers() { using Bitmap bitmap = new(10, 20); - using var iPictureDisp = IPictureDisp.CreateFromImage(bitmap); + using var iPictureDisp = bitmap.CreateIPictureDisp(); Assert.False(iPictureDisp.IsNull); // The runtime needs to be updated to allow ComWrappers through @@ -79,7 +80,7 @@ public void ComNativeDescriptor_GetProperties_FromIPicture() // While we ask for IPicture, the underlying native class also supports IDispatch, so we get support // in the type descriptor. using Bitmap bitmap = new(10, 20); - object iPicture = IPicture.CreateObjectFromImage(bitmap); + object iPicture = bitmap.CreateIPictureDispRCW(); Assert.NotNull(iPicture); var properties = TypeDescriptor.GetProperties(iPicture); From 6d794165e6e6912883dc181c6356fd3fbff7c730 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 13 Dec 2024 13:42:08 +0000 Subject: [PATCH 104/106] [main] Update dependencies from dotnet/arcade (#12640) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 24 ++++++++++++------------ eng/Versions.props | 6 +++--- global.json | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9d35af37798..d0254174be1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -191,29 +191,29 @@ Note: if the Uri is a new place, you will need to add a subscription from that p - + https://github.com/dotnet/arcade - b9e1dd7c1e1d05679831467cd3c051b9f8f84460 + 1e161ed635ca19f61b1ddddee61b0bfc995fd716 - + https://github.com/dotnet/arcade - b9e1dd7c1e1d05679831467cd3c051b9f8f84460 + 1e161ed635ca19f61b1ddddee61b0bfc995fd716 - + https://github.com/dotnet/arcade - b9e1dd7c1e1d05679831467cd3c051b9f8f84460 + 1e161ed635ca19f61b1ddddee61b0bfc995fd716 - + https://github.com/dotnet/arcade - b9e1dd7c1e1d05679831467cd3c051b9f8f84460 + 1e161ed635ca19f61b1ddddee61b0bfc995fd716 - + https://github.com/dotnet/arcade - b9e1dd7c1e1d05679831467cd3c051b9f8f84460 + 1e161ed635ca19f61b1ddddee61b0bfc995fd716 - + https://github.com/dotnet/arcade - b9e1dd7c1e1d05679831467cd3c051b9f8f84460 + 1e161ed635ca19f61b1ddddee61b0bfc995fd716 diff --git a/eng/Versions.props b/eng/Versions.props index e0cc3f76749..00d280c6233 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -56,9 +56,9 @@ - 10.0.0-beta.24611.4 - 10.0.0-beta.24611.4 - 10.0.0-beta.24611.4 + 10.0.0-beta.24612.4 + 10.0.0-beta.24612.4 + 10.0.0-beta.24612.4 17.4.0-preview-20220707-01 diff --git a/global.json b/global.json index 26b5ca2da05..02d0709e9df 100644 --- a/global.json +++ b/global.json @@ -14,9 +14,9 @@ "version": "10.0.100-alpha.1.24573.1" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24611.4", - "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24611.4", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24611.4", + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24612.4", + "Microsoft.DotNet.CMake.Sdk": "10.0.0-beta.24612.4", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24612.4", "FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0", "Microsoft.NET.Sdk.IL": "10.0.0-alpha.1.24611.1" }, From 39c6b28eaf962c92180f57694c2ec2dbd02a40d5 Mon Sep 17 00:00:00 2001 From: Tanya Solyanik Date: Fri, 13 Dec 2024 15:33:17 -0800 Subject: [PATCH 105/106] Minor refactoring in DataObject-related code (#12642) Factored out code that reads formats that allow only restricted deserialization to run, such as OLE formats. --- .../Windows/Forms/Internal/TypeExtensions.cs | 6 +- ...bject.Composition.BinaryFormatUtilities.cs | 62 +++++++++++++----- ...ect.Composition.NativeToWinFormsAdapter.cs | 4 +- .../Forms/BinaryFormatUtilitiesTests.cs | 64 ++++++++++++------- 4 files changed, 94 insertions(+), 42 deletions(-) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Internal/TypeExtensions.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Internal/TypeExtensions.cs index c252bb8f0d8..1ffafb0d351 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Internal/TypeExtensions.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Internal/TypeExtensions.cs @@ -235,8 +235,10 @@ static bool AssemblyNamesMatch(AssemblyNameInfo? name1, AssemblyNameInfo? name2) } /// - /// Convert to . This method removes nullability wrapper - /// from the top level type only because in the serialization root record is not nullable. + /// Convert to . Take into account type forwarding in order + /// to create compatible with the type names serialized to the binary format.This + /// method removes nullability wrapper from the top level type only because in the + /// serialization root record is not nullable, but the generic types could be nullable. /// public static TypeName ToTypeName(this Type type) { diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.BinaryFormatUtilities.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.BinaryFormatUtilities.cs index 144da1f2541..fe7081fb527 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.BinaryFormatUtilities.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.BinaryFormatUtilities.cs @@ -66,16 +66,14 @@ internal static void WriteObjectToStream(MemoryStream stream, object data, bool internal static object? ReadObjectFromStream( MemoryStream stream, - bool restrictDeserialization, Func? resolver, bool legacyMode) { long startPosition = stream.Position; SerializationRecord? record; - SerializationBinder binder = new Binder(typeof(T), resolver, legacyMode); - IReadOnlyDictionary recordMap; + try { record = stream.Decode(out recordMap); @@ -83,14 +81,9 @@ record = stream.Decode(out recordMap); catch (Exception ex) when (!ex.IsCriticalException()) { // Couldn't parse for some reason, let BinaryFormatter handle the legacy invocation. - // The types APIs can't compare the specified type when the root record is not available. + // The typed APIs can't compare the specified type when the root record is not available. if (legacyMode && LocalAppContextSwitches.ClipboardDragDropEnableUnsafeBinaryFormatterSerialization) { - if (restrictDeserialization) - { - throw new RestrictedTypeDeserializationException(SR.UnexpectedClipboardType); - } - stream.Position = startPosition; return ReadObjectWithBinaryFormatter(stream, binder); } @@ -108,7 +101,8 @@ record = stream.Decode(out recordMap); // For the new TryGet APIs, ensure that the stream contains the requested type, // or type that can be assigned to the requested type. - if (!legacyMode && !typeof(T).MatchExceptAssemblyVersion(record.TypeName)) + Type type = typeof(T); + if (!legacyMode && !type.MatchExceptAssemblyVersion(record.TypeName)) { #if false // TODO (TanyaSo): - modify TryGetObjectFromJson to take a resolver and rename to HasJsonData??? // Return true if the payload contains valid JsonData struct, type matches or not @@ -119,7 +113,7 @@ record = stream.Decode(out recordMap); } #endif - if (!TypeNameIsAssignableToType(record.TypeName, typeof(T), (ITypeResolver)binder)) + if (!TypeNameIsAssignableToType(record.TypeName, type, (ITypeResolver)binder)) { // If clipboard contains an exception from SetData, we will get its message and throw. if (record.TypeName.FullName == typeof(NotSupportedException).FullName @@ -138,11 +132,6 @@ record = stream.Decode(out recordMap); return value; } - if (restrictDeserialization) - { - throw new RestrictedTypeDeserializationException(SR.UnexpectedClipboardType); - } - if (!LocalAppContextSwitches.ClipboardDragDropEnableUnsafeBinaryFormatterSerialization) { throw new NotSupportedException(string.Format( @@ -170,6 +159,47 @@ record = stream.Decode(out recordMap); return ReadObjectWithBinaryFormatter(stream, binder); } + internal static object? ReadRestrictedObjectFromStream( + MemoryStream stream, + Func? resolver, + bool legacyMode) + { + long startPosition = stream.Position; + SerializationRecord? record; + + try + { + record = stream.Decode(); + } + catch (Exception ex) when (!ex.IsCriticalException()) + { + throw new RestrictedTypeDeserializationException(SR.UnexpectedClipboardType); + } + + // For the new TryGet APIs, ensure that the stream contains the requested type, + // or type that can be assigned to the requested type. + Type type = typeof(T); + if (!legacyMode && !type.MatchExceptAssemblyVersion(record.TypeName)) + { + if (!TypeNameIsAssignableToType(record.TypeName, type, new Binder(type, resolver, legacyMode))) + { + // If clipboard contains an exception from SetData, we will get its message and throw. + if (record.TypeName.FullName == typeof(NotSupportedException).FullName + && record.TryGetNotSupportedException(out object? @object) + && @object is NotSupportedException exception) + { + throw new NotSupportedException(exception.Message); + } + + return null; + } + } + + return record.TryGetCommonObject(out object? value) + ? value + : throw new RestrictedTypeDeserializationException(SR.UnexpectedClipboardType); + } + private static bool TypeNameIsAssignableToType(TypeName typeName, Type type, ITypeResolver resolver) { try diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs index 14ac1ec1c7f..d543e25287f 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs @@ -133,7 +133,9 @@ private static bool TryGetDataFromHGLOBAL( MemoryStream stream = ReadByteStreamFromHGLOBAL(hglobal, out bool isSerializedObject); return !isSerializedObject ? stream - : BinaryFormatUtilities.ReadObjectFromStream(stream, restrictDeserialization, resolver, legacyMode); + : restrictDeserialization + ? BinaryFormatUtilities.ReadRestrictedObjectFromStream(stream, resolver, legacyMode) + : BinaryFormatUtilities.ReadObjectFromStream(stream, resolver, legacyMode); } } diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.cs index 8bd378171ad..48e3e8923b4 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.cs @@ -22,16 +22,36 @@ public partial class BinaryFormatUtilitiesTests : IDisposable private void WriteObjectToStream(object value, bool restrictSerialization = false) => Utilities.WriteObjectToStream(_stream, value, restrictSerialization); - private object? ReadObjectFromStream(bool restrictDeserialization = false) + private object? ReadObjectFromStream() { _stream.Position = 0; - return Utilities.ReadObjectFromStream(_stream, restrictDeserialization, resolver: null, legacyMode: true); + return Utilities.ReadObjectFromStream(_stream, resolver: null, legacyMode: true); + } + + private object? ReadRestrictedObjectFromStream() + { + _stream.Position = 0; + return Utilities.ReadRestrictedObjectFromStream(_stream, resolver: null, legacyMode: true); } private object? ReadObjectFromStream(bool restrictDeserialization, Func? resolver) { _stream.Position = 0; - return Utilities.ReadObjectFromStream(_stream, restrictDeserialization, resolver, legacyMode: false); + return restrictDeserialization + ? Utilities.ReadRestrictedObjectFromStream(_stream, resolver, legacyMode: false) + : Utilities.ReadObjectFromStream(_stream, resolver, legacyMode: false); + } + + private object? ReadObjectFromStream(Func? resolver) + { + _stream.Position = 0; + return Utilities.ReadObjectFromStream(_stream, resolver, legacyMode: false); + } + + private object? ReadRestrictedObjectFromStream(Func? resolver) + { + _stream.Position = 0; + return Utilities.ReadRestrictedObjectFromStream(_stream, resolver, legacyMode: false); } private object? RoundTripObject(object value) @@ -46,7 +66,7 @@ private void WriteObjectToStream(object value, bool restrictSerialization = fals { // This is equivalent to SetData/GetData methods using registered OLE formats, resolves only the known types WriteObjectToStream(value, restrictSerialization: true); - return ReadObjectFromStream(restrictDeserialization: true); + return ReadRestrictedObjectFromStream(); } private object? RoundTripOfType(object value) @@ -54,7 +74,7 @@ private void WriteObjectToStream(object value, bool restrictSerialization = fals // This is equivalent to SetData/TryGetData methods using unbounded OLE formats, // and works with the BinaryFormat AppContext switches. WriteObjectToStream(value); - return ReadObjectFromStream(restrictDeserialization: false, NotSupportedResolver); + return ReadObjectFromStream(NotSupportedResolver); } private object? RoundTripOfType_RestrictedFormat(object value) @@ -62,7 +82,7 @@ private void WriteObjectToStream(object value, bool restrictSerialization = fals // This is equivalent to SetData/TryGetData methods using OLE formats. Deserialization is restricted // to known types. WriteObjectToStream(value, restrictSerialization: true); - return ReadObjectFromStream(restrictDeserialization: true, NotSupportedResolver); + return ReadRestrictedObjectFromStream(NotSupportedResolver); } private object? RoundTripOfType(object value, Func? resolver) @@ -70,7 +90,7 @@ private void WriteObjectToStream(object value, bool restrictSerialization = fals // This is equivalent to SetData/TryGetData methods using unbounded formats, // serialization is restricted by the resolver and BinaryFormat AppContext switches. WriteObjectToStream(value); - return ReadObjectFromStream(restrictDeserialization: false, resolver); + return ReadObjectFromStream(resolver); } // Primitive types as defined by the NRBF spec. @@ -311,14 +331,14 @@ public void RoundTrip_RestrictedFormat_ImageList() public void RoundTrip_Bitmap() { using Bitmap value = new(10, 10); - RoundTripObject(value).Should().BeOfType().Subject.Size.Should().Be(value.Size); + RoundTripObject(value).Should().BeOfType().Which.Size.Should().Be(value.Size); } [Fact] public void RoundTrip_RestrictedFormat_Bitmap() { using Bitmap value = new(10, 10); - RoundTripObject_RestrictedFormat(value).Should().BeOfType().Subject.Size.Should().Be(value.Size); + RoundTripObject_RestrictedFormat(value).Should().BeOfType().Which.Size.Should().Be(value.Size); } [Theory] @@ -402,12 +422,12 @@ public void RoundTripOfType_Unsupported() ReadAndValidate(); } - Action read = () => ReadObjectFromStream>(restrictDeserialization: false, ObjectListResolver); + Action read = () => ReadObjectFromStream>(ObjectListResolver); read.Should().Throw(); void ReadAndValidate() { - var result = ReadObjectFromStream>(restrictDeserialization: false, ObjectListResolver) + var result = ReadObjectFromStream>(ObjectListResolver) .Should().BeOfType>().Subject; result.Count.Should().Be(1); result[0].Should().Be("text"); @@ -450,10 +470,10 @@ public void RoundTripOfType_RestrictedFormat_AsUnmatchingType_Simple() // but in this case requested type will not match the payload type. WriteObjectToStream(value); - ReadObjectFromStream(restrictDeserialization: true, NotSupportedResolver).Should().BeNull(); + ReadRestrictedObjectFromStream(NotSupportedResolver).Should().BeNull(); using BinaryFormatterFullCompatScope scope = new(); - ReadObjectFromStream(restrictDeserialization: true, NotSupportedResolver).Should().BeNull(); + ReadRestrictedObjectFromStream(NotSupportedResolver).Should().BeNull(); } [Fact] @@ -471,7 +491,7 @@ public void RoundTripOfType_RestrictedFormat_intNullableArray_NotSupportedResolv using BinaryFormatterFullCompatScope scope = new(); WriteObjectToStream(value); - Action read = () => ReadObjectFromStream(restrictDeserialization: true, NotSupportedResolver); + Action read = () => ReadRestrictedObjectFromStream(NotSupportedResolver); // nullable struct requires a custom resolver. // RestrictedTypeDeserializationException @@ -485,10 +505,11 @@ public void RoundTripOfType_intNullableArray_NotSupportedResolver() using BinaryFormatterFullCompatScope scope = new(); WriteObjectToStream(value); - Action read = () => ReadObjectFromStream(restrictDeserialization: false, NotSupportedResolver); + Action read = () => ReadObjectFromStream(NotSupportedResolver); // nullable struct requires a custom resolver. - read.Should().Throw(); + // This is either NotSupportedException of RestrictedTypeDeserializationException, depending on format. + read.Should().Throw(); } [Theory] @@ -507,7 +528,7 @@ public void RoundTripOfType_OffsetArray_NotSupportedResolver(bool restrictDeseri WriteObjectToStream(value); Action read = () => ReadObjectFromStream(restrictDeserialization, NotSupportedResolver); - read.Should().Throw(); + read.Should().Throw(); } [Fact] @@ -583,7 +604,7 @@ public void RoundTripOfType_TestData_InvalidResolver() WriteObjectToStream(value); // Resolver that returns a null is blocked in our SerializationBinder wrapper. - Action read = () => ReadObjectFromStream(restrictDeserialization: false, InvalidResolver); + Action read = () => ReadObjectFromStream(InvalidResolver); read.Should().Throw(); @@ -649,7 +670,6 @@ public void ReadFontSerializedOnNet481() stream.Position = 0; Action getData = () => Utilities.ReadObjectFromStream( stream, - restrictDeserialization: false, resolver: null, legacyMode: true); @@ -664,7 +684,6 @@ public void ReadFontSerializedOnNet481() stream.Position = 0; var result = Utilities.ReadObjectFromStream( stream, - restrictDeserialization: false, resolver: null, legacyMode: true).Should().BeOfType().Subject; @@ -679,7 +698,6 @@ static void TryGetData(MemoryStream stream) stream.Position = 0; var result = Utilities.ReadObjectFromStream( stream, - restrictDeserialization: false, resolver: FontResolver, legacyMode: false).Should().BeOfType().Subject; @@ -721,7 +739,7 @@ public void Sample_GetData_UseBinaryFormatter() // legacyMode == true follows the GetData path. _stream.Position = 0; - Utilities.ReadObjectFromStream(_stream, restrictDeserialization: false, resolver: null, legacyMode: true) + Utilities.ReadObjectFromStream(_stream, resolver: null, legacyMode: true) .Should().BeEquivalentTo(value); } @@ -736,7 +754,7 @@ public void Sample_GetData_UseNrbfDeserialize() // This works because GetData falls back to the BinaryFormatter deserializer, NRBF deserializer fails because it requires a resolver. _stream.Position = 0; - Utilities.ReadObjectFromStream(_stream, restrictDeserialization: false, resolver: null, legacyMode: true) + Utilities.ReadObjectFromStream(_stream, resolver: null, legacyMode: true) .Should().BeEquivalentTo(value); } From e8ddfba7687987db3ca54eb10ca236fd17cae582 Mon Sep 17 00:00:00 2001 From: Tanya Solyanik Date: Fri, 13 Dec 2024 19:26:18 -0800 Subject: [PATCH 106/106] preparation to validate known types (#12643) and removed unwrapping nullable structs the second time. --- .../OLE/DataObject.Composition.Binder.cs | 81 +++++++++++++++++-- 1 file changed, 74 insertions(+), 7 deletions(-) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.Binder.cs b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.Binder.cs index fcb82cadc3c..080c21d0ca4 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.Binder.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.Binder.cs @@ -34,8 +34,9 @@ internal sealed class Binder : SerializationBinder, ITypeResolver // These types are read from and written to serialized stream manually, accessing record field by field. // Thus they are re-hydrated with no formatters and are safe. The default resolver should recognize them // to resolve primitive types or fields of the specified type T. - private static readonly Type[] s_types = + private static readonly Type[] s_intrinsicTypes = [ + // Primitive types. typeof(byte), typeof(sbyte), typeof(short), @@ -54,7 +55,9 @@ internal sealed class Binder : SerializationBinder, ITypeResolver typeof(TimeSpan), typeof(IntPtr), typeof(UIntPtr), + // Special type we use to report that binary formatting is disabled. typeof(NotSupportedException), + // Lists of primitive types typeof(List), typeof(List), typeof(List), @@ -71,6 +74,7 @@ internal sealed class Binder : SerializationBinder, ITypeResolver typeof(List), typeof(List), typeof(List), + // Arrays of primitive types. typeof(byte[]), typeof(sbyte[]), typeof(short[]), @@ -87,17 +91,18 @@ internal sealed class Binder : SerializationBinder, ITypeResolver typeof(decimal[]), typeof(DateTime[]), typeof(TimeSpan[]), + // Common WinForms types. typeof(ImageListStreamer), typeof(Drawing.Bitmap), - // The following are exchange types, they are serialized with the .NET Framework assembly name. + // Exchange types, they are serialized with the .NET Framework assembly name. // In .NET they are located in System.Drawing.Primitives. typeof(Drawing.RectangleF), - typeof(Drawing.PointF), + typeof(PointF), typeof(Drawing.SizeF), typeof(Drawing.Rectangle), - typeof(Drawing.Point), + typeof(Point), typeof(Drawing.Size), - typeof(Drawing.Color) + typeof(Color) ]; private static Dictionary? s_knownTypes; @@ -133,7 +138,7 @@ public Binder(Type type, Func? resolver, bool legacyMode) // 2. Check if the type had been forwarded from another assembly // 3. Match assembly name with no version // 4. Match namespace and type name - type = Formatter.NullableUnwrap(type.OrThrowIfNull()); + // Provide a custom resolver function to supports different type matching logic. TypeName typeName = type.ToTypeName(); @@ -151,12 +156,74 @@ private static void InitializeCommonTypes() s_knownTypes = new(TypeNameComparer.Default); - foreach (Type type in s_types) + foreach (Type type in s_intrinsicTypes) { s_knownTypes.Add(type.ToTypeName(), type); } } + public static bool IsKnownType() => + typeof(T) == typeof(byte) + || typeof(T) == typeof(sbyte) + || typeof(T) == typeof(short) + || typeof(T) == typeof(ushort) + || typeof(T) == typeof(int) + || typeof(T) == typeof(uint) + || typeof(T) == typeof(long) + || typeof(T) == typeof(ulong) + || typeof(T) == typeof(double) + || typeof(T) == typeof(float) + || typeof(T) == typeof(char) + || typeof(T) == typeof(bool) + || typeof(T) == typeof(string) + || typeof(T) == typeof(decimal) + || typeof(T) == typeof(DateTime) + || typeof(T) == typeof(TimeSpan) + || typeof(T) == typeof(IntPtr) + || typeof(T) == typeof(UIntPtr) + || typeof(T) == typeof(NotSupportedException) + || typeof(T) == typeof(List) + || typeof(T) == typeof(List) + || typeof(T) == typeof(List) + || typeof(T) == typeof(List) + || typeof(T) == typeof(List) + || typeof(T) == typeof(List) + || typeof(T) == typeof(List) + || typeof(T) == typeof(List) + || typeof(T) == typeof(List) + || typeof(T) == typeof(List) + || typeof(T) == typeof(List) + || typeof(T) == typeof(List) + || typeof(T) == typeof(List) + || typeof(T) == typeof(List) + || typeof(T) == typeof(List) + || typeof(T) == typeof(List) + || typeof(T) == typeof(byte[]) + || typeof(T) == typeof(sbyte[]) + || typeof(T) == typeof(short[]) + || typeof(T) == typeof(ushort[]) + || typeof(T) == typeof(int[]) + || typeof(T) == typeof(uint[]) + || typeof(T) == typeof(long[]) + || typeof(T) == typeof(ulong[]) + || typeof(T) == typeof(float[]) + || typeof(T) == typeof(double[]) + || typeof(T) == typeof(char[]) + || typeof(T) == typeof(bool[]) + || typeof(T) == typeof(string[]) + || typeof(T) == typeof(decimal[]) + || typeof(T) == typeof(DateTime[]) + || typeof(T) == typeof(TimeSpan[]) + || typeof(T) == typeof(ImageListStreamer) + || typeof(T) == typeof(Drawing.Bitmap) + || typeof(T) == typeof(Drawing.RectangleF) + || typeof(T) == typeof(PointF) + || typeof(T) == typeof(Drawing.SizeF) + || typeof(T) == typeof(Drawing.Rectangle) + || typeof(T) == typeof(Point) + || typeof(T) == typeof(Drawing.Size) + || typeof(T) == typeof(Color); + public override Type? BindToType(string assemblyName, string typeName) { ArgumentException.ThrowIfNullOrWhiteSpace(assemblyName);