From fa2a0500c19a591a157e005c067672e5caca22c6 Mon Sep 17 00:00:00 2001 From: Mariana Dematte Date: Fri, 21 Jul 2023 17:40:23 -0300 Subject: [PATCH 1/5] Removed Security.Permission reference --- eng/Packages.props | 1 - eng/SourceBuildPrebuiltBaseline.xml | 1 - src/Framework/Microsoft.Build.Framework.csproj | 4 ---- src/Shared/ExceptionHandling.cs | 15 ++++++++++----- src/Tasks/Microsoft.Build.Tasks.csproj | 1 - src/Utilities/Microsoft.Build.Utilities.csproj | 1 - 6 files changed, 10 insertions(+), 13 deletions(-) diff --git a/eng/Packages.props b/eng/Packages.props index b3567d1fdc2..3c231e9c52c 100644 --- a/eng/Packages.props +++ b/eng/Packages.props @@ -25,7 +25,6 @@ - diff --git a/eng/SourceBuildPrebuiltBaseline.xml b/eng/SourceBuildPrebuiltBaseline.xml index 525335398d3..55d6f6f03d1 100644 --- a/eng/SourceBuildPrebuiltBaseline.xml +++ b/eng/SourceBuildPrebuiltBaseline.xml @@ -26,7 +26,6 @@ - diff --git a/src/Framework/Microsoft.Build.Framework.csproj b/src/Framework/Microsoft.Build.Framework.csproj index 724e1a38496..c0da0474e6c 100644 --- a/src/Framework/Microsoft.Build.Framework.csproj +++ b/src/Framework/Microsoft.Build.Framework.csproj @@ -15,10 +15,6 @@ - - - - diff --git a/src/Shared/ExceptionHandling.cs b/src/Shared/ExceptionHandling.cs index a7ef74e8737..1e872b99b01 100644 --- a/src/Shared/ExceptionHandling.cs +++ b/src/Shared/ExceptionHandling.cs @@ -14,7 +14,6 @@ namespace Microsoft.Build.AppxPackage.Shared using System.IO; using System.Linq; using System.Reflection; -using System.Security; using System.Text; using System.Threading; using System.Xml; @@ -157,7 +156,9 @@ internal static bool IsIoRelatedException(Exception e) return e is UnauthorizedAccessException || e is NotSupportedException || (e is ArgumentException && !(e is ArgumentNullException)) - || e is SecurityException +#if NETFRAMEWORK + || e is System.Security.SecurityException +#endif || e is IOException; } @@ -167,7 +168,9 @@ internal static bool IsIoRelatedException(Exception e) internal static bool IsXmlException(Exception e) { return e is XmlException - || e is XmlSyntaxException +#if !NETFRAMEWORK + || e is System.Security.XmlSyntaxException +#endif || e is XmlSchemaException || e is UriFormatException; // XmlTextReader for example uses this under the covers } @@ -281,8 +284,10 @@ e is SerializationException || /// internal static bool NotExpectedRegistryException(Exception e) { - if (e is SecurityException - || e is UnauthorizedAccessException + if (e is UnauthorizedAccessException +#if NETFRAMEWORK + || e is System.Security.SecurityException +#endif || e is IOException || e is ObjectDisposedException || e is ArgumentException) diff --git a/src/Tasks/Microsoft.Build.Tasks.csproj b/src/Tasks/Microsoft.Build.Tasks.csproj index 72ea1091d20..e11a7698f31 100644 --- a/src/Tasks/Microsoft.Build.Tasks.csproj +++ b/src/Tasks/Microsoft.Build.Tasks.csproj @@ -1008,7 +1008,6 @@ - diff --git a/src/Utilities/Microsoft.Build.Utilities.csproj b/src/Utilities/Microsoft.Build.Utilities.csproj index d06b02ad782..1b164ee1089 100644 --- a/src/Utilities/Microsoft.Build.Utilities.csproj +++ b/src/Utilities/Microsoft.Build.Utilities.csproj @@ -32,7 +32,6 @@ - From da594955eecdac5b1939a467dea558380b29a12a Mon Sep 17 00:00:00 2001 From: Mariana Dematte Date: Fri, 21 Jul 2023 17:44:52 -0300 Subject: [PATCH 2/5] Missed a ! in an expression --- src/Shared/ExceptionHandling.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Shared/ExceptionHandling.cs b/src/Shared/ExceptionHandling.cs index 1e872b99b01..81493e6ef86 100644 --- a/src/Shared/ExceptionHandling.cs +++ b/src/Shared/ExceptionHandling.cs @@ -168,7 +168,7 @@ internal static bool IsIoRelatedException(Exception e) internal static bool IsXmlException(Exception e) { return e is XmlException -#if !NETFRAMEWORK +#if NETFRAMEWORK || e is System.Security.XmlSyntaxException #endif || e is XmlSchemaException From b6ca1e237b729ee0b747fd852eb3bf79cf4cd17d Mon Sep 17 00:00:00 2001 From: Mariana Dematte Date: Mon, 7 Aug 2023 10:51:28 -0300 Subject: [PATCH 3/5] PR comments --- src/Shared/ExceptionHandling.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Shared/ExceptionHandling.cs b/src/Shared/ExceptionHandling.cs index 81493e6ef86..754a432994e 100644 --- a/src/Shared/ExceptionHandling.cs +++ b/src/Shared/ExceptionHandling.cs @@ -14,6 +14,7 @@ namespace Microsoft.Build.AppxPackage.Shared using System.IO; using System.Linq; using System.Reflection; +using System.Security; using System.Text; using System.Threading; using System.Xml; @@ -156,9 +157,7 @@ internal static bool IsIoRelatedException(Exception e) return e is UnauthorizedAccessException || e is NotSupportedException || (e is ArgumentException && !(e is ArgumentNullException)) -#if NETFRAMEWORK - || e is System.Security.SecurityException -#endif + || e is SecurityException || e is IOException; } @@ -285,9 +284,7 @@ e is SerializationException || internal static bool NotExpectedRegistryException(Exception e) { if (e is UnauthorizedAccessException -#if NETFRAMEWORK - || e is System.Security.SecurityException -#endif + || e is SecurityException || e is IOException || e is ObjectDisposedException || e is ArgumentException) From b2444c77eedaa33facf2f9e3916d3a9e18543c4a Mon Sep 17 00:00:00 2001 From: Mariana Dematte Date: Thu, 14 Sep 2023 23:20:03 +0200 Subject: [PATCH 4/5] Addressed PR comments --- eng/Version.Details.xml | 5 ----- eng/Versions.props | 1 - src/Shared/ExceptionHandling.cs | 2 +- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2758bb113ec..4683ffbca57 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -52,11 +52,6 @@ https://github.com/dotnet/runtime d099f075e45d2aa6007a22b71b45a08758559f80 - - - https://github.com/dotnet/runtime - d099f075e45d2aa6007a22b71b45a08758559f80 - https://github.com/dotnet/runtime 5b20af47d99620150c53eaf5db8636fdf730b126 diff --git a/eng/Versions.props b/eng/Versions.props index 58866d8cc69..5c8665f07fb 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -38,7 +38,6 @@ 7.0.0 7.0.0 7.0.0 - 7.0.0 5.0.0 7.0.0 diff --git a/src/Shared/ExceptionHandling.cs b/src/Shared/ExceptionHandling.cs index 754a432994e..3e3cae26f19 100644 --- a/src/Shared/ExceptionHandling.cs +++ b/src/Shared/ExceptionHandling.cs @@ -167,7 +167,7 @@ internal static bool IsIoRelatedException(Exception e) internal static bool IsXmlException(Exception e) { return e is XmlException -#if NETFRAMEWORK +#if FEATURE_SECURITY_PERMISSIONS || e is System.Security.XmlSyntaxException #endif || e is XmlSchemaException From dee00049e37da87478cb02cff90511c660136821 Mon Sep 17 00:00:00 2001 From: Mariana Dematte Date: Sun, 17 Sep 2023 23:13:53 +0200 Subject: [PATCH 5/5] Swapped statement order to original --- src/Shared/ExceptionHandling.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Shared/ExceptionHandling.cs b/src/Shared/ExceptionHandling.cs index 3e3cae26f19..eca284ecb64 100644 --- a/src/Shared/ExceptionHandling.cs +++ b/src/Shared/ExceptionHandling.cs @@ -283,8 +283,8 @@ e is SerializationException || /// internal static bool NotExpectedRegistryException(Exception e) { - if (e is UnauthorizedAccessException - || e is SecurityException + if (e is SecurityException + || e is UnauthorizedAccessException || e is IOException || e is ObjectDisposedException || e is ArgumentException)