Skip to content

Commit ea92a8a

Browse files
authored
chore: fix build warnings (#706)
1 parent 76d9a2b commit ea92a8a

16 files changed

+43
-14
lines changed

.devcontainer/devcontainer.json

-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,5 @@
44
"settings": {
55
"terminal.integrated.shell.linux": "/bin/bash"
66
},
7-
"extensions": [
8-
"ms-dotnettools.csharp"
9-
],
107
"postCreateCommand": "dotnet restore"
118
}

.vscode/extensions.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"recommendations": [
3+
"ms-vscode-remote.remote-containers",
4+
"ms-dotnettools.csharp"
5+
]
6+
}

Directory.Build.props

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)StrongName.snk</AssemblyOriginatorKeyFile>
88
<IncludeSymbols>true</IncludeSymbols>
99
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
10+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1011
<LangVersion>9.0</LangVersion>
1112
<PackageTags>testing</PackageTags>
1213
<PackageProjectUrl>https://github.com/System-IO-Abstractions/System.IO.Abstractions</PackageProjectUrl>

nuget.config

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<clear />
5+
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
6+
</packageSources>
7+
</configuration>

src/System.IO.Abstractions/Properties/AssemblyInfo.cs

-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55

66
#if DEBUG
77
[assembly: InternalsVisibleTo("System.IO.Abstractions.Tests")]
8-
[assembly: InternalsVisibleTo("System.IO.Abstractions.TestingHelpers.Tests")]
98
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
109
#else
1110
[assembly: InternalsVisibleTo("System.IO.Abstractions.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001001160c7a0f907c400c5392975b66d2f3752fb82625d5674d386b83896d4d4ae8d0ef8319ef391fbb3466de0058ad2f361b8f5cb8a32ecb4e908bece5c519387552cedd2ca0250e36b59c6d6dc3dc260ca73a7e27c3add4ae22d5abaa562225d7ba34d427e8f3f52928a46a674deb0208eca7d379aa22712355b91a55a5ce521d2")]
12-
[assembly: InternalsVisibleTo("System.IO.Abstractions.TestingHelpers.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001001160c7a0f907c400c5392975b66d2f3752fb82625d5674d386b83896d4d4ae8d0ef8319ef391fbb3466de0058ad2f361b8f5cb8a32ecb4e908bece5c519387552cedd2ca0250e36b59c6d6dc3dc260ca73a7e27c3add4ae22d5abaa562225d7ba34d427e8f3f52928a46a674deb0208eca7d379aa22712355b91a55a5ce521d2")]
1311
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2,PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
1412
#endif
1513

tests/System.IO.Abstractions.TestingHelpers.Tests/MockDirectoryArgumentPathTests.cs

+4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ private static IEnumerable<Action<IDirectory>> GetFileSystemActionsForArgumentNu
1212
yield return ds => ds.Delete(null, true);
1313
yield return ds => ds.CreateDirectory(null);
1414
if (MockUnixSupport.IsWindowsPlatform())
15+
{
16+
#pragma warning disable CA1416
1517
yield return ds => ds.CreateDirectory(null, new DirectorySecurity());
18+
#pragma warning restore CA1416
19+
}
1620
yield return ds => ds.SetCreationTime(null, DateTime.Now);
1721
yield return ds => ds.SetCreationTimeUtc(null, DateTime.Now);
1822
yield return ds => ds.SetLastAccessTime(null, DateTime.Now);

tests/System.IO.Abstractions.TestingHelpers.Tests/MockDirectoryGetAccessControlTests.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
using NUnit.Framework;
2-
using System;
32
using System.Collections.Generic;
4-
using System.Linq;
5-
using System.Text;
63
using System.Security.AccessControl;
4+
using System.Runtime.Versioning;
75

86
namespace System.IO.Abstractions.TestingHelpers.Tests
97
{
108
using XFS = MockUnixSupport;
119
[TestFixture]
1210
[WindowsOnly(WindowsSpecifics.AccessControlLists)]
11+
[SupportedOSPlatform("windows")]
1312
public class MockDirectoryGetAccessControlTests
1413
{
1514
[TestCase(" ")]

tests/System.IO.Abstractions.TestingHelpers.Tests/MockDirectoryInfoAccessControlTests.cs

+2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
using NUnit.Framework;
22
using System.Collections.Generic;
3+
using System.Runtime.Versioning;
34
using System.Security.AccessControl;
45
using XFS = System.IO.Abstractions.TestingHelpers.MockUnixSupport;
56

67
namespace System.IO.Abstractions.TestingHelpers.Tests
78
{
89
[TestFixture]
910
[WindowsOnly(WindowsSpecifics.AccessControlLists)]
11+
[SupportedOSPlatform("windows")]
1012
public class MockDirectoryInfoAccessControlTests
1113
{
1214
[Test]

tests/System.IO.Abstractions.TestingHelpers.Tests/MockDirectorySetAccessControlTests.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
using NUnit.Framework;
2-
using System;
32
using System.Collections.Generic;
4-
using System.Linq;
5-
using System.Text;
63

74
namespace System.IO.Abstractions.TestingHelpers.Tests
85
{
6+
using System.Runtime.Versioning;
97
using Security.AccessControl;
108
using XFS = MockUnixSupport;
119

1210
[TestFixture]
11+
[SupportedOSPlatform("windows")]
1312
[WindowsOnly(WindowsSpecifics.AccessControlLists)]
1413
public class MockDirectorySetAccessControlTests
1514
{

tests/System.IO.Abstractions.TestingHelpers.Tests/MockFileGetAccessControlTests.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
using NUnit.Framework;
2-
using System;
32
using System.Collections.Generic;
4-
using System.Linq;
5-
using System.Text;
63
using System.Security.AccessControl;
4+
using System.Runtime.Versioning;
75

86
namespace System.IO.Abstractions.TestingHelpers.Tests
97
{
108
using XFS = MockUnixSupport;
119
[TestFixture]
1210
[WindowsOnly(WindowsSpecifics.AccessControlLists)]
11+
[SupportedOSPlatform("windows")]
1312
public class MockFileGetAccessControlTests
1413
{
1514
[TestCase(" ")]

tests/System.IO.Abstractions.TestingHelpers.Tests/MockFileInfoAccessControlTests.cs

+2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
using NUnit.Framework;
22
using System.Collections.Generic;
3+
using System.Runtime.Versioning;
34
using System.Security.AccessControl;
45
using XFS = System.IO.Abstractions.TestingHelpers.MockUnixSupport;
56

67
namespace System.IO.Abstractions.TestingHelpers.Tests
78
{
89
[TestFixture]
910
[WindowsOnly(WindowsSpecifics.AccessControlLists)]
11+
[SupportedOSPlatform("windows")]
1012
public class MockFileInfoAccessControlTests
1113
{
1214
[Test]

tests/System.IO.Abstractions.TestingHelpers.Tests/MockFileSetAccessControlTests.cs

+2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
using NUnit.Framework;
22
using System.Collections.Generic;
3+
using System.Runtime.Versioning;
34
using System.Security.AccessControl;
45
using XFS = System.IO.Abstractions.TestingHelpers.MockUnixSupport;
56

67
namespace System.IO.Abstractions.TestingHelpers.Tests
78
{
89
[TestFixture]
910
[WindowsOnly(WindowsSpecifics.AccessControlLists)]
11+
[SupportedOSPlatform("windows")]
1012
public class MockFileSetAccessControlTests
1113
{
1214
[TestCase(" ")]

tests/System.IO.Abstractions.TestingHelpers.Tests/MockFileSystemSerializationTests.cs

+3
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@ public void SerializationBytes()
2323
//Act
2424
var memoryStream = new MemoryStream();
2525
var serializer = new Runtime.Serialization.Formatters.Binary.BinaryFormatter();
26+
27+
#pragma warning disable SYSLIB0011
2628
serializer.Serialize(memoryStream, fileSystem);
2729
memoryStream.Flush();
2830
memoryStream.Position = 0;
2931
fileSystem = (MockFileSystem)serializer.Deserialize(memoryStream);
32+
#pragma warning restore SYSLIB0011
3033
memoryStream.Dispose();
3134

3235
// Assert

tests/System.IO.Abstractions.TestingHelpers.Tests/MockFileSystemTests.cs

+3
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,10 @@ public void MockFileSystem_ByDefault_IsSerializable()
131131
var memoryStream = new MemoryStream();
132132

133133
var serializer = new Runtime.Serialization.Formatters.Binary.BinaryFormatter();
134+
135+
#pragma warning disable SYSLIB0011
134136
serializer.Serialize(memoryStream, fileSystem);
137+
#pragma warning restore SYSLIB0011
135138

136139
Assert.That(memoryStream.Length > 0, "Length didn't increase after serialization task.");
137140
}

tests/System.IO.Abstractions.TestingHelpers.Tests/MockFileTests.cs

+5
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,10 @@ public void Serializable_works()
543543
//Act
544544
IFormatter formatter = new BinaryFormatter();
545545
Stream stream = new MemoryStream();
546+
547+
#pragma warning disable SYSLIB0011
546548
formatter.Serialize(stream, data);
549+
#pragma warning restore SYSLIB0011
547550

548551
//Assert
549552
Assert.Pass();
@@ -560,11 +563,13 @@ public void Serializable_can_deserialize()
560563

561564
IFormatter formatter = new BinaryFormatter();
562565
Stream stream = new MemoryStream();
566+
#pragma warning disable SYSLIB0011
563567
formatter.Serialize(stream, data);
564568

565569
stream.Seek(0, SeekOrigin.Begin);
566570

567571
MockFileData deserialized = (MockFileData)formatter.Deserialize(stream);
572+
#pragma warning restore SYSLIB0011
568573

569574
//Assert
570575
Assert.That(deserialized.TextContents, Is.EqualTo(textContentStr));

tests/System.IO.Abstractions.TestingHelpers.Tests/MockFileWriteAllTextTests.cs

+2
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,12 @@ public static IEnumerable<KeyValuePair<Encoding, byte[]>> GetEncodingsWithExpect
165165
101, 0, 0, 0, 33, 0, 0, 0, 32, 0, 0, 0, 68, 0, 0, 0, 122, 0,
166166
0, 0, 105, 0, 0, 0, 25, 1, 0, 0, 107, 0, 0, 0, 105, 0, 0, 0, 46, 0, 0, 0 } },
167167

168+
#pragma warning disable SYSLIB0001
168169
// UTF-7 does not need a BOM
169170
{ Encoding.UTF7, new byte [] {72, 101, 108, 108, 111, 32, 116,
170171
104, 101, 114, 101, 43, 65, 67, 69, 45, 32, 68, 122, 105,
171172
43, 65, 82, 107, 45, 107, 105, 46 } },
173+
#pragma warning restore SYSLIB0001
172174

173175
// The default encoding does not need a BOM
174176
{ utf8WithoutBom, new byte [] { 72, 101, 108, 108, 111, 32, 116,

0 commit comments

Comments
 (0)