From 64e5da27d724cdf49feda66d27a54ca64ed82c0d Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Tue, 22 Nov 2022 12:21:46 +0100 Subject: [PATCH 1/4] Clean-up the ApiCompat and GenAPI logic --- eng/Version.Details.xml | 4 +- eng/Versions.props | 2 +- eng/resolveContract.props | 14 -- eng/resolveContract.targets | 144 +++++++++++------- .../System.Private.CoreLib.csproj | 3 +- .../src/System.Private.CoreLib.csproj | 3 +- src/libraries/Directory.Build.props | 2 +- src/libraries/Directory.Build.targets | 11 +- src/libraries/apicompat/ApiCompat.proj | 9 +- src/libraries/shims/Directory.Build.targets | 18 ++- src/libraries/shims/src/Directory.Build.props | 7 - src/libraries/shims/src/netstandard.csproj | 2 +- .../System.Private.CoreLib.csproj | 3 +- 13 files changed, 123 insertions(+), 99 deletions(-) delete mode 100644 eng/resolveContract.props diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8f1419c12ac43..8f89d99d6daf1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -106,9 +106,9 @@ https://github.com/dotnet/arcade 80b6be47e1425ea90c5febffac119250043a0c92 - + https://github.com/dotnet/arcade - 80b6be47e1425ea90c5febffac119250043a0c92 + fc4ba340496ca0e45d51914f8f1606c60e3c75c6 https://github.com/dotnet/arcade diff --git a/eng/Versions.props b/eng/Versions.props index e54249982e315..a7bc4c2a1b545 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -85,7 +85,7 @@ 8.0.0-beta.22554.2 8.0.0-beta.22554.2 8.0.0-beta.22554.2 - 8.0.0-beta.22554.2 + 8.0.0-beta.22572.2 8.0.0-beta.22554.2 2.5.1-beta.22554.2 8.0.0-beta.22554.2 diff --git a/eng/resolveContract.props b/eng/resolveContract.props deleted file mode 100644 index fe4224a844a47..0000000000000 --- a/eng/resolveContract.props +++ /dev/null @@ -1,14 +0,0 @@ - - - - true - - true - true - - - - - - - diff --git a/eng/resolveContract.targets b/eng/resolveContract.targets index 57bd558774558..01e77e24e0ac9 100644 --- a/eng/resolveContract.targets +++ b/eng/resolveContract.targets @@ -1,72 +1,40 @@ - - ResolvedMatchingContract - true - <_ApiCompatCaptureGroupPattern>.+%5C$([System.IO.Path]::DirectorySeparatorChar)(.+)%5C$([System.IO.Path]::DirectorySeparatorChar)(.+) - <_ApiCompatRuntimePrefixPattern>(.+)/(net%5Cd.%5Cd)-(.+)/(.+) - <_ApiCompatLibReplacementString>lib/$1/$2 - - <_ApiCompatLibReplacementString Condition="'$(MSBuildProjectName)' == 'System.Private.CoreLib'">lib/$(NetCoreAppCurrent)/$2 - - $(RepositoryEngineeringDir)DefaultGenApiDocIds.txt - $(RepositoryEngineeringDir)LicenseHeader.txt - $([MSBuild]::NormalizePath('$(MSBuildProjectDirectory)', '..', 'ref', '$(AssemblyName).cs')) - $(LangVersion) - $(CoreLibProject) - - - - - - - - - - - + - - - - - + $(LibrariesProjectRoot)$(MSBuildProjectName)\ref\$(MSBuildProjectName).csproj true + + true - - - false - - - false - - - - - - - - + - - - - - + @@ -89,6 +57,76 @@ + + + + ResolvedMatchingContract + true + + + true + true + + <_ApiCompatCaptureGroupPattern>.+%5C$([System.IO.Path]::DirectorySeparatorChar)(.+)%5C$([System.IO.Path]::DirectorySeparatorChar)(.+) + <_ApiCompatRuntimePrefixPattern>(.+)/(net%5Cd.%5Cd)-(.+)/(.+) + <_ApiCompatLibReplacementString>lib/$1/$2 + + <_ApiCompatLibReplacementString Condition="'$(MSBuildProjectName)' == 'System.Private.CoreLib'">lib/$(NetCoreAppCurrent)/$2 + + + + + false + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(RepositoryEngineeringDir)DefaultGenApiDocIds.txt + $(RepositoryEngineeringDir)LicenseHeader.txt + $([MSBuild]::NormalizePath('$(MSBuildProjectDirectory)', '..', 'ref', '$(AssemblyName).cs')) + $(LangVersion) + $(CoreLibProject) + + + + + + + - true + true - diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj b/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj index b1e8c4cee8e40..0609cc6b648f5 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj @@ -608,8 +608,7 @@ - true + true - diff --git a/src/libraries/Directory.Build.props b/src/libraries/Directory.Build.props index 7cf964f8366d8..b46ee2f5249a9 100644 --- a/src/libraries/Directory.Build.props +++ b/src/libraries/Directory.Build.props @@ -70,7 +70,6 @@ - @@ -84,6 +83,7 @@ + true true false diff --git a/src/libraries/Directory.Build.targets b/src/libraries/Directory.Build.targets index 37fc0f12c2420..28ee4d2f303c6 100644 --- a/src/libraries/Directory.Build.targets +++ b/src/libraries/Directory.Build.targets @@ -125,7 +125,7 @@ - + @@ -141,11 +141,16 @@ - - + + + + + + + @@ -53,7 +54,7 @@ RoslynAssembliesPath="$(RoslynAssembliesPath)" GenerateSuppressionFile="$(ApiCompatGenerateSuppressionFile)" SuppressionFiles="$(ApiCompatNetCoreAppLatestStableBaselineFile)" - EnableRuleAttributesMustMatch="$(ApiCompatEnableRuleAttributesMustMatch)" + EnableRuleAttributesMustMatch="true" ExcludeAttributesFiles="@(ApiCompatExcludeAttributesFile)" LeftAssembliesTransformationPattern="@(ApiCompatNetCoreAppLatestStableLeftAssembliesTransformationPattern)" RightAssembliesTransformationPattern="@(ApiCompatNetCoreAppCurrentRightAssembliesTransformationPattern)" /> @@ -65,7 +66,7 @@ RoslynAssembliesPath="$(RoslynAssembliesPath)" GenerateSuppressionFile="$(ApiCompatGenerateSuppressionFile)" SuppressionFiles="$(ApiCompatNetStandard21BaselineFile)" - EnableRuleAttributesMustMatch="$(ApiCompatEnableRuleAttributesMustMatch)" + EnableRuleAttributesMustMatch="true" ExcludeAttributesFiles="@(ApiCompatExcludeAttributesFile)" LeftAssembliesTransformationPattern="@(ApiCompatNetStandard21LeftAssembliesTransformationPattern)" RightAssembliesTransformationPattern="@(ApiCompatNetCoreAppCurrentRightAssembliesTransformationPattern)" /> @@ -77,7 +78,7 @@ RoslynAssembliesPath="$(RoslynAssembliesPath)" GenerateSuppressionFile="$(ApiCompatGenerateSuppressionFile)" SuppressionFiles="$(ApiCompatNetStandard20BaselineFile)" - EnableRuleAttributesMustMatch="$(ApiCompatEnableRuleAttributesMustMatch)" + EnableRuleAttributesMustMatch="true" ExcludeAttributesFiles="@(ApiCompatExcludeAttributesFile)" LeftAssembliesTransformationPattern="@(ApiCompatNetStandard20LeftAssembliesTransformationPattern)" RightAssembliesTransformationPattern="@(ApiCompatNetCoreAppCurrentRightAssembliesTransformationPattern)" /> diff --git a/src/libraries/shims/Directory.Build.targets b/src/libraries/shims/Directory.Build.targets index 0780fa92ad2e8..c8ee44a679b42 100644 --- a/src/libraries/shims/Directory.Build.targets +++ b/src/libraries/shims/Directory.Build.targets @@ -1,17 +1,21 @@ - - - - - - + + + GenFacadesReferenceAssembly + + true $(GeneratePartialFacadeSourceDependsOn);FindReferenceAssembliesForReferences ReferencePathWithRefAssemblies + + + + + diff --git a/src/libraries/shims/src/Directory.Build.props b/src/libraries/shims/src/Directory.Build.props index 5841ecb19f20c..0b532b15f5913 100644 --- a/src/libraries/shims/src/Directory.Build.props +++ b/src/libraries/shims/src/Directory.Build.props @@ -5,11 +5,4 @@ $(MSBuildThisFileDirectory)..\ref\$(MSBuildProjectName).csproj true - - - - - diff --git a/src/libraries/shims/src/netstandard.csproj b/src/libraries/shims/src/netstandard.csproj index cce47288ba655..ee3f1d4f47b01 100644 --- a/src/libraries/shims/src/netstandard.csproj +++ b/src/libraries/shims/src/netstandard.csproj @@ -8,6 +8,6 @@ - + diff --git a/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj index 17a336f423c22..b23dce200a1ab 100644 --- a/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -347,9 +347,8 @@ - true + true - From f7e4f6d8c248bf5999c94a5548d6fb1c5284c408 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Tue, 22 Nov 2022 16:29:10 +0100 Subject: [PATCH 2/4] Fix System.DirectoryServices.AccountManagement build System.DirectoryServices.AccountManagement now builds against src/System.DirectoryServices instead of ref/System.DirectoryServices (because the package doesn't contain the ref assembly). Because of that, the compiler now gets confused because of the System.DirectoryServices.Interop namespace and the global Interop class. This happens even though the DirectoryServices.Interop namespace doesn't include any public types. That results in the following erros: src\libraries\System.DirectoryServices.AccountManagement\src\System\DirectoryServices\AccountManagement\AD\SidList.cs(50,26): error CS0246: The type or namespace name 'SID_AND_ATTRIBUTES' could not be found (are you missing a using directive or an assembly reference?) src\libraries\System.DirectoryServices.AccountManagement\src\System\DirectoryServices\AccountManagement\interopt.cs(439,20): error CS0246: The type or namespace name 'UNICODE_INTPTR_STRING' could not be found (are you missing a using directive or an assembly reference?) This commit fixes that by removing the System.DirectoryServices.Interop namespace and moving the types into the parent namespace. --- .../System.DirectoryServices/src/ILLink/ILLink.Suppressions.xml | 2 +- .../System.DirectoryServices/src/Interop/AdsOptions.cs | 2 +- .../src/Interop/AdsPropertyOperation.cs | 2 +- .../System.DirectoryServices/src/Interop/AdsSearchColumn.cs | 2 +- .../src/Interop/AdsSearchPreferenceInfo.cs | 2 +- .../src/Interop/AdsSearchPreferences.cs | 2 +- .../System.DirectoryServices/src/Interop/AdsSortKey.cs | 2 +- src/libraries/System.DirectoryServices/src/Interop/AdsType.cs | 2 +- src/libraries/System.DirectoryServices/src/Interop/AdsValue2.cs | 2 +- .../System.DirectoryServices/src/Interop/AdsValueHelper2.cs | 2 +- .../System.DirectoryServices/src/Interop/NativeMethods.cs | 2 +- .../System.DirectoryServices/src/Interop/SafeNativeMethods.cs | 2 +- .../System.DirectoryServices/src/Interop/UnsafeNativeMethods.cs | 2 +- .../DirectoryServices/ActiveDirectory/DomainController.cs | 2 +- .../src/System/DirectoryServices/AuthenticationTypes.cs | 2 -- .../src/System/DirectoryServices/DirectoryEntries.cs | 1 - .../src/System/DirectoryServices/DirectoryEntry.cs | 1 - .../src/System/DirectoryServices/DirectoryEntryConfiguration.cs | 1 - .../src/System/DirectoryServices/DirectorySearcher.cs | 1 - .../System/DirectoryServices/DirectoryServicesCOMException.cs | 1 - .../src/System/DirectoryServices/PropertyCollection.cs | 1 - .../src/System/DirectoryServices/PropertyValueCollection.cs | 1 - .../src/System/DirectoryServices/SchemaNameCollection.cs | 1 - .../src/System/DirectoryServices/SearchResultCollection.cs | 1 - 24 files changed, 14 insertions(+), 25 deletions(-) diff --git a/src/libraries/System.DirectoryServices/src/ILLink/ILLink.Suppressions.xml b/src/libraries/System.DirectoryServices/src/ILLink/ILLink.Suppressions.xml index ca9681a8e8f63..b27ed192851d2 100644 --- a/src/libraries/System.DirectoryServices/src/ILLink/ILLink.Suppressions.xml +++ b/src/libraries/System.DirectoryServices/src/ILLink/ILLink.Suppressions.xml @@ -5,7 +5,7 @@ ILLink IL2050 member - M:System.DirectoryServices.Interop.UnsafeNativeMethods.ADsOpenObject(System.String,System.String,System.String,System.Int32,System.Guid@,System.Object@) + M:System.DirectoryServices.UnsafeNativeMethods.ADsOpenObject(System.String,System.String,System.String,System.Int32,System.Guid@,System.Object@) ILLink diff --git a/src/libraries/System.DirectoryServices/src/Interop/AdsOptions.cs b/src/libraries/System.DirectoryServices/src/Interop/AdsOptions.cs index fe0ad8b59edce..d69988da76d4f 100644 --- a/src/libraries/System.DirectoryServices/src/Interop/AdsOptions.cs +++ b/src/libraries/System.DirectoryServices/src/Interop/AdsOptions.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System.DirectoryServices.Interop +namespace System.DirectoryServices { internal enum AdsOptions { diff --git a/src/libraries/System.DirectoryServices/src/Interop/AdsPropertyOperation.cs b/src/libraries/System.DirectoryServices/src/Interop/AdsPropertyOperation.cs index 4d5baf7145e79..51e3ca30f7e91 100644 --- a/src/libraries/System.DirectoryServices/src/Interop/AdsPropertyOperation.cs +++ b/src/libraries/System.DirectoryServices/src/Interop/AdsPropertyOperation.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System.DirectoryServices.Interop +namespace System.DirectoryServices { internal enum AdsPropertyOperation { diff --git a/src/libraries/System.DirectoryServices/src/Interop/AdsSearchColumn.cs b/src/libraries/System.DirectoryServices/src/Interop/AdsSearchColumn.cs index 76dca56431ad3..eec178f3802bb 100644 --- a/src/libraries/System.DirectoryServices/src/Interop/AdsSearchColumn.cs +++ b/src/libraries/System.DirectoryServices/src/Interop/AdsSearchColumn.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; -namespace System.DirectoryServices.Interop +namespace System.DirectoryServices { [StructLayout(LayoutKind.Sequential)] internal unsafe struct AdsSearchColumn diff --git a/src/libraries/System.DirectoryServices/src/Interop/AdsSearchPreferenceInfo.cs b/src/libraries/System.DirectoryServices/src/Interop/AdsSearchPreferenceInfo.cs index e1b5936c71fd3..0e8c328615446 100644 --- a/src/libraries/System.DirectoryServices/src/Interop/AdsSearchPreferenceInfo.cs +++ b/src/libraries/System.DirectoryServices/src/Interop/AdsSearchPreferenceInfo.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; -namespace System.DirectoryServices.Interop +namespace System.DirectoryServices { [StructLayout(LayoutKind.Sequential)] internal struct AdsSearchPreferenceInfo diff --git a/src/libraries/System.DirectoryServices/src/Interop/AdsSearchPreferences.cs b/src/libraries/System.DirectoryServices/src/Interop/AdsSearchPreferences.cs index ec409e3a53c30..dd4df804005e0 100644 --- a/src/libraries/System.DirectoryServices/src/Interop/AdsSearchPreferences.cs +++ b/src/libraries/System.DirectoryServices/src/Interop/AdsSearchPreferences.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System.DirectoryServices.Interop +namespace System.DirectoryServices { internal enum AdsSearchPreferences { diff --git a/src/libraries/System.DirectoryServices/src/Interop/AdsSortKey.cs b/src/libraries/System.DirectoryServices/src/Interop/AdsSortKey.cs index 1c844d7741c97..b25a14b9a29cf 100644 --- a/src/libraries/System.DirectoryServices/src/Interop/AdsSortKey.cs +++ b/src/libraries/System.DirectoryServices/src/Interop/AdsSortKey.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; -namespace System.DirectoryServices.Interop +namespace System.DirectoryServices { [StructLayout(LayoutKind.Sequential)] internal struct AdsSortKey diff --git a/src/libraries/System.DirectoryServices/src/Interop/AdsType.cs b/src/libraries/System.DirectoryServices/src/Interop/AdsType.cs index 7320c9d512cb4..2c1d54779ab44 100644 --- a/src/libraries/System.DirectoryServices/src/Interop/AdsType.cs +++ b/src/libraries/System.DirectoryServices/src/Interop/AdsType.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System.DirectoryServices.Interop +namespace System.DirectoryServices { internal enum AdsType { diff --git a/src/libraries/System.DirectoryServices/src/Interop/AdsValue2.cs b/src/libraries/System.DirectoryServices/src/Interop/AdsValue2.cs index 82c2413f1ec71..5aa77b9ea7c95 100644 --- a/src/libraries/System.DirectoryServices/src/Interop/AdsValue2.cs +++ b/src/libraries/System.DirectoryServices/src/Interop/AdsValue2.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; -namespace System.DirectoryServices.Interop +namespace System.DirectoryServices { [StructLayout(LayoutKind.Sequential)] internal struct Ads_Pointer diff --git a/src/libraries/System.DirectoryServices/src/Interop/AdsValueHelper2.cs b/src/libraries/System.DirectoryServices/src/Interop/AdsValueHelper2.cs index 10b208f0784cc..3a19d778c2464 100644 --- a/src/libraries/System.DirectoryServices/src/Interop/AdsValueHelper2.cs +++ b/src/libraries/System.DirectoryServices/src/Interop/AdsValueHelper2.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices; using System.Globalization; -namespace System.DirectoryServices.Interop +namespace System.DirectoryServices { [StructLayout(LayoutKind.Sequential)] internal struct SystemTime diff --git a/src/libraries/System.DirectoryServices/src/Interop/NativeMethods.cs b/src/libraries/System.DirectoryServices/src/Interop/NativeMethods.cs index 7ce5748edbc6c..ca45d792515d6 100644 --- a/src/libraries/System.DirectoryServices/src/Interop/NativeMethods.cs +++ b/src/libraries/System.DirectoryServices/src/Interop/NativeMethods.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System.DirectoryServices.Interop +namespace System.DirectoryServices { internal static class NativeMethods { diff --git a/src/libraries/System.DirectoryServices/src/Interop/SafeNativeMethods.cs b/src/libraries/System.DirectoryServices/src/Interop/SafeNativeMethods.cs index db401906f69ee..9ae1fdfd26811 100644 --- a/src/libraries/System.DirectoryServices/src/Interop/SafeNativeMethods.cs +++ b/src/libraries/System.DirectoryServices/src/Interop/SafeNativeMethods.cs @@ -5,7 +5,7 @@ using System.Security; using System.Runtime.InteropServices; -namespace System.DirectoryServices.Interop +namespace System.DirectoryServices { internal static partial class SafeNativeMethods { diff --git a/src/libraries/System.DirectoryServices/src/Interop/UnsafeNativeMethods.cs b/src/libraries/System.DirectoryServices/src/Interop/UnsafeNativeMethods.cs index 30912155a31fc..b6f6e72aad9bd 100644 --- a/src/libraries/System.DirectoryServices/src/Interop/UnsafeNativeMethods.cs +++ b/src/libraries/System.DirectoryServices/src/Interop/UnsafeNativeMethods.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices; using System.Security; -namespace System.DirectoryServices.Interop +namespace System.DirectoryServices { [StructLayout(LayoutKind.Explicit)] diff --git a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/DomainController.cs b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/DomainController.cs index 649941c65b93a..59ed8f626e79c 100644 --- a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/DomainController.cs +++ b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/DomainController.cs @@ -410,7 +410,7 @@ public void SeizeRoleOwnership(ActiveDirectoryRole role) // Increment the RIDAvailablePool by 30k. if (role == ActiveDirectoryRole.RidRole) { - System.DirectoryServices.Interop.UnsafeNativeMethods.IADsLargeInteger ridPool = (System.DirectoryServices.Interop.UnsafeNativeMethods.IADsLargeInteger)roleObjectEntry.Properties[PropertyManager.RIDAvailablePool].Value!; + System.DirectoryServices.UnsafeNativeMethods.IADsLargeInteger ridPool = (System.DirectoryServices.UnsafeNativeMethods.IADsLargeInteger)roleObjectEntry.Properties[PropertyManager.RIDAvailablePool].Value!; // check the overflow of the low part if (ridPool.LowPart + UpdateRidPoolSeizureValue < ridPool.LowPart) diff --git a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/AuthenticationTypes.cs b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/AuthenticationTypes.cs index 0a7ece6d9ddb1..f44e180c4c384 100644 --- a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/AuthenticationTypes.cs +++ b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/AuthenticationTypes.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.DirectoryServices.Interop; - namespace System.DirectoryServices { /// diff --git a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryEntries.cs b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryEntries.cs index 71d53ef690119..cb2082a0f1ffb 100644 --- a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryEntries.cs +++ b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryEntries.cs @@ -3,7 +3,6 @@ using System.Runtime.InteropServices; using System.Collections; -using System.DirectoryServices.Interop; namespace System.DirectoryServices { diff --git a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryEntry.cs b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryEntry.cs index 429c4a4f779e8..c4d046cf00656 100644 --- a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryEntry.cs +++ b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryEntry.cs @@ -3,7 +3,6 @@ using System.Runtime.InteropServices; using System.Diagnostics; -using System.DirectoryServices.Interop; using System.ComponentModel; using System.Threading; using System.Reflection; diff --git a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryEntryConfiguration.cs b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryEntryConfiguration.cs index df98c45350281..1ff7fcb1e3d2a 100644 --- a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryEntryConfiguration.cs +++ b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryEntryConfiguration.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.DirectoryServices.Interop; using System.ComponentModel; namespace System.DirectoryServices diff --git a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectorySearcher.cs b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectorySearcher.cs index 846fffa58e4f2..1ef524342a335 100644 --- a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectorySearcher.cs +++ b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectorySearcher.cs @@ -4,7 +4,6 @@ using System.Runtime.InteropServices; using System.Collections; using System.Collections.Specialized; -using System.DirectoryServices.Interop; using System.ComponentModel; using INTPTR_INTPTRCAST = System.IntPtr; diff --git a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryServicesCOMException.cs b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryServicesCOMException.cs index ac1ee821b1c46..6ff6d88c56241 100644 --- a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryServicesCOMException.cs +++ b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryServicesCOMException.cs @@ -4,7 +4,6 @@ using System.ComponentModel; using System.Runtime.InteropServices; using System.Runtime.Serialization; -using System.DirectoryServices.Interop; namespace System.DirectoryServices { diff --git a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/PropertyCollection.cs b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/PropertyCollection.cs index 51878e2cc52d1..38d202f705364 100644 --- a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/PropertyCollection.cs +++ b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/PropertyCollection.cs @@ -3,7 +3,6 @@ using System.Runtime.InteropServices; using System.Collections; -using System.DirectoryServices.Interop; using System.Globalization; namespace System.DirectoryServices diff --git a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/PropertyValueCollection.cs b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/PropertyValueCollection.cs index 4ae15eb0b7a9d..a006b65e7e4bb 100644 --- a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/PropertyValueCollection.cs +++ b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/PropertyValueCollection.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections; -using System.DirectoryServices.Interop; namespace System.DirectoryServices { diff --git a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/SchemaNameCollection.cs b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/SchemaNameCollection.cs index 853c659ecfd88..7acb9bf62334e 100644 --- a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/SchemaNameCollection.cs +++ b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/SchemaNameCollection.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections; -using System.DirectoryServices.Interop; namespace System.DirectoryServices { diff --git a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/SearchResultCollection.cs b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/SearchResultCollection.cs index 4711b60e97b54..dac7ae1f9f754 100644 --- a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/SearchResultCollection.cs +++ b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/SearchResultCollection.cs @@ -4,7 +4,6 @@ using System.Net; using System.Runtime.InteropServices; using System.Collections; -using System.DirectoryServices.Interop; using System.Text; using INTPTR_INTPTRCAST = System.IntPtr; From 0aed816eba20ad7bfae05556d57d0fb3c3030226 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Tue, 22 Nov 2022 16:33:44 +0100 Subject: [PATCH 3/4] Suppress nullable warnings in Serialization.Schema Now that Schema compiles against the source assembly of System.CodeDom, it receives nullability errors. I'm suppressing them manually for now but am filing an issue to correctly fix those. Related: https://github.com/dotnet/runtime/issues/78036 --- .../Runtime/Serialization/Schema/CodeExporter.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libraries/System.Runtime.Serialization.Schema/src/System/Runtime/Serialization/Schema/CodeExporter.cs b/src/libraries/System.Runtime.Serialization.Schema/src/System/Runtime/Serialization/Schema/CodeExporter.cs index e0282ac4d556b..57064b5d1b003 100644 --- a/src/libraries/System.Runtime.Serialization.Schema/src/System/Runtime/Serialization/Schema/CodeExporter.cs +++ b/src/libraries/System.Runtime.Serialization.Schema/src/System/Runtime/Serialization/Schema/CodeExporter.cs @@ -518,8 +518,8 @@ private static CodeTypeDeclaration CreateTypeDeclaration(string typeName, DataCo CodeAttributeDeclaration generatedCodeAttribute = new CodeAttributeDeclaration(typeof(GeneratedCodeAttribute).FullName!); AssemblyName assemblyName = Assembly.GetExecutingAssembly().GetName(); - generatedCodeAttribute.Arguments.Add(new CodeAttributeArgument(new CodePrimitiveExpression(assemblyName.Name))); - generatedCodeAttribute.Arguments.Add(new CodeAttributeArgument(new CodePrimitiveExpression(assemblyName.Version?.ToString()))); + generatedCodeAttribute.Arguments.Add(new CodeAttributeArgument(new CodePrimitiveExpression(assemblyName.Name!))); + generatedCodeAttribute.Arguments.Add(new CodeAttributeArgument(new CodePrimitiveExpression(assemblyName.Version?.ToString()!))); // System.Diagnostics.DebuggerStepThroughAttribute not allowed on enums // ensure that the attribute is only generated on types that are not enums @@ -818,7 +818,7 @@ private void ExportClassDataContract(DataContract classDataContract, ContractCod { ContractCodeDomInfo baseContractCodeDomInfo = GetContractCodeDomInfo(classDataContract.BaseContract); Debug.Assert(baseContractCodeDomInfo.IsProcessed, "Cannot generate code for type if code for base type has not been generated"); - type.BaseTypes.Add(baseContractCodeDomInfo.TypeReference); + type.BaseTypes.Add(baseContractCodeDomInfo.TypeReference!); AddBaseMemberNames(baseContractCodeDomInfo, contractCodeDomInfo); if (baseContractCodeDomInfo.ReferencedTypeExists) { @@ -1151,7 +1151,7 @@ private void ExportISerializableDataContract(DataContract classDataContract, Con { ContractCodeDomInfo baseContractCodeDomInfo = GetContractCodeDomInfo(classDataContract.BaseContract); GenerateType(classDataContract.BaseContract, baseContractCodeDomInfo); - type.BaseTypes.Add(baseContractCodeDomInfo.TypeReference); + type.BaseTypes.Add(baseContractCodeDomInfo.TypeReference!); if (baseContractCodeDomInfo.ReferencedTypeExists) { Type? actualType = (Type?)baseContractCodeDomInfo.TypeReference?.UserData[s_codeUserDataActualTypeKey]; @@ -1236,7 +1236,7 @@ private void ExportCollectionDataContract(DataContract collectionContract, Contr Debug.Assert(contractCodeDomInfo.TypeDeclaration != null); CodeTypeDeclaration generatedType = contractCodeDomInfo.TypeDeclaration; - generatedType.BaseTypes.Add(baseTypeReference); + generatedType.BaseTypes.Add(baseTypeReference!); CodeAttributeDeclaration collectionContractAttribute = new CodeAttributeDeclaration(GetClrTypeFullName(typeof(CollectionDataContractAttribute))); collectionContractAttribute.Arguments.Add(new CodeAttributeArgument(ImportGlobals.NameProperty, new CodePrimitiveExpression(dataContractName))); collectionContractAttribute.Arguments.Add(new CodeAttributeArgument(ImportGlobals.NamespaceProperty, new CodePrimitiveExpression(collectionContract.XmlName.Namespace))); @@ -1671,7 +1671,7 @@ private static CodeThisReferenceExpression ThisReference private static CodePrimitiveExpression NullReference { - get { return new CodePrimitiveExpression(null); } + get { return new CodePrimitiveExpression(null!); } } private CodeParameterDeclarationExpression SerializationInfoParameter @@ -1782,12 +1782,12 @@ private CodeMemberMethod GetSchemaStaticMethod new CodeTypeReferenceExpression(GetCodeTypeReference(typeof(XmlSerializableServices))), nameof(XmlSerializableServices.AddDefaultSchema), new CodeArgumentReferenceExpression(paramDeclaration.Name), - new CodeFieldReferenceExpression(null, TypeNameFieldName) + new CodeFieldReferenceExpression(null!, TypeNameFieldName) ) ); getSchemaStaticMethod.Statements.Add( new CodeMethodReturnStatement( - new CodeFieldReferenceExpression(null, TypeNameFieldName) + new CodeFieldReferenceExpression(null!, TypeNameFieldName) ) ); return getSchemaStaticMethod; From e79bc1e3df5d7ec71c004dedc5459be8b1883ee4 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Tue, 22 Nov 2022 17:48:20 +0100 Subject: [PATCH 4/4] Move SkipUseReferenceAssembly target up --- eng/references.targets | 20 ++++++++++++++++++++ eng/resolveContract.targets | 20 -------------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/eng/references.targets b/eng/references.targets index 9ce2c0ed3e60c..0dac678971586 100644 --- a/eng/references.targets +++ b/eng/references.targets @@ -59,6 +59,26 @@ + + + + + false + + + + <_resolvedP2PFiltered Include="@(ProjectReference)" + ProjectReferenceItemSpec="$([System.IO.Path]::GetFullPath('%(ProjectReference.Identity)'))" + SkipUseReferenceAssembly="%(ProjectReference.SkipUseReferenceAssembly)" /> + <_ResolvedProjectReferencePaths Condition="'%(_resolvedP2PFiltered.ProjectReferenceItemSpec)' == '%(_resolvedP2PFiltered.MSBuildSourceProjectFile)' and + '%(_resolvedP2PFiltered.SkipUseReferenceAssembly)' == 'true'" + ReferenceAssembly="" /> + + + $(IsReferenceAssemblyProject) diff --git a/eng/resolveContract.targets b/eng/resolveContract.targets index 01e77e24e0ac9..c3ed00145d141 100644 --- a/eng/resolveContract.targets +++ b/eng/resolveContract.targets @@ -3,7 +3,6 @@ ##### Contract project settings ##### - Allows referencing contract projects for passing matching reference assemblies to tooling like ApiCompat. - Allows building against contract assemblies when referencing source projects. - - Allows building against source assemblies instead when the 'SkipUseReferenceAssembly' attribute is present on ProjectReference items. --> @@ -38,25 +37,6 @@ - - - - false - - - - <_resolvedP2PFiltered Include="@(ProjectReference)" - ProjectReferenceItemSpec="$([System.IO.Path]::GetFullPath('%(ProjectReference.Identity)'))" - SkipUseReferenceAssembly="%(ProjectReference.SkipUseReferenceAssembly)" /> - <_ResolvedProjectReferencePaths Condition="'%(_resolvedP2PFiltered.ProjectReferenceItemSpec)' == '%(_resolvedP2PFiltered.MSBuildSourceProjectFile)' and - '%(_resolvedP2PFiltered.SkipUseReferenceAssembly)' == 'true'" - ReferenceAssembly="" /> - - -