Skip to content

Commit

Permalink
Keep Serialization attributes also on .NET8, but disable the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vbreuss committed Sep 11, 2023
1 parent 6c33e57 commit b662cc7
Show file tree
Hide file tree
Showing 40 changed files with 45 additions and 44 deletions.
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<DefineConstants Condition="'$(TargetFramework)' == 'net7.0' OR '$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net5.0'">$(DefineConstants);FEATURE_FILE_MOVE_WITH_OVERWRITE;FEATURE_SUPPORTED_OS_ATTRIBUTE;FEATURE_FILE_SYSTEM_WATCHER_FILTERS;FEATURE_ENDS_IN_DIRECTORY_SEPARATOR;FEATURE_PATH_JOIN_WITH_PARAMS;FEATURE_PATH_JOIN_WITH_FOUR_PATHS</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net7.0' OR '$(TargetFramework)' == 'net6.0'">$(DefineConstants);FEATURE_FILE_SYSTEM_INFO_LINK_TARGET;FEATURE_CREATE_SYMBOLIC_LINK;FEATURE_FILESTREAM_OPTIONS</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net7.0'">$(DefineConstants);FEATURE_PATH_EXISTS;FEATURE_FILE_SYSTEM_WATCHER_WAIT_WITH_TIMESPAN;FEATURE_FILE_ATTRIBUTES_VIA_HANDLE;FEATURE_CREATE_TEMP_SUBDIRECTORY;FEATURE_READ_LINES_ASYNC;FEATURE_UNIX_FILE_MODE</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_SERIALIZABLE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.6.133">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace System.IO.Abstractions.TestingHelpers


/// <inheritdoc />
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class MockDirectory : DirectoryBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
namespace System.IO.Abstractions.TestingHelpers
{
/// <inheritdoc />
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class MockDirectoryData : MockFileData
{
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[NonSerialized]
#endif
private DirectorySecurity accessControl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace System.IO.Abstractions.TestingHelpers
using XFS = MockUnixSupport;

/// <inheritdoc />
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class MockDirectoryInfo : DirectoryInfoBase, IFileSystemAclSupport
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace System.IO.Abstractions.TestingHelpers
{
/// <inheritdoc />
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class MockDirectoryInfoFactory : IDirectoryInfoFactory
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace System.IO.Abstractions.TestingHelpers
{
/// <inheritdoc />
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class MockDriveInfo : DriveInfoBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace System.IO.Abstractions.TestingHelpers
{
/// <inheritdoc />
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class MockDriveInfoFactory : IDriveInfoFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace System.IO.Abstractions.TestingHelpers
using XFS = MockUnixSupport;

/// <inheritdoc />
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public partial class MockFile : FileBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace System.IO.Abstractions.TestingHelpers
/// <summary>
/// The class represents the associated data of a file.
/// </summary>
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class MockFileData
Expand Down Expand Up @@ -38,7 +38,7 @@ public class MockFileData
/// <summary>
/// The access control of the <see cref="MockFileData"/>.
/// </summary>
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[NonSerialized]
#endif
private FileSecurity accessControl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace System.IO.Abstractions.TestingHelpers
{
/// <inheritdoc />
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class MockFileInfo : FileInfoBase, IFileSystemAclSupport
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace System.IO.Abstractions.TestingHelpers
{
/// <inheritdoc />
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class MockFileInfoFactory : IFileInfoFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace System.IO.Abstractions.TestingHelpers
{
/// <inheritdoc />
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class MockFileStream : FileSystemStream, IFileSystemAclSupport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace System.IO.Abstractions.TestingHelpers
{
/// <inheritdoc />
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class MockFileStreamFactory : IFileStreamFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace System.IO.Abstractions.TestingHelpers
using XFS = MockUnixSupport;

/// <inheritdoc />
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class MockFileSystem : FileSystemBase, IMockFileDataAccessor
Expand All @@ -18,7 +18,7 @@ public class MockFileSystem : FileSystemBase, IMockFileDataAccessor

private readonly IDictionary<string, FileSystemEntry> files;
private readonly PathVerifier pathVerifier;
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[NonSerialized]
#endif
private Func<DateTime> dateTimeProvider = defaultDateTimeProvider;
Expand Down Expand Up @@ -520,7 +520,7 @@ private bool FileIsReadOnly(string path)
return (GetFile(path).Attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly;
}

#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
private class FileSystemEntry
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace System.IO.Abstractions.TestingHelpers
{
/// <inheritdoc />
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class MockFileSystemWatcherFactory : IFileSystemWatcherFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace System.IO.Abstractions.TestingHelpers
/// <summary>
/// PathWrapper calls direct to Path but all this does is string manipulation so we can inherit directly from PathWrapper as no IO is done
/// </summary>
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class MockPath : PathWrapper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace System.IO.Abstractions.TestingHelpers
/// <summary>
/// Provides helper methods for verifying paths.
/// </summary>
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class PathVerifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// <summary>
/// Provides operations against path strings dependeing on the case-senstivity of the runtime platform.
/// </summary>
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class StringOperations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace System.IO.Abstractions
{
/// <inheritdoc cref="Directory"/>
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public abstract class DirectoryBase : IDirectory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace System.IO.Abstractions
{
/// <inheritdoc cref="IDirectoryInfo"/>
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public abstract class DirectoryInfoBase : FileSystemInfoBase, IDirectoryInfo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace System.IO.Abstractions
{
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
internal class DirectoryInfoFactory : IDirectoryInfoFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace System.IO.Abstractions
{
/// <inheritdoc />
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class DirectoryInfoWrapper : DirectoryInfoBase, IFileSystemAclSupport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace System.IO.Abstractions
{
/// <inheritdoc />
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class DirectoryWrapper : DirectoryBase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace System.IO.Abstractions
{
/// <inheritdoc />
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public abstract class DriveInfoBase : IDriveInfo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace System.IO.Abstractions
{
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
internal class DriveInfoFactory : IDriveInfoFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace System.IO.Abstractions
/// <summary>
/// The wrapper for a <see cref="DriveInfo"/>.
/// </summary>
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class DriveInfoWrapper : DriveInfoBase
Expand Down
2 changes: 1 addition & 1 deletion src/TestableIO.System.IO.Abstractions.Wrappers/FileBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace System.IO.Abstractions
{
/// <inheritdoc cref="File"/>
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public abstract partial class FileBase : IFile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace System.IO.Abstractions
{
/// <inheritdoc cref="FileInfo"/>
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public abstract class FileInfoBase : FileSystemInfoBase, IFileInfo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace System.IO.Abstractions
{
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
internal class FileInfoFactory : IFileInfoFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace System.IO.Abstractions
{
/// <inheritdoc />
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class FileInfoWrapper : FileInfoBase, IFileSystemAclSupport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace System.IO.Abstractions
{
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
internal sealed class FileStreamFactory : IFileStreamFactory
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace System.IO.Abstractions
{
/// <inheritdoc />
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class FileSystem : FileSystemBase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace System.IO.Abstractions
{
/// <inheritdoc />
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public abstract class FileSystemBase : IFileSystem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace System.IO.Abstractions
{
/// <inheritdoc cref="FileSystemInfo"/>
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public abstract class FileSystemInfoBase : IFileSystemInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace System.IO.Abstractions
{
/// <inheritdoc cref="FileSystemWatcher"/>
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public abstract class FileSystemWatcherBase : IFileSystemWatcher
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace System.IO.Abstractions
{
/// <inheritdoc />
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class FileSystemWatcherFactory : IFileSystemWatcherFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
namespace System.IO.Abstractions
{
/// <inheritdoc />
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class FileSystemWatcherWrapper : FileSystemWatcherBase
{
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[NonSerialized]
#endif
private readonly FileSystemWatcher watcher;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace System.IO.Abstractions
{
/// <inheritdoc />
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public partial class FileWrapper : FileBase
Expand Down
2 changes: 1 addition & 1 deletion src/TestableIO.System.IO.Abstractions.Wrappers/PathBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace System.IO.Abstractions
{
/// <inheritdoc cref="Path"/>
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public abstract class PathBase : IPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace System.IO.Abstractions
{
/// <inheritdoc />
#if !NET8_0_OR_GREATER
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class PathWrapper : PathBase
Expand Down

0 comments on commit b662cc7

Please sign in to comment.