Skip to content

Commit 35d00da

Browse files
Resolved many compilation warnings
1 parent 9c9940d commit 35d00da

235 files changed

Lines changed: 18658 additions & 17890 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/autobuild.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,10 @@ jobs:
3131
- name: Setup .NET
3232
uses: actions/setup-dotnet@v4
3333
with:
34-
# .NET SDK 10 is used for build. Platform-specific IJW hosts from previous .NET SDKs are used when building C++/CLI projects.
34+
# .NET SDK 9 is used for build. Platform-specific IJW hosts from previous .NET SDKs are used when building C++/CLI projects.
3535
dotnet-version: |
3636
8.0.x
3737
9.0.x
38-
10.0.x
3938
cache: true
4039
cache-dependency-path: 'Src/*/packages.lock.json'
4140

.github/workflows/release.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,10 @@ jobs:
8484
- name: Setup .NET
8585
uses: actions/setup-dotnet@v4
8686
with:
87-
# .NET SDK 10 is used for build. Platform-specific IJW hosts from previous .NET SDKs are used when building C++/CLI projects.
87+
# .NET SDK 9 is used for build. Platform-specific IJW hosts from previous .NET SDKs are used when building C++/CLI projects.
8888
dotnet-version: |
8989
8.0.x
9090
9.0.x
91-
10.0.x
9291
cache: true
9392
cache-dependency-path: 'Src/*/packages.lock.json'
9493

Src/DSInternals.ADSI/AdsiClient.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.DirectoryServices;
22
using System.DirectoryServices.ActiveDirectory;
3+
using System.Globalization;
34
using System.Net;
45
using DSInternals.Common;
56
using DSInternals.Common.Data;
@@ -10,7 +11,7 @@ namespace DSInternals.ADSI;
1011
public sealed class AdsiClient : IDisposable
1112
{
1213
private const string NetbiosNameFilterFormat = "(&(objectCategory=crossRef)(nETBIOSName=*)(dnsroot={0}))";
13-
private static readonly string[] NetbiosNamePropertiesToLoad = [ CommonDirectoryAttributes.NetBIOSName ];
14+
private static readonly string[] NetbiosNamePropertiesToLoad = [CommonDirectoryAttributes.NetBIOSName];
1415
private const string AccountsFilter = "(objectClass=user)";
1516

1617
private DirectoryContext _directoryContext;
@@ -41,7 +42,7 @@ public AdsiClient(string server = null, NetworkCredential credential = null)
4142
// Resolve the domain partition
4243
_domainNamingContext = dc.Domain.GetDirectoryEntry();
4344
_dnsDomainName = dc.Domain.Name;
44-
45+
4546
// Resolve the configuration partition
4647
_configurationNamingContext = GetConfigurationNamingContext(dc);
4748
}
@@ -131,7 +132,7 @@ public IEnumerable<DSAccount> GetAccounts(AccountPropertySets propertySets = Acc
131132
CommonDirectoryAttributes.Description,
132133
CommonDirectoryAttributes.PasswordLastSet
133134
]);
134-
}
135+
}
135136

136137
if (propertySets.HasFlag(AccountPropertySets.GenericUserInfo))
137138
{
@@ -249,7 +250,7 @@ public void Dispose()
249250
/// <exception cref="InvalidOperationException">Thrown if the NetBIOS domain name cannot be found for the current DNS domain name.</exception>
250251
private string GetNetbiosDomainName()
251252
{
252-
string netbiosNameFilter = string.Format(NetbiosNameFilterFormat, _dnsDomainName);
253+
string netbiosNameFilter = string.Format(CultureInfo.InvariantCulture, NetbiosNameFilterFormat, _dnsDomainName);
253254

254255
using (var netbiosNameSearcher = new DirectorySearcher(_configurationNamingContext, netbiosNameFilter, NetbiosNamePropertiesToLoad, SearchScope.Subtree))
255256
{

Src/DSInternals.ADSI/AdsiKdsRootKeyResolver.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.DirectoryServices;
2+
using System.Globalization;
23
using DSInternals.Common.Data;
34
using DSInternals.Common.Schema;
45

@@ -44,7 +45,7 @@ public AdsiKdsRootKeyResolver(DirectoryEntry configurationNamingContext)
4445

4546
public KdsRootKey? GetKdsRootKey(Guid id)
4647
{
47-
string rootKeyFilter = string.Format(KdsRootKeyByIdFilterFormat, id.ToString("D"));
48+
string rootKeyFilter = string.Format(CultureInfo.InvariantCulture, KdsRootKeyByIdFilterFormat, id.ToString("D"));
4849
using var singleRootKeySearcher = new DirectorySearcher(
4950
_configurationNamingContext,
5051
rootKeyFilter,

Src/DSInternals.ADSI/AdsiObjectAdapter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class AdsiObjectAdapter : DirectoryObject
1212

1313
public AdsiObjectAdapter(SearchResult directoryEntry)
1414
{
15-
Validator.AssertNotNull(directoryEntry, "directoryEntry");
15+
ArgumentNullException.ThrowIfNull(directoryEntry);
1616
this.directoryEntry = directoryEntry;
1717
}
1818

@@ -110,7 +110,7 @@ protected TResult ReadAttributeSingle<TResult>(string name)
110110
protected TResult[] ReadAttributeMulti<TResult>(string name)
111111
{
112112
var result = this.directoryEntry.Properties[name].Cast<TResult>().ToArray();
113-
if(result != null && result.Length == 0)
113+
if (result != null && result.Length == 0)
114114
{
115115
// We do not want to return an empty array.
116116
result = null;

Src/DSInternals.ADSI/packages.lock.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
"Microsoft.SourceLink.Common": "8.0.0"
1313
}
1414
},
15+
"Polyfill": {
16+
"type": "Direct",
17+
"requested": "[9.5.0, )",
18+
"resolved": "9.5.0",
19+
"contentHash": "T3E8+K+W0u78495PwSSJOzT6QUbnZSdkDK4B3nfvxUo9nctDr6ChSDLV4l/RD2ZmA5oHM2YbLvyp+a2uE0ftOQ=="
20+
},
1521
"Microsoft.Bcl.AsyncInterfaces": {
1622
"type": "Transitive",
1723
"resolved": "9.0.8",
@@ -76,6 +82,7 @@
7682
"dsinternals.common": {
7783
"type": "Project",
7884
"dependencies": {
85+
"Polyfill": "[9.5.0, )",
7986
"System.Buffers": "[4.6.1, )",
8087
"System.Formats.Asn1": "[9.0.9, )",
8188
"System.Formats.Cbor": "[9.0.9, )",
@@ -148,7 +155,7 @@
148155
"contentHash": "+RJT4qaekpZ7DDLhf+LTjq+E48jieKiY9ulJ+BoxKmZblIJfIJT8Ufcaa/clQqnYvWs8jugfGSMu8ylS0caG0w=="
149156
}
150157
},
151-
"net10.0-windows7.0": {
158+
"net8.0-windows7.0": {
152159
"Microsoft.SourceLink.GitHub": {
153160
"type": "Direct",
154161
"requested": "[8.0.0, )",
@@ -188,7 +195,7 @@
188195
"contentHash": "typxwjuGJyooPZNwInKvEBB/qXwGFoXDH+2gEP0YidaK/qwcrbHl0naeE1O3A2Xn30cCVl79G/v/+ta2eJxh1w=="
189196
}
190197
},
191-
"net8.0-windows7.0": {
198+
"net9.0-windows7.0": {
192199
"Microsoft.SourceLink.GitHub": {
193200
"type": "Direct",
194201
"requested": "[8.0.0, )",

Src/DSInternals.Common.Test/ByteArrayExtensionsTester.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@ public void ByteArrayExtensions_Hex_UpperCase()
2828
Assert.AreEqual(hex, result);
2929
}
3030
[TestMethod]
31-
[ExpectedException(typeof(ArgumentException))]
3231
public void ByteArrayExtensions_HexToBinary_InvalidInput()
3332
{
3433
string hex = "eqwewqwty";
35-
byte[] result = hex.HexToBinary();
34+
Assert.ThrowsExactly<ArgumentException>(() => hex.HexToBinary());
3635
}
3736
[TestMethod]
3837
public void ByteArrayExtensions_HexToBinary_NullInput()
@@ -68,8 +67,8 @@ public void ByteArrayExtensions_ToHex_EmptyInput()
6867
[TestMethod]
6968
public void ByteArrayExtensions_ZeroFill_Input1()
7069
{
71-
byte[] input = new byte[] {2, 4, 0};
72-
byte[] expected = new byte[] {0, 0, 0};
70+
byte[] input = new byte[] { 2, 4, 0 };
71+
byte[] expected = new byte[] { 0, 0, 0 };
7372
input.ZeroFill();
7473
CollectionAssert.AreEqual(expected, input);
7574
}

Src/DSInternals.Common.Test/CredentialRoamingTester.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
using DSInternals.Common.Data;
2-
using Microsoft.VisualStudio.TestTools.UnitTesting;
3-
using System;
1+
using System;
42
using System.Security.Principal;
3+
using DSInternals.Common.Data;
4+
using Microsoft.VisualStudio.TestTools.UnitTesting;
55

66
namespace DSInternals.Common.Test
77
{

Src/DSInternals.Common.Test/Cryptography/GPPrefPwdObfuscatorTester.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
using DSInternals.Common;
2-
using System;
3-
using Microsoft.VisualStudio.TestTools.UnitTesting;
1+
using System;
42
using System.Security;
3+
using DSInternals.Common;
4+
using Microsoft.VisualStudio.TestTools.UnitTesting;
55

66
namespace DSInternals.Common.Cryptography.Test
77
{
@@ -27,17 +27,15 @@ public void GPPrefPwdObfuscator_Decrypt_TestVector2()
2727
}
2828

2929
[TestMethod]
30-
[ExpectedException(typeof(ArgumentNullException))]
3130
public void GPPrefPwdObfuscator_Decrypt_NullInput()
3231
{
33-
string result = GPPrefPwdObfuscator.Decrypt(null);
32+
Assert.ThrowsExactly<ArgumentNullException>(() => GPPrefPwdObfuscator.Decrypt(null));
3433
}
3534

3635
[TestMethod]
37-
[ExpectedException(typeof(ArgumentNullException))]
3836
public void GPPrefPwdObfuscator_Decrypt_EmptyInput()
3937
{
40-
string result = GPPrefPwdObfuscator.Decrypt(String.Empty);
38+
Assert.ThrowsExactly<ArgumentNullException>(() => GPPrefPwdObfuscator.Decrypt(String.Empty));
4139
}
4240
[TestMethod]
4341
public void GPPrefPwdObfuscator_Encrypt_Test1()
@@ -55,10 +53,9 @@ public void GPPrefPwdObfuscator_Encrypt_EmptyInput()
5553
Assert.AreEqual(String.Empty, result);
5654
}
5755
[TestMethod]
58-
[ExpectedException(typeof(ArgumentNullException))]
5956
public void GPPrefPwdObfuscator_Encrypt_NullInput()
6057
{
61-
string result = GPPrefPwdObfuscator.Encrypt(null);
58+
Assert.ThrowsExactly<ArgumentNullException>(() => GPPrefPwdObfuscator.Encrypt(null));
6259
}
6360
}
6461
}

Src/DSInternals.Common.Test/Cryptography/HashEqualityComparerTester.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace DSInternals.Common.Cryptography.Test
22
{
3-
using DSInternals.Common;
43
using System;
4+
using DSInternals.Common;
55
using Microsoft.VisualStudio.TestTools.UnitTesting;
66

77
[TestClass]
@@ -13,7 +13,7 @@ public class HashEqualityComparerTester
1313
public void HashEqualityComparer_Equals_SameSize1()
1414
{
1515
byte[] vector1 = "92937945B518814341DE3F726500D4FF".HexToBinary();
16-
byte[] vector2 = (byte[]) vector1.Clone();
16+
byte[] vector2 = (byte[])vector1.Clone();
1717
bool result = comparer.Equals(vector1, vector2);
1818
Assert.AreEqual(true, result);
1919
}

0 commit comments

Comments
 (0)