diff --git a/eng/resolveContract.targets b/eng/resolveContract.targets
index 4a2b0a5adfcbd6..0aaf56d0a9731e 100644
--- a/eng/resolveContract.targets
+++ b/eng/resolveContract.targets
@@ -20,6 +20,17 @@
true
false
+
+ true
@@ -36,7 +47,7 @@
diff --git a/src/libraries/System.DirectoryServices/src/ILLink/ILLink.Suppressions.xml b/src/libraries/System.DirectoryServices/src/ILLink/ILLink.Suppressions.xml
index ca9681a8e8f63b..b27ed192851d2f 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 fe0ad8b59edce1..d69988da76d4fa 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 4d5baf7145e79c..51e3ca30f7e91d 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 76dca56431ad3c..eec178f3802bbc 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 e1b5936c71fd35..0e8c328615446f 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 ec409e3a53c309..dd4df804005e0d 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 1c844d7741c979..b25a14b9a29cf7 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 7320c9d512cb4b..2c1d54779ab44c 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 82c2413f1ec716..5aa77b9ea7c95f 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 10b208f0784ccf..3a19d778c24644 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 7ce5748edbc6c7..ca45d792515d66 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 db401906f69eea..9ae1fdfd26811c 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 30912155a31fc5..b6f6e72aad9bd2 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 98eb7d72044970..0a855c618d928c 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 0a7ece6d9ddb17..f44e180c4c384f 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 71d53ef6901198..cb2082a0f1ffbd 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 429c4a4f779e80..c4d046cf006568 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 df98c453502818..1ff7fcb1e3d2a4 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 846fffa58e4f2b..1ef524342a3357 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 ac1ee821b1c46d..6ff6d88c562415 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 51878e2cc52d1e..38d202f7053640 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 4ae15eb0b7a9d5..a006b65e7e4bbf 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 853c659ecfd88d..7acb9bf62334e7 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 4711b60e97b54c..dac7ae1f9f7542 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;
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 45476be4423f10..78a0301fe3ad50 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
@@ -520,8 +520,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
@@ -820,7 +820,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)
{
@@ -1153,7 +1153,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];
@@ -1238,7 +1238,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)));
@@ -1673,7 +1673,7 @@ private static CodeThisReferenceExpression ThisReference
private static CodePrimitiveExpression NullReference
{
- get { return new CodePrimitiveExpression(null); }
+ get { return new CodePrimitiveExpression(null!); }
}
private CodeParameterDeclarationExpression SerializationInfoParameter
@@ -1784,12 +1784,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;