diff --git a/src/libraries/Common/src/Interop/Windows/NtDll/Interop.NtQueryInformationFile.cs b/src/libraries/Common/src/Interop/Windows/NtDll/Interop.NtQueryInformationFile.cs index a9c79cd1d6869..644315f2bc2cc 100644 --- a/src/libraries/Common/src/Interop/Windows/NtDll/Interop.NtQueryInformationFile.cs +++ b/src/libraries/Common/src/Interop/Windows/NtDll/Interop.NtQueryInformationFile.cs @@ -17,13 +17,6 @@ internal static extern unsafe int NtQueryInformationFile( uint Length, uint FileInformationClass); - [StructLayout(LayoutKind.Sequential)] - internal struct IO_STATUS_BLOCK - { - private uint Status; - private IntPtr Information; - } - internal const uint FileModeInformation = 16; internal const int STATUS_INVALID_HANDLE = unchecked((int)0xC0000008); diff --git a/src/libraries/Microsoft.IO.Redist/src/Microsoft.IO.Redist.csproj b/src/libraries/Microsoft.IO.Redist/src/Microsoft.IO.Redist.csproj index 94b9552748a98..db9472c1432f3 100644 --- a/src/libraries/Microsoft.IO.Redist/src/Microsoft.IO.Redist.csproj +++ b/src/libraries/Microsoft.IO.Redist/src/Microsoft.IO.Redist.csproj @@ -8,53 +8,51 @@ true - - - - - - - - - - - - - - - - - - - - - - - - @@ -195,6 +193,7 @@ + diff --git a/src/libraries/Microsoft.IO.Redist/src/Microsoft/IO/ThrowHelper.cs b/src/libraries/Microsoft.IO.Redist/src/Microsoft/IO/ThrowHelper.cs new file mode 100644 index 0000000000000..31e3766c51494 --- /dev/null +++ b/src/libraries/Microsoft.IO.Redist/src/Microsoft/IO/ThrowHelper.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.IO; + +namespace Microsoft.IO +{ + internal static class ThrowHelper + { + internal static void ThrowEndOfFileException() + { + throw new EndOfStreamException(SR.IO_EOF_ReadBeyondEOF); + } + } +} diff --git a/src/libraries/Microsoft.VisualBasic.Core/ref/Microsoft.VisualBasic.Core.csproj b/src/libraries/Microsoft.VisualBasic.Core/ref/Microsoft.VisualBasic.Core.csproj index 177effc558f4f..7eba5c85af492 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/ref/Microsoft.VisualBasic.Core.csproj +++ b/src/libraries/Microsoft.VisualBasic.Core/ref/Microsoft.VisualBasic.Core.csproj @@ -8,7 +8,6 @@ - diff --git a/src/libraries/System.Collections/src/System.Collections.csproj b/src/libraries/System.Collections/src/System.Collections.csproj index 3011056121696..28dd9816dc245 100644 --- a/src/libraries/System.Collections/src/System.Collections.csproj +++ b/src/libraries/System.Collections/src/System.Collections.csproj @@ -15,8 +15,6 @@ - - diff --git a/src/libraries/System.IO.FileSystem.DriveInfo/ref/System.IO.FileSystem.DriveInfo.csproj b/src/libraries/System.IO.FileSystem.DriveInfo/ref/System.IO.FileSystem.DriveInfo.csproj index 98edb3fa14a57..9f6b2e37bcd69 100644 --- a/src/libraries/System.IO.FileSystem.DriveInfo/ref/System.IO.FileSystem.DriveInfo.csproj +++ b/src/libraries/System.IO.FileSystem.DriveInfo/ref/System.IO.FileSystem.DriveInfo.csproj @@ -8,7 +8,5 @@ - - diff --git a/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj b/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj index 8cef1c564b1ce..e0f8628d0b0b1 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj +++ b/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj @@ -77,8 +77,8 @@ - + ))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.IO.Enumeration.FileSystemEnumerator<>))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.IO.Enumeration.FileSystemName))] + diff --git a/src/libraries/System.IO.FileSystem/ref/System.IO.FileSystem.cs b/src/libraries/System.IO.FileSystem/ref/System.IO.FileSystem.cs deleted file mode 100644 index 08121dc0b5b25..0000000000000 --- a/src/libraries/System.IO.FileSystem/ref/System.IO.FileSystem.cs +++ /dev/null @@ -1,302 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// ------------------------------------------------------------------------------ -// Changes to this file must follow the https://aka.ms/api-review process. -// ------------------------------------------------------------------------------ - -namespace System.IO -{ - public static partial class Directory - { - public static System.IO.DirectoryInfo CreateDirectory(string path) { throw null; } - public static void Delete(string path) { } - public static void Delete(string path, bool recursive) { } - public static System.Collections.Generic.IEnumerable EnumerateDirectories(string path) { throw null; } - public static System.Collections.Generic.IEnumerable EnumerateDirectories(string path, string searchPattern) { throw null; } - public static System.Collections.Generic.IEnumerable EnumerateDirectories(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } - public static System.Collections.Generic.IEnumerable EnumerateDirectories(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; } - public static System.Collections.Generic.IEnumerable EnumerateFiles(string path) { throw null; } - public static System.Collections.Generic.IEnumerable EnumerateFiles(string path, string searchPattern) { throw null; } - public static System.Collections.Generic.IEnumerable EnumerateFiles(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } - public static System.Collections.Generic.IEnumerable EnumerateFiles(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; } - public static System.Collections.Generic.IEnumerable EnumerateFileSystemEntries(string path) { throw null; } - public static System.Collections.Generic.IEnumerable EnumerateFileSystemEntries(string path, string searchPattern) { throw null; } - public static System.Collections.Generic.IEnumerable EnumerateFileSystemEntries(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } - public static System.Collections.Generic.IEnumerable EnumerateFileSystemEntries(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; } - public static bool Exists([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? path) { throw null; } - public static System.DateTime GetCreationTime(string path) { throw null; } - public static System.DateTime GetCreationTimeUtc(string path) { throw null; } - public static string GetCurrentDirectory() { throw null; } - public static string[] GetDirectories(string path) { throw null; } - public static string[] GetDirectories(string path, string searchPattern) { throw null; } - public static string[] GetDirectories(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } - public static string[] GetDirectories(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; } - public static string GetDirectoryRoot(string path) { throw null; } - public static string[] GetFiles(string path) { throw null; } - public static string[] GetFiles(string path, string searchPattern) { throw null; } - public static string[] GetFiles(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } - public static string[] GetFiles(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; } - public static string[] GetFileSystemEntries(string path) { throw null; } - public static string[] GetFileSystemEntries(string path, string searchPattern) { throw null; } - public static string[] GetFileSystemEntries(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } - public static string[] GetFileSystemEntries(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; } - public static System.DateTime GetLastAccessTime(string path) { throw null; } - public static System.DateTime GetLastAccessTimeUtc(string path) { throw null; } - public static System.DateTime GetLastWriteTime(string path) { throw null; } - public static System.DateTime GetLastWriteTimeUtc(string path) { throw null; } - public static string[] GetLogicalDrives() { throw null; } - public static System.IO.DirectoryInfo? GetParent(string path) { throw null; } - public static void Move(string sourceDirName, string destDirName) { } - public static void SetCreationTime(string path, System.DateTime creationTime) { } - public static void SetCreationTimeUtc(string path, System.DateTime creationTimeUtc) { } - public static void SetCurrentDirectory(string path) { } - public static void SetLastAccessTime(string path, System.DateTime lastAccessTime) { } - public static void SetLastAccessTimeUtc(string path, System.DateTime lastAccessTimeUtc) { } - public static void SetLastWriteTime(string path, System.DateTime lastWriteTime) { } - public static void SetLastWriteTimeUtc(string path, System.DateTime lastWriteTimeUtc) { } - } - public sealed partial class DirectoryInfo : System.IO.FileSystemInfo - { - public DirectoryInfo(string path) { } - public override bool Exists { get { throw null; } } - public override string Name { get { throw null; } } - public System.IO.DirectoryInfo? Parent { get { throw null; } } - public System.IO.DirectoryInfo Root { get { throw null; } } - public void Create() { } - public System.IO.DirectoryInfo CreateSubdirectory(string path) { throw null; } - public override void Delete() { } - public void Delete(bool recursive) { } - public System.Collections.Generic.IEnumerable EnumerateDirectories() { throw null; } - public System.Collections.Generic.IEnumerable EnumerateDirectories(string searchPattern) { throw null; } - public System.Collections.Generic.IEnumerable EnumerateDirectories(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } - public System.Collections.Generic.IEnumerable EnumerateDirectories(string searchPattern, System.IO.SearchOption searchOption) { throw null; } - public System.Collections.Generic.IEnumerable EnumerateFiles() { throw null; } - public System.Collections.Generic.IEnumerable EnumerateFiles(string searchPattern) { throw null; } - public System.Collections.Generic.IEnumerable EnumerateFiles(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } - public System.Collections.Generic.IEnumerable EnumerateFiles(string searchPattern, System.IO.SearchOption searchOption) { throw null; } - public System.Collections.Generic.IEnumerable EnumerateFileSystemInfos() { throw null; } - public System.Collections.Generic.IEnumerable EnumerateFileSystemInfos(string searchPattern) { throw null; } - public System.Collections.Generic.IEnumerable EnumerateFileSystemInfos(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } - public System.Collections.Generic.IEnumerable EnumerateFileSystemInfos(string searchPattern, System.IO.SearchOption searchOption) { throw null; } - public System.IO.DirectoryInfo[] GetDirectories() { throw null; } - public System.IO.DirectoryInfo[] GetDirectories(string searchPattern) { throw null; } - public System.IO.DirectoryInfo[] GetDirectories(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } - public System.IO.DirectoryInfo[] GetDirectories(string searchPattern, System.IO.SearchOption searchOption) { throw null; } - public System.IO.FileInfo[] GetFiles() { throw null; } - public System.IO.FileInfo[] GetFiles(string searchPattern) { throw null; } - public System.IO.FileInfo[] GetFiles(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } - public System.IO.FileInfo[] GetFiles(string searchPattern, System.IO.SearchOption searchOption) { throw null; } - public System.IO.FileSystemInfo[] GetFileSystemInfos() { throw null; } - public System.IO.FileSystemInfo[] GetFileSystemInfos(string searchPattern) { throw null; } - public System.IO.FileSystemInfo[] GetFileSystemInfos(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } - public System.IO.FileSystemInfo[] GetFileSystemInfos(string searchPattern, System.IO.SearchOption searchOption) { throw null; } - public void MoveTo(string destDirName) { } - public override string ToString() { throw null; } - } - public partial class EnumerationOptions - { - public EnumerationOptions() { } - public System.IO.FileAttributes AttributesToSkip { get { throw null; } set { } } - public int BufferSize { get { throw null; } set { } } - public bool IgnoreInaccessible { get { throw null; } set { } } - public System.IO.MatchCasing MatchCasing { get { throw null; } set { } } - public System.IO.MatchType MatchType { get { throw null; } set { } } - public int MaxRecursionDepth { get { throw null; } set { } } - public bool RecurseSubdirectories { get { throw null; } set { } } - public bool ReturnSpecialDirectories { get { throw null; } set { } } - } - public static partial class File - { - public static void AppendAllLines(string path, System.Collections.Generic.IEnumerable contents) { } - public static void AppendAllLines(string path, System.Collections.Generic.IEnumerable contents, System.Text.Encoding encoding) { } - public static System.Threading.Tasks.Task AppendAllLinesAsync(string path, System.Collections.Generic.IEnumerable contents, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task AppendAllLinesAsync(string path, System.Collections.Generic.IEnumerable contents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static void AppendAllText(string path, string? contents) { } - public static void AppendAllText(string path, string? contents, System.Text.Encoding encoding) { } - public static System.Threading.Tasks.Task AppendAllTextAsync(string path, string? contents, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task AppendAllTextAsync(string path, string? contents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.IO.StreamWriter AppendText(string path) { throw null; } - public static void Copy(string sourceFileName, string destFileName) { } - public static void Copy(string sourceFileName, string destFileName, bool overwrite) { } - public static System.IO.FileStream Create(string path) { throw null; } - public static System.IO.FileStream Create(string path, int bufferSize) { throw null; } - public static System.IO.FileStream Create(string path, int bufferSize, System.IO.FileOptions options) { throw null; } - public static System.IO.StreamWriter CreateText(string path) { throw null; } - [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] - public static void Decrypt(string path) { } - public static void Delete(string path) { } - [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] - public static void Encrypt(string path) { } - public static bool Exists([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? path) { throw null; } - public static System.IO.FileAttributes GetAttributes(string path) { throw null; } - public static System.DateTime GetCreationTime(string path) { throw null; } - public static System.DateTime GetCreationTimeUtc(string path) { throw null; } - public static System.DateTime GetLastAccessTime(string path) { throw null; } - public static System.DateTime GetLastAccessTimeUtc(string path) { throw null; } - public static System.DateTime GetLastWriteTime(string path) { throw null; } - public static System.DateTime GetLastWriteTimeUtc(string path) { throw null; } - public static void Move(string sourceFileName, string destFileName) { } - public static void Move(string sourceFileName, string destFileName, bool overwrite) { } - public static System.IO.FileStream Open(string path, System.IO.FileMode mode) { throw null; } - public static System.IO.FileStream Open(string path, System.IO.FileMode mode, System.IO.FileAccess access) { throw null; } - public static System.IO.FileStream Open(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) { throw null; } - public static System.IO.FileStream OpenRead(string path) { throw null; } - public static System.IO.StreamReader OpenText(string path) { throw null; } - public static System.IO.FileStream OpenWrite(string path) { throw null; } - public static byte[] ReadAllBytes(string path) { throw null; } - public static System.Threading.Tasks.Task ReadAllBytesAsync(string path, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static string[] ReadAllLines(string path) { throw null; } - public static string[] ReadAllLines(string path, System.Text.Encoding encoding) { throw null; } - public static System.Threading.Tasks.Task ReadAllLinesAsync(string path, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task ReadAllLinesAsync(string path, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static string ReadAllText(string path) { throw null; } - public static string ReadAllText(string path, System.Text.Encoding encoding) { throw null; } - public static System.Threading.Tasks.Task ReadAllTextAsync(string path, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task ReadAllTextAsync(string path, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Collections.Generic.IEnumerable ReadLines(string path) { throw null; } - public static System.Collections.Generic.IEnumerable ReadLines(string path, System.Text.Encoding encoding) { throw null; } - public static void Replace(string sourceFileName, string destinationFileName, string? destinationBackupFileName) { } - public static void Replace(string sourceFileName, string destinationFileName, string? destinationBackupFileName, bool ignoreMetadataErrors) { } - public static void SetAttributes(string path, System.IO.FileAttributes fileAttributes) { } - public static void SetCreationTime(string path, System.DateTime creationTime) { } - public static void SetCreationTimeUtc(string path, System.DateTime creationTimeUtc) { } - public static void SetLastAccessTime(string path, System.DateTime lastAccessTime) { } - public static void SetLastAccessTimeUtc(string path, System.DateTime lastAccessTimeUtc) { } - public static void SetLastWriteTime(string path, System.DateTime lastWriteTime) { } - public static void SetLastWriteTimeUtc(string path, System.DateTime lastWriteTimeUtc) { } - public static void WriteAllBytes(string path, byte[] bytes) { } - public static System.Threading.Tasks.Task WriteAllBytesAsync(string path, byte[] bytes, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static void WriteAllLines(string path, System.Collections.Generic.IEnumerable contents) { } - public static void WriteAllLines(string path, System.Collections.Generic.IEnumerable contents, System.Text.Encoding encoding) { } - public static void WriteAllLines(string path, string[] contents) { } - public static void WriteAllLines(string path, string[] contents, System.Text.Encoding encoding) { } - public static System.Threading.Tasks.Task WriteAllLinesAsync(string path, System.Collections.Generic.IEnumerable contents, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task WriteAllLinesAsync(string path, System.Collections.Generic.IEnumerable contents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static void WriteAllText(string path, string? contents) { } - public static void WriteAllText(string path, string? contents, System.Text.Encoding encoding) { } - public static System.Threading.Tasks.Task WriteAllTextAsync(string path, string? contents, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task WriteAllTextAsync(string path, string? contents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } - public sealed partial class FileInfo : System.IO.FileSystemInfo - { - public FileInfo(string fileName) { } - public System.IO.DirectoryInfo? Directory { get { throw null; } } - public string? DirectoryName { get { throw null; } } - public override bool Exists { get { throw null; } } - public bool IsReadOnly { get { throw null; } set { } } - public long Length { get { throw null; } } - public override string Name { get { throw null; } } - public System.IO.StreamWriter AppendText() { throw null; } - public System.IO.FileInfo CopyTo(string destFileName) { throw null; } - public System.IO.FileInfo CopyTo(string destFileName, bool overwrite) { throw null; } - public System.IO.FileStream Create() { throw null; } - public System.IO.StreamWriter CreateText() { throw null; } - [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] - public void Decrypt() { } - public override void Delete() { } - [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] - public void Encrypt() { } - public void MoveTo(string destFileName) { } - public void MoveTo(string destFileName, bool overwrite) { } - public System.IO.FileStream Open(System.IO.FileMode mode) { throw null; } - public System.IO.FileStream Open(System.IO.FileMode mode, System.IO.FileAccess access) { throw null; } - public System.IO.FileStream Open(System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) { throw null; } - public System.IO.FileStream OpenRead() { throw null; } - public System.IO.StreamReader OpenText() { throw null; } - public System.IO.FileStream OpenWrite() { throw null; } - public System.IO.FileInfo Replace(string destinationFileName, string? destinationBackupFileName) { throw null; } - public System.IO.FileInfo Replace(string destinationFileName, string? destinationBackupFileName, bool ignoreMetadataErrors) { throw null; } - public override string ToString() { throw null; } - } - public abstract partial class FileSystemInfo : System.MarshalByRefObject, System.Runtime.Serialization.ISerializable - { - protected string FullPath; - protected string OriginalPath; - protected FileSystemInfo() { } - protected FileSystemInfo(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } - public System.IO.FileAttributes Attributes { get { throw null; } set { } } - public System.DateTime CreationTime { get { throw null; } set { } } - public System.DateTime CreationTimeUtc { get { throw null; } set { } } - public abstract bool Exists { get; } - public string Extension { get { throw null; } } - public virtual string FullName { get { throw null; } } - public System.DateTime LastAccessTime { get { throw null; } set { } } - public System.DateTime LastAccessTimeUtc { get { throw null; } set { } } - public System.DateTime LastWriteTime { get { throw null; } set { } } - public System.DateTime LastWriteTimeUtc { get { throw null; } set { } } - public abstract string Name { get; } - public abstract void Delete(); - public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } - public void Refresh() { } - public override string ToString() { throw null; } - } - public enum MatchCasing - { - PlatformDefault = 0, - CaseSensitive = 1, - CaseInsensitive = 2, - } - public enum MatchType - { - Simple = 0, - Win32 = 1, - } - public enum SearchOption - { - TopDirectoryOnly = 0, - AllDirectories = 1, - } -} -namespace System.IO.Enumeration -{ - public ref partial struct FileSystemEntry - { - private object _dummy; - private int _dummyPrimitive; - public System.IO.FileAttributes Attributes { get { throw null; } } - public System.DateTimeOffset CreationTimeUtc { get { throw null; } } - public readonly System.ReadOnlySpan Directory { get { throw null; } } - public System.ReadOnlySpan FileName { get { throw null; } } - public bool IsDirectory { get { throw null; } } - public bool IsHidden { get { throw null; } } - public System.DateTimeOffset LastAccessTimeUtc { get { throw null; } } - public System.DateTimeOffset LastWriteTimeUtc { get { throw null; } } - public long Length { get { throw null; } } - public readonly System.ReadOnlySpan OriginalRootDirectory { get { throw null; } } - public readonly System.ReadOnlySpan RootDirectory { get { throw null; } } - public System.IO.FileSystemInfo ToFileSystemInfo() { throw null; } - public string ToFullPath() { throw null; } - public string ToSpecifiedFullPath() { throw null; } - } - public partial class FileSystemEnumerable : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable - { - public FileSystemEnumerable(string directory, System.IO.Enumeration.FileSystemEnumerable.FindTransform transform, System.IO.EnumerationOptions? options = null) { } - public System.IO.Enumeration.FileSystemEnumerable.FindPredicate? ShouldIncludePredicate { get { throw null; } set { } } - public System.IO.Enumeration.FileSystemEnumerable.FindPredicate? ShouldRecursePredicate { get { throw null; } set { } } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public delegate bool FindPredicate(ref System.IO.Enumeration.FileSystemEntry entry); - public delegate TResult FindTransform(ref System.IO.Enumeration.FileSystemEntry entry); - } - public abstract partial class FileSystemEnumerator : System.Runtime.ConstrainedExecution.CriticalFinalizerObject, System.Collections.Generic.IEnumerator, System.Collections.IEnumerator, System.IDisposable - { - public FileSystemEnumerator(string directory, System.IO.EnumerationOptions? options = null) { } - public TResult Current { get { throw null; } } - object? System.Collections.IEnumerator.Current { get { throw null; } } - protected virtual bool ContinueOnError(int error) { throw null; } - public void Dispose() { } - protected virtual void Dispose(bool disposing) { } - public bool MoveNext() { throw null; } - protected virtual void OnDirectoryFinished(System.ReadOnlySpan directory) { } - public void Reset() { } - protected virtual bool ShouldIncludeEntry(ref System.IO.Enumeration.FileSystemEntry entry) { throw null; } - protected virtual bool ShouldRecurseIntoEntry(ref System.IO.Enumeration.FileSystemEntry entry) { throw null; } - protected abstract TResult TransformEntry(ref System.IO.Enumeration.FileSystemEntry entry); - } - public static partial class FileSystemName - { - public static bool MatchesSimpleExpression(System.ReadOnlySpan expression, System.ReadOnlySpan name, bool ignoreCase = true) { throw null; } - public static bool MatchesWin32Expression(System.ReadOnlySpan expression, System.ReadOnlySpan name, bool ignoreCase = true) { throw null; } - public static string TranslateWin32Expression(string? expression) { throw null; } - } -} diff --git a/src/libraries/System.IO.FileSystem/ref/System.IO.FileSystem.csproj b/src/libraries/System.IO.FileSystem/ref/System.IO.FileSystem.csproj index 22f81d654a4b2..cff7c81e031bd 100644 --- a/src/libraries/System.IO.FileSystem/ref/System.IO.FileSystem.csproj +++ b/src/libraries/System.IO.FileSystem/ref/System.IO.FileSystem.csproj @@ -4,7 +4,6 @@ enable - diff --git a/src/libraries/System.IO.FileSystem/src/Resources/Strings.resx b/src/libraries/System.IO.FileSystem/src/Resources/Strings.resx deleted file mode 100644 index 683090b0becc9..0000000000000 --- a/src/libraries/System.IO.FileSystem/src/Resources/Strings.resx +++ /dev/null @@ -1,284 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - The target file '{0}' is a directory, not a file. - - - Handle does not support asynchronous operations. The parameters to the FileStream constructor may need to be changed to indicate that the handle was opened synchronously (that is, it was not opened for overlapped I/O). - - - Handle does not support synchronous operations. The parameters to the FileStream constructor may need to be changed to indicate that the handle was opened asynchronously (that is, it was opened explicitly for overlapped I/O). - - - Invalid File or Directory attributes value. - - - Invalid handle. - - - Drive name must be a root directory (i.e. 'C:\') or a drive letter ('C'). - - - Second path fragment must not be a drive or UNC name. - - - Path must not be a drive. - - - Buffer cannot be null. - - - File name cannot be null. - - - Path cannot be null. - - - Enum value was out of legal range. - - - Specified file length was too large for the file system. - - - Non-negative number required. - - - Positive number required. - - - Empty file name is not legal. - - - Empty path name is not legal. - - - The stream's length cannot be changed. - - - Append access can be requested only in write-only mode. - - - Combining FileMode: {0} with FileAccess: {1} is invalid. - - - Illegal characters in path '{0}'. - - - Invalid seek origin. - - - The directory specified, '{0}', is not a subdirectory of '{1}'. - - - Path cannot be the empty string or all whitespace. - - - Cannot create '{0}' because a file or directory with the same name already exists. - - - BindHandle for ThreadPool failed on this handle. - - - The specified directory '{0}' cannot be created. - - - Unable to read beyond the end of the stream. - - - The file '{0}' already exists. - - - Unable to find the specified file. - - - Could not find file '{0}'. - - - The OS handle's position is not what FileStream expected. Do not use a handle simultaneously in one FileStream and in Win32 code or another FileStream. This may cause data loss. - - - The file is too long. This operation is currently limited to supporting files less than 2 gigabytes in size. - - - IO operation will not work. Most likely the file will become too long or the handle was not opened to support synchronous IO operations. - - - Could not find a part of the path. - - - Could not find a part of the path '{0}'. - - - The specified file name or path is too long, or a component of the specified path is too long. - - - Unable seek backward to overwrite data that previously existed in a file opened in Append mode. - - - Unable to truncate data that previously existed in a file opened in Append mode. - - - The process cannot access the file '{0}' because it is being used by another process. - - - The process cannot access the file because it is being used by another process. - - - Source and destination path must be different. - - - Source and destination path must have identical roots. Move will not work across volumes. - - - Synchronous operations should not be performed on the UI thread. Consider wrapping this method in Task.Run. - - - [Unknown] - - - Probable I/O race condition detected while copying memory. The I/O package is not thread safe by default. In multithreaded applications, a stream must be accessed in a thread-safe way, such as a thread-safe wrapper returned by TextReader's or TextWriter's Synchronized methods. This also applies to classes like StreamWriter and StreamReader. - - - Stream does not support reading. - - - Stream does not support seeking. - - - Stream does not support writing. - - - Cannot access a closed file. - - - Access to the path is denied. - - - Access to the path '{0}' is denied. - - - Cannot access a closed stream. - - - File encryption is not supported on this platform. - - - The path '{0}' is too long, or a component of the specified path is too long. - - diff --git a/src/libraries/System.IO.FileSystem/src/System.IO.FileSystem.csproj b/src/libraries/System.IO.FileSystem/src/System.IO.FileSystem.csproj index 0938c53364227..91447b65b71e6 100644 --- a/src/libraries/System.IO.FileSystem/src/System.IO.FileSystem.csproj +++ b/src/libraries/System.IO.FileSystem/src/System.IO.FileSystem.csproj @@ -1,238 +1,15 @@  - true true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser + $(NetCoreAppCurrent) enable - - $(DefineConstants);TARGET_BROWSER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/Error.cs b/src/libraries/System.IO.FileSystem/src/System/IO/Error.cs deleted file mode 100644 index 3abceef40c5c4..0000000000000 --- a/src/libraries/System.IO.FileSystem/src/System/IO/Error.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace System.IO -{ - /// - /// Provides centralized methods for creating exceptions for System.IO.FileSystem. - /// - internal static class Error - { - internal static Exception GetEndOfFile() - { - return new EndOfStreamException(SR.IO_EOF_ReadBeyondEOF); - } - } -} diff --git a/src/libraries/System.IO.IsolatedStorage/ref/System.IO.IsolatedStorage.csproj b/src/libraries/System.IO.IsolatedStorage/ref/System.IO.IsolatedStorage.csproj index ab19b0d2d547c..39903d836f807 100644 --- a/src/libraries/System.IO.IsolatedStorage/ref/System.IO.IsolatedStorage.csproj +++ b/src/libraries/System.IO.IsolatedStorage/ref/System.IO.IsolatedStorage.csproj @@ -7,8 +7,6 @@ - - diff --git a/src/libraries/System.IO.MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.csproj b/src/libraries/System.IO.MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.csproj index e29e8df293791..328e5db6032a5 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.csproj +++ b/src/libraries/System.IO.MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.csproj @@ -7,8 +7,6 @@ - - diff --git a/src/libraries/System.Private.CoreLib/src/Internal/IO/File.Unix.cs b/src/libraries/System.Private.CoreLib/src/Internal/IO/File.Unix.cs deleted file mode 100644 index 8cf6606246e4c..0000000000000 --- a/src/libraries/System.Private.CoreLib/src/Internal/IO/File.Unix.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace Internal.IO -{ - internal static partial class File - { - internal static bool InternalExists(string fullPath) - { - Interop.Sys.FileStatus fileinfo; - - // First use stat, as we want to follow symlinks. If that fails, it could be because the symlink - // is broken, we don't have permissions, etc., in which case fall back to using LStat to evaluate - // based on the symlink itself. - if (Interop.Sys.Stat(fullPath, out fileinfo) < 0 && - Interop.Sys.LStat(fullPath, out fileinfo) < 0) - { - return false; - } - - return ((fileinfo.Mode & Interop.Sys.FileTypes.S_IFMT) != Interop.Sys.FileTypes.S_IFDIR); - } - } -} diff --git a/src/libraries/System.Private.CoreLib/src/Internal/IO/File.Windows.cs b/src/libraries/System.Private.CoreLib/src/Internal/IO/File.Windows.cs deleted file mode 100644 index 354384be17ec0..0000000000000 --- a/src/libraries/System.Private.CoreLib/src/Internal/IO/File.Windows.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using Microsoft.Win32.SafeHandles; -using System.IO; -using System.Runtime.InteropServices; - -namespace Internal.IO -{ - internal static partial class File - { - internal static bool InternalExists(string fullPath) - { - Interop.Kernel32.WIN32_FILE_ATTRIBUTE_DATA data = default; - int errorCode = FillAttributeInfo(fullPath, ref data, returnErrorOnNotFound: true); - - return (errorCode == 0) && (data.dwFileAttributes != -1) - && ((data.dwFileAttributes & Interop.Kernel32.FileAttributes.FILE_ATTRIBUTE_DIRECTORY) == 0); - } - - /// - /// Returns 0 on success, otherwise a Win32 error code. Note that - /// classes should use -1 as the uninitialized state for dataInitialized. - /// - internal static int FillAttributeInfo(string path, ref Interop.Kernel32.WIN32_FILE_ATTRIBUTE_DATA data, bool returnErrorOnNotFound) - { - int errorCode = Interop.Errors.ERROR_SUCCESS; - - using (DisableMediaInsertionPrompt.Create()) - { - if (!Interop.Kernel32.GetFileAttributesEx(path, Interop.Kernel32.GET_FILEEX_INFO_LEVELS.GetFileExInfoStandard, ref data)) - { - errorCode = Marshal.GetLastPInvokeError(); - if (errorCode == Interop.Errors.ERROR_ACCESS_DENIED) - { - // Files that are marked for deletion will not let you GetFileAttributes, - // ERROR_ACCESS_DENIED is given back without filling out the data struct. - // FindFirstFile, however, will. Historically we always gave back attributes - // for marked-for-deletion files. - - Interop.Kernel32.WIN32_FIND_DATA findData = default; - using (SafeFindHandle handle = Interop.Kernel32.FindFirstFile(path, ref findData)) - { - if (handle.IsInvalid) - { - errorCode = Marshal.GetLastPInvokeError(); - } - else - { - errorCode = Interop.Errors.ERROR_SUCCESS; - data.PopulateFrom(ref findData); - } - } - } - } - } - - if (errorCode != Interop.Errors.ERROR_SUCCESS && !returnErrorOnNotFound) - { - switch (errorCode) - { - case Interop.Errors.ERROR_FILE_NOT_FOUND: - case Interop.Errors.ERROR_PATH_NOT_FOUND: - case Interop.Errors.ERROR_NOT_READY: // Removable media not ready - // Return default value for backward compatibility - data.dwFileAttributes = -1; - return Interop.Errors.ERROR_SUCCESS; - } - } - - return errorCode; - } - } -} diff --git a/src/libraries/System.Private.CoreLib/src/Internal/IO/File.cs b/src/libraries/System.Private.CoreLib/src/Internal/IO/File.cs deleted file mode 100644 index 127d72daa2e36..0000000000000 --- a/src/libraries/System.Private.CoreLib/src/Internal/IO/File.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using System.Security; -using System.IO; - -namespace Internal.IO -{ - // - // Subsetted clone of System.IO.File for internal runtime use. - // Keep in sync with https://github.com/dotnet/runtime/tree/main/src/libraries/System.IO.FileSystem. - // - internal static partial class File - { - // Tests if a file exists. The result is true if the file - // given by the specified path exists; otherwise, the result is - // false. Note that if path describes a directory, - // Exists will return true. - public static bool Exists([NotNullWhen(true)] string? path) - { - try - { - if (path == null) - return false; - if (path.Length == 0) - return false; - - path = Path.GetFullPath(path); - - // After normalizing, check whether path ends in directory separator. - // Otherwise, FillAttributeInfo removes it and we may return a false positive. - // GetFullPath should never return null - Debug.Assert(path != null, "File.Exists: GetFullPath returned null"); - if (path.Length > 0 && PathInternal.IsDirectorySeparator(path[^1])) - { - return false; - } - - return InternalExists(path); - } - catch (ArgumentException) { } - catch (IOException) { } - catch (UnauthorizedAccessException) { } - - return false; - } - - public static byte[] ReadAllBytes(string path) - { - // bufferSize == 1 used to avoid unnecessary buffer in FileStream - using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize: 1)) - { - long fileLength = fs.Length; - if (fileLength > int.MaxValue) - throw new IOException(SR.IO_FileTooLong2GB); - - int index = 0; - int count = (int)fileLength; - byte[] bytes = new byte[count]; - while (count > 0) - { - int n = fs.Read(bytes, index, count); - if (n == 0) - ThrowHelper.ThrowEndOfFileException(); - index += n; - count -= n; - } - return bytes; - } - } - } -} diff --git a/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx b/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx index 516f19e4b40fe..c64c59ae39136 100644 --- a/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx +++ b/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx @@ -3742,4 +3742,43 @@ Built-in COM has been disabled via a feature switch. See https://aka.ms/dotnet-illink/com for more information. + + Queue empty. + + + The target file '{0}' is a directory, not a file. + + + Invalid File or Directory attributes value. + + + Second path fragment must not be a drive or UNC name. + + + Path must not be a drive. + + + The stream's length cannot be changed. + + + The directory specified, '{0}', is not a subdirectory of '{1}'. + + + The specified directory '{0}' cannot be created. + + + Source and destination path must be different. + + + Source and destination path must have identical roots. Move will not work across volumes. + + + Synchronous operations should not be performed on the UI thread. Consider wrapping this method in Task.Run. + + + Probable I/O race condition detected while copying memory. The I/O package is not thread safe by default. In multithreaded applications, a stream must be accessed in a thread-safe way, such as a thread-safe wrapper returned by TextReader's or TextWriter's Synchronized methods. This also applies to classes like StreamWriter and StreamReader. + + + File encryption is not supported on this platform. + \ No newline at end of file diff --git a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems index fb5011f59f0c7..bbbd804c83e6f 100644 --- a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems +++ b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems @@ -54,7 +54,6 @@ - @@ -202,6 +201,8 @@ + + @@ -399,11 +400,16 @@ + + + + + @@ -411,14 +417,21 @@ + + + + + + + @@ -430,6 +443,11 @@ + + + + + @@ -1164,6 +1182,9 @@ Common\System\SR.cs + + Common\System\Collections\Generic\EnumerableHelpers.cs + Common\System\Collections\Generic\ReferenceEqualityComparer.cs @@ -1173,6 +1194,9 @@ Common\System\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAttribute.cs + + Common\System\IO\PathInternal.CaseSensitivity.cs + Common\System\Runtime\CompilerServices\IsExternalInit.cs @@ -1268,6 +1292,9 @@ + + Common\Interop\Windows\Advapi32\Interop.EncryptDecrypt.cs + Common\Interop\Windows\Advapi32\Interop.EventActivityIdControl.cs @@ -1352,24 +1379,48 @@ Common\Interop\Windows\Kernel32\Interop.ConditionVariable.cs + + Common\Interop\Windows\Kernel32\Interop.CopyFile.cs + + + Common\Interop\Windows\Kernel32\Interop.CopyFileEx.cs + + + Common\Interop\Windows\Kernel32\Interop.CreateDirectory.cs + Common\Interop\Windows\Kernel32\Interop.CreateFile.cs Common\Interop\Windows\NtDll\Interop.NtCreateFile.cs + + Common\Interop\Windows\NtDll\Interop.NtStatus.cs + + + Common\Interop\Windows\NtDll\Interop.IO_STATUS_BLOCK.cs + Common\Interop\Windows\NtDll\Interop.RtlNtStatusToDosError.cs Common\Interop\Windows\Kernel32\Interop.DeleteFile.cs + + Common\Interop\Windows\Kernel32\Interop.DeleteVolumeMountPoint.cs + + + Common\Interop\Windows\Kernel32\Interop.CreateFile_IntPtr.cs + Common\Interop\Windows\Kernel32\Interop.CriticalSection.cs Common\Interop\Windows\Kernel32\Interop.ExpandEnvironmentStrings.cs + + Common\Interop\Windows\Kernel32\Interop.FILE_BASIC_INFO.cs + Common\Interop\Windows\Kernel32\Interop.FILE_END_OF_FILE_INFO.cs @@ -1382,6 +1433,12 @@ Common\Interop\Windows\Kernel32\Interop.FileAttributes.cs + + Common\Interop\Windows\Kernel32\Interop.FindNextFile.cs + + + Common\Interop\Windows\Kernel32\Interop.FileOperations.cs + Common\Interop\Windows\Kernel32\Interop.FileTimeToSystemTime.cs @@ -1472,6 +1529,9 @@ Common\Interop\Windows\Kernel32\Interop.GetTempPathW.cs + + Common\Interop\Windows\Kernel32\Interop.GetVolumeInformation.cs + Common\Interop\Windows\Kernel32\Interop.GlobalMemoryStatusEx.cs @@ -1508,6 +1568,9 @@ Common\Interop\Windows\Kernel32\Interop.MultiByteToWideChar.cs + + Common\Interop\Windows\Kernel32\Interop.MoveFileEx.cs + Common\Interop\Windows\Kernel32\Interop.OSVERSIONINFOEX.cs @@ -1529,6 +1592,12 @@ Common\Interop\Windows\Kernel32\Interop.ReadFile_SafeHandle_NativeOverlapped.cs + + Common\Interop\Windows\Kernel32\Interop.RemoveDirectory.cs + + + Common\Interop\Windows\Kernel32\Interop.ReplaceFile.cs + Common\Interop\Windows\Kernel32\Interop.SECURITY_ATTRIBUTES.cs @@ -1547,6 +1616,9 @@ Common\Interop\Windows\Kernel32\Interop.SetCurrentDirectory.cs + + Common\Interop\Windows\Kernel32\Interop.SetFileAttributes.cs + Common\Interop\Windows\Kernel32\Interop.SetFileInformationByHandle.cs @@ -1601,6 +1673,15 @@ Common\Interop\Windows\Kernel32\Interop.WriteFile_SafeHandle_NativeOverlapped.cs + + Common\Interop\Windows\NtDll\Interop.FILE_FULL_DIR_INFORMATION.cs + + + Common\Interop\Windows\NtDll\Interop.FILE_INFORMATION_CLASS.cs + + + Common\Interop\Windows\NtDll\Interop.NtQueryDirectoryFile.cs + Common\Interop\Windows\NtDll\Interop.NtQueryInformationFile.cs @@ -1646,6 +1727,9 @@ Common\Interop\Windows\User32\Interop.LoadString.cs + + Common\Interop\Windows\Interop.LongFileTime + Common\Interop\Windows\User32\Interop.SendMessageTimeout.cs @@ -1658,8 +1742,13 @@ Common\Interop\Windows\User32\Interop.USEROBJECTFLAGS.cs + + Common\System\IO\FileSystem.Attributes.Windows.cs + + + Common\System\IO\FileSystem.DirectoryCreation.Windows.cs + - @@ -1682,9 +1771,15 @@ + + + + + + @@ -1751,6 +1846,9 @@ Common\System\IO\Win32Marshal.cs + + Common\System\Memory\FixedBufferExtensions.cs + @@ -1772,9 +1870,15 @@ Common\Interop\Unix\System.Native\Interop.ChDir.cs + + Common\Interop\Unix\System.Native\Interop.ChMod.cs + Common\Interop\Unix\System.Native\Interop.Close.cs + + Common\Interop\Unix\System.Native\Interop.CopyFile.cs + Common\Interop\Unix\System.Native\Interop.ErrNo.cs @@ -1793,6 +1897,9 @@ Common\Interop\Unix\System.Native\Interop.GetCwd.cs + + Common\Interop\Unix\System.Native\Interop.GetHostName.cs + Common\Interop\Unix\System.Native\Interop.GetHostName.cs @@ -1814,6 +1921,12 @@ Common\Interop\Unix\System.Native\Interop.GetUnixRelease.cs + + Common\Interop\Unix\System.Native\Interop.LChflags.cs + + + Common\Interop\Unix\System.Native\Interop.Link.cs + Common\Interop\Unix\System.Native\Interop.LockFileRegion.cs @@ -1829,6 +1942,9 @@ Common\Interop\Unix\System.Native\Interop.MemAlloc.cs + + Common\Interop\Unix\System.Native\Interop.MkDir.cs + Common\Interop\Unix\System.Native\Interop.MksTemps.cs @@ -1862,9 +1978,18 @@ Common\Interop\Unix\System.Native\Interop.ReadLink.cs + + Common\Interop\Unix\System.Native\Interop.Rename.cs + + + Common\Interop\Unix\System.Native\Interop.RmDir.cs + Common\Interop\Unix\System.Native\Interop.Stat.cs + + Common\Interop\Unix\System.Native\Interop.Stat.Span.cs + Common\Interop\Unix\System.Native\Interop.SysConf.cs @@ -1874,11 +1999,16 @@ Common\Interop\Unix\System.Native\Interop.Unlink.cs + + Common\Interop\Unix\System.Native\Interop.UTimensat.cs + Common\Interop\Unix\System.Native\Interop.Write.cs + + Common\System\Text\ValueUtf8Converter.cs + - @@ -1899,9 +2029,15 @@ + + + + + + diff --git a/src/libraries/System.Collections/src/System/Collections/Generic/Queue.cs b/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/Queue.cs similarity index 100% rename from src/libraries/System.Collections/src/System/Collections/Generic/Queue.cs rename to src/libraries/System.Private.CoreLib/src/System/Collections/Generic/Queue.cs diff --git a/src/libraries/System.Collections/src/System/Collections/Generic/QueueDebugView.cs b/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/QueueDebugView.cs similarity index 100% rename from src/libraries/System.Collections/src/System/Collections/Generic/QueueDebugView.cs rename to src/libraries/System.Private.CoreLib/src/System/Collections/Generic/QueueDebugView.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/Directory.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Directory.cs similarity index 97% rename from src/libraries/System.IO.FileSystem/src/System/IO/Directory.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/Directory.cs index 3d02ebd98a6be..3fbf585db5de1 100644 --- a/src/libraries/System.IO.FileSystem/src/System/IO/Directory.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/Directory.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.IO; -using System.Linq; #if MS_IO_REDIST using Microsoft.IO.Enumeration; @@ -144,7 +143,7 @@ public static string[] GetFiles(string path, string searchPattern, SearchOption => GetFiles(path, searchPattern, EnumerationOptions.FromSearchOption(searchOption)); public static string[] GetFiles(string path, string searchPattern, EnumerationOptions enumerationOptions) - => InternalEnumeratePaths(path, searchPattern, SearchTarget.Files, enumerationOptions).ToArray(); + => new List(InternalEnumeratePaths(path, searchPattern, SearchTarget.Files, enumerationOptions)).ToArray(); public static string[] GetDirectories(string path) => GetDirectories(path, "*", enumerationOptions: EnumerationOptions.Compatible); @@ -154,7 +153,7 @@ public static string[] GetDirectories(string path, string searchPattern, SearchO => GetDirectories(path, searchPattern, EnumerationOptions.FromSearchOption(searchOption)); public static string[] GetDirectories(string path, string searchPattern, EnumerationOptions enumerationOptions) - => InternalEnumeratePaths(path, searchPattern, SearchTarget.Directories, enumerationOptions).ToArray(); + => new List(InternalEnumeratePaths(path, searchPattern, SearchTarget.Directories, enumerationOptions)).ToArray(); public static string[] GetFileSystemEntries(string path) => GetFileSystemEntries(path, "*", enumerationOptions: EnumerationOptions.Compatible); @@ -164,7 +163,7 @@ public static string[] GetFileSystemEntries(string path, string searchPattern, S => GetFileSystemEntries(path, searchPattern, EnumerationOptions.FromSearchOption(searchOption)); public static string[] GetFileSystemEntries(string path, string searchPattern, EnumerationOptions enumerationOptions) - => InternalEnumeratePaths(path, searchPattern, SearchTarget.Both, enumerationOptions).ToArray(); + => new List(InternalEnumeratePaths(path, searchPattern, SearchTarget.Both, enumerationOptions)).ToArray(); internal static IEnumerable InternalEnumeratePaths( string path, diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/DirectoryInfo.cs b/src/libraries/System.Private.CoreLib/src/System/IO/DirectoryInfo.cs similarity index 96% rename from src/libraries/System.IO.FileSystem/src/System/IO/DirectoryInfo.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/DirectoryInfo.cs index 80a44bd3ad926..da8cdec7ab0ee 100644 --- a/src/libraries/System.IO.FileSystem/src/System/IO/DirectoryInfo.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/DirectoryInfo.cs @@ -5,7 +5,6 @@ using System.IO; using System.Collections.Generic; using System.Diagnostics; -using System.Linq; #if MS_IO_REDIST using Microsoft.IO.Enumeration; @@ -107,7 +106,7 @@ public FileInfo[] GetFiles(string searchPattern, SearchOption searchOption) => GetFiles(searchPattern, EnumerationOptions.FromSearchOption(searchOption)); public FileInfo[] GetFiles(string searchPattern, EnumerationOptions enumerationOptions) - => ((IEnumerable)InternalEnumerateInfos(FullPath, searchPattern, SearchTarget.Files, enumerationOptions)).ToArray(); + => new List((IEnumerable)InternalEnumerateInfos(FullPath, searchPattern, SearchTarget.Files, enumerationOptions)).ToArray(); // Returns an array of strongly typed FileSystemInfo entries which will contain a listing // of all the files and directories. @@ -122,7 +121,7 @@ public FileSystemInfo[] GetFileSystemInfos(string searchPattern, SearchOption se => GetFileSystemInfos(searchPattern, EnumerationOptions.FromSearchOption(searchOption)); public FileSystemInfo[] GetFileSystemInfos(string searchPattern, EnumerationOptions enumerationOptions) - => InternalEnumerateInfos(FullPath, searchPattern, SearchTarget.Both, enumerationOptions).ToArray(); + => new List(InternalEnumerateInfos(FullPath, searchPattern, SearchTarget.Both, enumerationOptions)).ToArray(); // Returns an array of Directories in the current directory. public DirectoryInfo[] GetDirectories() => GetDirectories("*", enumerationOptions: EnumerationOptions.Compatible); @@ -135,7 +134,7 @@ public DirectoryInfo[] GetDirectories(string searchPattern, SearchOption searchO => GetDirectories(searchPattern, EnumerationOptions.FromSearchOption(searchOption)); public DirectoryInfo[] GetDirectories(string searchPattern, EnumerationOptions enumerationOptions) - => ((IEnumerable)InternalEnumerateInfos(FullPath, searchPattern, SearchTarget.Directories, enumerationOptions)).ToArray(); + => new List((IEnumerable)InternalEnumerateInfos(FullPath, searchPattern, SearchTarget.Directories, enumerationOptions)).ToArray(); public IEnumerable EnumerateDirectories() => EnumerateDirectories("*", enumerationOptions: EnumerationOptions.Compatible); diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEntry.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEntry.Unix.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEntry.Unix.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEntry.Unix.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEntry.Windows.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEntry.Windows.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEntry.Windows.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEntry.Windows.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEntry.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEntry.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEntry.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEntry.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEnumerable.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEnumerable.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEnumerable.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEnumerable.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEnumerableFactory.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEnumerableFactory.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEnumerableFactory.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEnumerableFactory.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEnumerator.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEnumerator.Unix.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEnumerator.Unix.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEnumerator.Unix.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEnumerator.Win32.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEnumerator.Win32.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEnumerator.Win32.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEnumerator.Win32.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEnumerator.Windows.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEnumerator.Windows.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEnumerator.Windows.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEnumerator.Windows.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEnumerator.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEnumerator.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEnumerator.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEnumerator.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemName.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemName.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemName.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemName.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/EnumerationOptions.cs b/src/libraries/System.Private.CoreLib/src/System/IO/EnumerationOptions.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/EnumerationOptions.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/EnumerationOptions.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/File.cs b/src/libraries/System.Private.CoreLib/src/System/IO/File.cs similarity index 99% rename from src/libraries/System.IO.FileSystem/src/System/IO/File.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/File.cs index 9f59754856473..c8f63b8b32d89 100644 --- a/src/libraries/System.IO.FileSystem/src/System/IO/File.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/File.cs @@ -352,7 +352,10 @@ public static byte[] ReadAllBytes(string path) { int n = fs.Read(bytes, index, count); if (n == 0) - throw Error.GetEndOfFile(); + { + ThrowHelper.ThrowEndOfFileException(); + } + index += n; count -= n; } @@ -815,7 +818,7 @@ private static async Task InternalReadAllBytesAsync(FileStream fs, int c #endif if (n == 0) { - throw Error.GetEndOfFile(); + ThrowHelper.ThrowEndOfFileException(); } index += n; diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/FileInfo.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileInfo.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/FileInfo.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/FileInfo.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/FileStatus.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.Unix.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/FileStatus.Unix.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.Unix.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/FileSystem.Exists.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Exists.Unix.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/FileSystem.Exists.Unix.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Exists.Unix.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/FileSystem.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Unix.cs similarity index 99% rename from src/libraries/System.IO.FileSystem/src/System/IO/FileSystem.Unix.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Unix.cs index 5993c1d6ac508..224de5abcd556 100644 --- a/src/libraries/System.IO.FileSystem/src/System/IO/FileSystem.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Unix.cs @@ -261,7 +261,7 @@ public static void CreateDirectory(string fullPath) // Attempt to figure out which directories don't exist, and only create the ones we need. bool somepathexists = false; - Stack stackDir = new Stack(); + List stackDir = new List(); int lengthRoot = PathInternal.GetRootLength(fullPath); if (length > lengthRoot) { @@ -270,7 +270,7 @@ public static void CreateDirectory(string fullPath) { if (!DirectoryExists(fullPath.AsSpan(0, i + 1))) // Create only the ones missing { - stackDir.Push(fullPath.Substring(0, i + 1)); + stackDir.Add(fullPath.Substring(0, i + 1)); } else { @@ -300,9 +300,9 @@ public static void CreateDirectory(string fullPath) int result = 0; Interop.ErrorInfo firstError = default(Interop.ErrorInfo); string errorString = fullPath; - while (stackDir.Count > 0) + for (int i = stackDir.Count - 1; i >= 0; i--) { - string name = stackDir.Pop(); + string name = stackDir[i]; // The mkdir command uses 0777 by default (it'll be AND'd with the process umask internally). // We do the same. diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/FileSystem.Win32.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Win32.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/FileSystem.Win32.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Win32.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/FileSystem.Windows.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Windows.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/FileSystem.Windows.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Windows.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/FileSystemInfo.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileSystemInfo.Unix.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/FileSystemInfo.Unix.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/FileSystemInfo.Unix.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/FileSystemInfo.Windows.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileSystemInfo.Windows.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/FileSystemInfo.Windows.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/FileSystemInfo.Windows.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/FileSystemInfo.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileSystemInfo.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/FileSystemInfo.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/FileSystemInfo.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/Iterator.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Iterator.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/Iterator.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/Iterator.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/MatchCasing.cs b/src/libraries/System.Private.CoreLib/src/System/IO/MatchCasing.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/MatchCasing.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/MatchCasing.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/MatchType.cs b/src/libraries/System.Private.CoreLib/src/System/IO/MatchType.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/MatchType.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/MatchType.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/ReadLinesIterator.cs b/src/libraries/System.Private.CoreLib/src/System/IO/ReadLinesIterator.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/ReadLinesIterator.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/ReadLinesIterator.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/SearchOption.cs b/src/libraries/System.Private.CoreLib/src/System/IO/SearchOption.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/SearchOption.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/SearchOption.cs diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/SearchTarget.cs b/src/libraries/System.Private.CoreLib/src/System/IO/SearchTarget.cs similarity index 100% rename from src/libraries/System.IO.FileSystem/src/System/IO/SearchTarget.cs rename to src/libraries/System.Private.CoreLib/src/System/IO/SearchTarget.cs diff --git a/src/libraries/System.Private.CoreLib/src/System/Resources/FileBasedResourceGroveler.cs b/src/libraries/System.Private.CoreLib/src/System/Resources/FileBasedResourceGroveler.cs index 2bbdd3db332b0..77b4a681354c1 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Resources/FileBasedResourceGroveler.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Resources/FileBasedResourceGroveler.cs @@ -15,8 +15,6 @@ using System.Globalization; using System.IO; -using Internal.IO; - namespace System.Resources { internal sealed class FileBasedResourceGroveler : IResourceGroveler diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyDependencyResolver.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyDependencyResolver.cs index edb2d8c971f56..644e536757b1b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyDependencyResolver.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyDependencyResolver.cs @@ -6,7 +6,6 @@ using System.Reflection; using System.Runtime.InteropServices; using System.Text; -using Internal.IO; namespace System.Runtime.Loader { diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.cs index 5dea6b34f3f8c..6c733ef6ca150 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.cs @@ -780,7 +780,7 @@ private static void OnAssemblyLoad(RuntimeAssembly assembly) string assemblyPath = Path.Combine(parentDirectory, assemblyName.CultureName!, $"{assemblyName.Name}.dll"); - bool exists = Internal.IO.File.InternalExists(assemblyPath); + bool exists = System.IO.FileSystem.FileExists(assemblyPath); if (!exists && Path.IsCaseSensitive) { #if CORECLR @@ -790,7 +790,7 @@ private static void OnAssemblyLoad(RuntimeAssembly assembly) } #endif // CORECLR assemblyPath = Path.Combine(parentDirectory, assemblyName.CultureName!.ToLowerInvariant(), $"{assemblyName.Name}.dll"); - exists = Internal.IO.File.InternalExists(assemblyPath); + exists = System.IO.FileSystem.FileExists(assemblyPath); } Assembly? asm = exists ? parentALC.LoadFromAssemblyPath(assemblyPath) : null; diff --git a/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.cs index c67b3a261e0eb..ebc626a622194 100644 --- a/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.cs @@ -12,8 +12,6 @@ using System.Threading; using System.Security; -using Internal.IO; - namespace System { public sealed partial class TimeZoneInfo diff --git a/src/libraries/System.Runtime/ref/System.Runtime.cs b/src/libraries/System.Runtime/ref/System.Runtime.cs index 9b82d81e5fdcf..224a13e6abffd 100644 --- a/src/libraries/System.Runtime/ref/System.Runtime.cs +++ b/src/libraries/System.Runtime/ref/System.Runtime.cs @@ -7391,6 +7391,246 @@ public override void Write(System.ReadOnlySpan buffer) { } public override System.Threading.Tasks.ValueTask WriteAsync(System.ReadOnlyMemory buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override void WriteByte(byte value) { } } + public static partial class Directory + { + public static System.IO.DirectoryInfo CreateDirectory(string path) { throw null; } + public static void Delete(string path) { } + public static void Delete(string path, bool recursive) { } + public static System.Collections.Generic.IEnumerable EnumerateDirectories(string path) { throw null; } + public static System.Collections.Generic.IEnumerable EnumerateDirectories(string path, string searchPattern) { throw null; } + public static System.Collections.Generic.IEnumerable EnumerateDirectories(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } + public static System.Collections.Generic.IEnumerable EnumerateDirectories(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; } + public static System.Collections.Generic.IEnumerable EnumerateFiles(string path) { throw null; } + public static System.Collections.Generic.IEnumerable EnumerateFiles(string path, string searchPattern) { throw null; } + public static System.Collections.Generic.IEnumerable EnumerateFiles(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } + public static System.Collections.Generic.IEnumerable EnumerateFiles(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; } + public static System.Collections.Generic.IEnumerable EnumerateFileSystemEntries(string path) { throw null; } + public static System.Collections.Generic.IEnumerable EnumerateFileSystemEntries(string path, string searchPattern) { throw null; } + public static System.Collections.Generic.IEnumerable EnumerateFileSystemEntries(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } + public static System.Collections.Generic.IEnumerable EnumerateFileSystemEntries(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; } + public static bool Exists([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? path) { throw null; } + public static System.DateTime GetCreationTime(string path) { throw null; } + public static System.DateTime GetCreationTimeUtc(string path) { throw null; } + public static string GetCurrentDirectory() { throw null; } + public static string[] GetDirectories(string path) { throw null; } + public static string[] GetDirectories(string path, string searchPattern) { throw null; } + public static string[] GetDirectories(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } + public static string[] GetDirectories(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; } + public static string GetDirectoryRoot(string path) { throw null; } + public static string[] GetFiles(string path) { throw null; } + public static string[] GetFiles(string path, string searchPattern) { throw null; } + public static string[] GetFiles(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } + public static string[] GetFiles(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; } + public static string[] GetFileSystemEntries(string path) { throw null; } + public static string[] GetFileSystemEntries(string path, string searchPattern) { throw null; } + public static string[] GetFileSystemEntries(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } + public static string[] GetFileSystemEntries(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; } + public static System.DateTime GetLastAccessTime(string path) { throw null; } + public static System.DateTime GetLastAccessTimeUtc(string path) { throw null; } + public static System.DateTime GetLastWriteTime(string path) { throw null; } + public static System.DateTime GetLastWriteTimeUtc(string path) { throw null; } + public static string[] GetLogicalDrives() { throw null; } + public static System.IO.DirectoryInfo? GetParent(string path) { throw null; } + public static void Move(string sourceDirName, string destDirName) { } + public static void SetCreationTime(string path, System.DateTime creationTime) { } + public static void SetCreationTimeUtc(string path, System.DateTime creationTimeUtc) { } + public static void SetCurrentDirectory(string path) { } + public static void SetLastAccessTime(string path, System.DateTime lastAccessTime) { } + public static void SetLastAccessTimeUtc(string path, System.DateTime lastAccessTimeUtc) { } + public static void SetLastWriteTime(string path, System.DateTime lastWriteTime) { } + public static void SetLastWriteTimeUtc(string path, System.DateTime lastWriteTimeUtc) { } + } + public abstract partial class FileSystemInfo : System.MarshalByRefObject, System.Runtime.Serialization.ISerializable + { + protected string FullPath; + protected string OriginalPath; + protected FileSystemInfo() { } + protected FileSystemInfo(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public System.IO.FileAttributes Attributes { get { throw null; } set { } } + public System.DateTime CreationTime { get { throw null; } set { } } + public System.DateTime CreationTimeUtc { get { throw null; } set { } } + public abstract bool Exists { get; } + public string Extension { get { throw null; } } + public virtual string FullName { get { throw null; } } + public System.DateTime LastAccessTime { get { throw null; } set { } } + public System.DateTime LastAccessTimeUtc { get { throw null; } set { } } + public System.DateTime LastWriteTime { get { throw null; } set { } } + public System.DateTime LastWriteTimeUtc { get { throw null; } set { } } + public abstract string Name { get; } + public abstract void Delete(); + public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public void Refresh() { } + public override string ToString() { throw null; } + } + public sealed partial class DirectoryInfo : System.IO.FileSystemInfo + { + public DirectoryInfo(string path) { } + public override bool Exists { get { throw null; } } + public override string Name { get { throw null; } } + public System.IO.DirectoryInfo? Parent { get { throw null; } } + public System.IO.DirectoryInfo Root { get { throw null; } } + public void Create() { } + public System.IO.DirectoryInfo CreateSubdirectory(string path) { throw null; } + public override void Delete() { } + public void Delete(bool recursive) { } + public System.Collections.Generic.IEnumerable EnumerateDirectories() { throw null; } + public System.Collections.Generic.IEnumerable EnumerateDirectories(string searchPattern) { throw null; } + public System.Collections.Generic.IEnumerable EnumerateDirectories(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } + public System.Collections.Generic.IEnumerable EnumerateDirectories(string searchPattern, System.IO.SearchOption searchOption) { throw null; } + public System.Collections.Generic.IEnumerable EnumerateFiles() { throw null; } + public System.Collections.Generic.IEnumerable EnumerateFiles(string searchPattern) { throw null; } + public System.Collections.Generic.IEnumerable EnumerateFiles(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } + public System.Collections.Generic.IEnumerable EnumerateFiles(string searchPattern, System.IO.SearchOption searchOption) { throw null; } + public System.Collections.Generic.IEnumerable EnumerateFileSystemInfos() { throw null; } + public System.Collections.Generic.IEnumerable EnumerateFileSystemInfos(string searchPattern) { throw null; } + public System.Collections.Generic.IEnumerable EnumerateFileSystemInfos(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } + public System.Collections.Generic.IEnumerable EnumerateFileSystemInfos(string searchPattern, System.IO.SearchOption searchOption) { throw null; } + public System.IO.DirectoryInfo[] GetDirectories() { throw null; } + public System.IO.DirectoryInfo[] GetDirectories(string searchPattern) { throw null; } + public System.IO.DirectoryInfo[] GetDirectories(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } + public System.IO.DirectoryInfo[] GetDirectories(string searchPattern, System.IO.SearchOption searchOption) { throw null; } + public System.IO.FileInfo[] GetFiles() { throw null; } + public System.IO.FileInfo[] GetFiles(string searchPattern) { throw null; } + public System.IO.FileInfo[] GetFiles(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } + public System.IO.FileInfo[] GetFiles(string searchPattern, System.IO.SearchOption searchOption) { throw null; } + public System.IO.FileSystemInfo[] GetFileSystemInfos() { throw null; } + public System.IO.FileSystemInfo[] GetFileSystemInfos(string searchPattern) { throw null; } + public System.IO.FileSystemInfo[] GetFileSystemInfos(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; } + public System.IO.FileSystemInfo[] GetFileSystemInfos(string searchPattern, System.IO.SearchOption searchOption) { throw null; } + public void MoveTo(string destDirName) { } + public override string ToString() { throw null; } + } + public enum MatchCasing + { + PlatformDefault = 0, + CaseSensitive = 1, + CaseInsensitive = 2, + } + public enum MatchType + { + Simple = 0, + Win32 = 1, + } + public enum SearchOption + { + TopDirectoryOnly = 0, + AllDirectories = 1, + } + public partial class EnumerationOptions + { + public EnumerationOptions() { } + public System.IO.FileAttributes AttributesToSkip { get { throw null; } set { } } + public int BufferSize { get { throw null; } set { } } + public bool IgnoreInaccessible { get { throw null; } set { } } + public System.IO.MatchCasing MatchCasing { get { throw null; } set { } } + public System.IO.MatchType MatchType { get { throw null; } set { } } + public int MaxRecursionDepth { get { throw null; } set { } } + public bool RecurseSubdirectories { get { throw null; } set { } } + public bool ReturnSpecialDirectories { get { throw null; } set { } } + } + public static partial class File + { + public static void AppendAllLines(string path, System.Collections.Generic.IEnumerable contents) { } + public static void AppendAllLines(string path, System.Collections.Generic.IEnumerable contents, System.Text.Encoding encoding) { } + public static System.Threading.Tasks.Task AppendAllLinesAsync(string path, System.Collections.Generic.IEnumerable contents, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task AppendAllLinesAsync(string path, System.Collections.Generic.IEnumerable contents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static void AppendAllText(string path, string? contents) { } + public static void AppendAllText(string path, string? contents, System.Text.Encoding encoding) { } + public static System.Threading.Tasks.Task AppendAllTextAsync(string path, string? contents, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task AppendAllTextAsync(string path, string? contents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.IO.StreamWriter AppendText(string path) { throw null; } + public static void Copy(string sourceFileName, string destFileName) { } + public static void Copy(string sourceFileName, string destFileName, bool overwrite) { } + public static System.IO.FileStream Create(string path) { throw null; } + public static System.IO.FileStream Create(string path, int bufferSize) { throw null; } + public static System.IO.FileStream Create(string path, int bufferSize, System.IO.FileOptions options) { throw null; } + public static System.IO.StreamWriter CreateText(string path) { throw null; } + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] + public static void Decrypt(string path) { } + public static void Delete(string path) { } + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] + public static void Encrypt(string path) { } + public static bool Exists([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? path) { throw null; } + public static System.IO.FileAttributes GetAttributes(string path) { throw null; } + public static System.DateTime GetCreationTime(string path) { throw null; } + public static System.DateTime GetCreationTimeUtc(string path) { throw null; } + public static System.DateTime GetLastAccessTime(string path) { throw null; } + public static System.DateTime GetLastAccessTimeUtc(string path) { throw null; } + public static System.DateTime GetLastWriteTime(string path) { throw null; } + public static System.DateTime GetLastWriteTimeUtc(string path) { throw null; } + public static void Move(string sourceFileName, string destFileName) { } + public static void Move(string sourceFileName, string destFileName, bool overwrite) { } + public static System.IO.FileStream Open(string path, System.IO.FileMode mode) { throw null; } + public static System.IO.FileStream Open(string path, System.IO.FileMode mode, System.IO.FileAccess access) { throw null; } + public static System.IO.FileStream Open(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) { throw null; } + public static System.IO.FileStream OpenRead(string path) { throw null; } + public static System.IO.StreamReader OpenText(string path) { throw null; } + public static System.IO.FileStream OpenWrite(string path) { throw null; } + public static byte[] ReadAllBytes(string path) { throw null; } + public static System.Threading.Tasks.Task ReadAllBytesAsync(string path, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static string[] ReadAllLines(string path) { throw null; } + public static string[] ReadAllLines(string path, System.Text.Encoding encoding) { throw null; } + public static System.Threading.Tasks.Task ReadAllLinesAsync(string path, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task ReadAllLinesAsync(string path, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static string ReadAllText(string path) { throw null; } + public static string ReadAllText(string path, System.Text.Encoding encoding) { throw null; } + public static System.Threading.Tasks.Task ReadAllTextAsync(string path, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task ReadAllTextAsync(string path, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Collections.Generic.IEnumerable ReadLines(string path) { throw null; } + public static System.Collections.Generic.IEnumerable ReadLines(string path, System.Text.Encoding encoding) { throw null; } + public static void Replace(string sourceFileName, string destinationFileName, string? destinationBackupFileName) { } + public static void Replace(string sourceFileName, string destinationFileName, string? destinationBackupFileName, bool ignoreMetadataErrors) { } + public static void SetAttributes(string path, System.IO.FileAttributes fileAttributes) { } + public static void SetCreationTime(string path, System.DateTime creationTime) { } + public static void SetCreationTimeUtc(string path, System.DateTime creationTimeUtc) { } + public static void SetLastAccessTime(string path, System.DateTime lastAccessTime) { } + public static void SetLastAccessTimeUtc(string path, System.DateTime lastAccessTimeUtc) { } + public static void SetLastWriteTime(string path, System.DateTime lastWriteTime) { } + public static void SetLastWriteTimeUtc(string path, System.DateTime lastWriteTimeUtc) { } + public static void WriteAllBytes(string path, byte[] bytes) { } + public static System.Threading.Tasks.Task WriteAllBytesAsync(string path, byte[] bytes, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static void WriteAllLines(string path, System.Collections.Generic.IEnumerable contents) { } + public static void WriteAllLines(string path, System.Collections.Generic.IEnumerable contents, System.Text.Encoding encoding) { } + public static void WriteAllLines(string path, string[] contents) { } + public static void WriteAllLines(string path, string[] contents, System.Text.Encoding encoding) { } + public static System.Threading.Tasks.Task WriteAllLinesAsync(string path, System.Collections.Generic.IEnumerable contents, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task WriteAllLinesAsync(string path, System.Collections.Generic.IEnumerable contents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static void WriteAllText(string path, string? contents) { } + public static void WriteAllText(string path, string? contents, System.Text.Encoding encoding) { } + public static System.Threading.Tasks.Task WriteAllTextAsync(string path, string? contents, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task WriteAllTextAsync(string path, string? contents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public sealed partial class FileInfo : System.IO.FileSystemInfo + { + public FileInfo(string fileName) { } + public System.IO.DirectoryInfo? Directory { get { throw null; } } + public string? DirectoryName { get { throw null; } } + public override bool Exists { get { throw null; } } + public bool IsReadOnly { get { throw null; } set { } } + public long Length { get { throw null; } } + public override string Name { get { throw null; } } + public System.IO.StreamWriter AppendText() { throw null; } + public System.IO.FileInfo CopyTo(string destFileName) { throw null; } + public System.IO.FileInfo CopyTo(string destFileName, bool overwrite) { throw null; } + public System.IO.FileStream Create() { throw null; } + public System.IO.StreamWriter CreateText() { throw null; } + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] + public void Decrypt() { } + public override void Delete() { } + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] + public void Encrypt() { } + public void MoveTo(string destFileName) { } + public void MoveTo(string destFileName, bool overwrite) { } + public System.IO.FileStream Open(System.IO.FileMode mode) { throw null; } + public System.IO.FileStream Open(System.IO.FileMode mode, System.IO.FileAccess access) { throw null; } + public System.IO.FileStream Open(System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) { throw null; } + public System.IO.FileStream OpenRead() { throw null; } + public System.IO.StreamReader OpenText() { throw null; } + public System.IO.FileStream OpenWrite() { throw null; } + public System.IO.FileInfo Replace(string destinationFileName, string? destinationBackupFileName) { throw null; } + public System.IO.FileInfo Replace(string destinationFileName, string? destinationBackupFileName, bool ignoreMetadataErrors) { throw null; } + public override string ToString() { throw null; } + } public enum HandleInheritability { None = 0, @@ -7832,6 +8072,59 @@ public override void Write(System.ReadOnlySpan buffer) { } public override void WriteByte(byte value) { } } } +namespace System.IO.Enumeration +{ + public ref partial struct FileSystemEntry + { + private object _dummy; + private int _dummyPrimitive; + public System.IO.FileAttributes Attributes { get { throw null; } } + public System.DateTimeOffset CreationTimeUtc { get { throw null; } } + public readonly System.ReadOnlySpan Directory { get { throw null; } } + public System.ReadOnlySpan FileName { get { throw null; } } + public bool IsDirectory { get { throw null; } } + public bool IsHidden { get { throw null; } } + public System.DateTimeOffset LastAccessTimeUtc { get { throw null; } } + public System.DateTimeOffset LastWriteTimeUtc { get { throw null; } } + public long Length { get { throw null; } } + public readonly System.ReadOnlySpan OriginalRootDirectory { get { throw null; } } + public readonly System.ReadOnlySpan RootDirectory { get { throw null; } } + public System.IO.FileSystemInfo ToFileSystemInfo() { throw null; } + public string ToFullPath() { throw null; } + public string ToSpecifiedFullPath() { throw null; } + } + public partial class FileSystemEnumerable : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + public FileSystemEnumerable(string directory, System.IO.Enumeration.FileSystemEnumerable.FindTransform transform, System.IO.EnumerationOptions? options = null) { } + public System.IO.Enumeration.FileSystemEnumerable.FindPredicate? ShouldIncludePredicate { get { throw null; } set { } } + public System.IO.Enumeration.FileSystemEnumerable.FindPredicate? ShouldRecursePredicate { get { throw null; } set { } } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public delegate bool FindPredicate(ref System.IO.Enumeration.FileSystemEntry entry); + public delegate TResult FindTransform(ref System.IO.Enumeration.FileSystemEntry entry); + } + public abstract partial class FileSystemEnumerator : System.Runtime.ConstrainedExecution.CriticalFinalizerObject, System.Collections.Generic.IEnumerator, System.Collections.IEnumerator, System.IDisposable + { + public FileSystemEnumerator(string directory, System.IO.EnumerationOptions? options = null) { } + public TResult Current { get { throw null; } } + object? System.Collections.IEnumerator.Current { get { throw null; } } + protected virtual bool ContinueOnError(int error) { throw null; } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public bool MoveNext() { throw null; } + protected virtual void OnDirectoryFinished(System.ReadOnlySpan directory) { } + public void Reset() { } + protected virtual bool ShouldIncludeEntry(ref System.IO.Enumeration.FileSystemEntry entry) { throw null; } + protected virtual bool ShouldRecurseIntoEntry(ref System.IO.Enumeration.FileSystemEntry entry) { throw null; } + protected abstract TResult TransformEntry(ref System.IO.Enumeration.FileSystemEntry entry); + } + public static partial class FileSystemName + { + public static bool MatchesSimpleExpression(System.ReadOnlySpan expression, System.ReadOnlySpan name, bool ignoreCase = true) { throw null; } + public static bool MatchesWin32Expression(System.ReadOnlySpan expression, System.ReadOnlySpan name, bool ignoreCase = true) { throw null; } + public static string TranslateWin32Expression(string? expression) { throw null; } + } +} namespace System.Net { public static partial class WebUtility diff --git a/src/libraries/System.Runtime/src/MatchingRefApiCompatBaseline.txt b/src/libraries/System.Runtime/src/MatchingRefApiCompatBaseline.txt index 4550352429247..cbe8cabdbb295 100644 --- a/src/libraries/System.Runtime/src/MatchingRefApiCompatBaseline.txt +++ b/src/libraries/System.Runtime/src/MatchingRefApiCompatBaseline.txt @@ -17,4 +17,11 @@ MembersMustExist : Member 'public System.Runtime.Serialization.DeserializationTo MembersMustExist : Member 'public void System.Runtime.Serialization.SerializationInfo.ThrowIfDeserializationInProgress()' does not exist in the reference but it does exist in the implementation. MembersMustExist : Member 'public void System.Runtime.Serialization.SerializationInfo.ThrowIfDeserializationInProgress(System.String, System.Int32)' does not exist in the reference but it does exist in the implementation. MembersMustExist : Member 'public void System.Runtime.Serialization.SerializationInfo.UpdateValue(System.String, System.Object, System.Type)' does not exist in the reference but it does exist in the implementation. -Total Issues: 18 +# These are now virtual in the implementation, which should be ok. +CannotMakeMemberAbstract : Member 'public System.Boolean System.IO.FileSystemInfo.Exists' is abstract in the reference but is not abstract in the implementation. +CannotMakeMemberAbstract : Member 'public System.String System.IO.FileSystemInfo.Name' is abstract in the reference but is not abstract in the implementation. +CannotMakeMemberAbstract : Member 'public System.Boolean System.IO.FileSystemInfo.Exists.get()' is abstract in the reference but is not abstract in the implementation. +CannotMakeMemberAbstract : Member 'public System.String System.IO.FileSystemInfo.Name.get()' is abstract in the reference but is not abstract in the implementation. +# C# generates backing fields for fixed buffers as public. +TypesMustExist : Type 'System.IO.Enumeration.FileSystemEntry.<_fileNameBuffer>e__FixedBuffer' does not exist in the reference but it does exist in the implementation. +