diff --git a/src/libraries/System.IO.FileSystem/src/MatchingRefApiCompatBaseline.txt b/src/libraries/System.IO.FileSystem/src/MatchingRefApiCompatBaseline.txt index 18249df1605c8..ad75f4c3ad66f 100644 --- a/src/libraries/System.IO.FileSystem/src/MatchingRefApiCompatBaseline.txt +++ b/src/libraries/System.IO.FileSystem/src/MatchingRefApiCompatBaseline.txt @@ -4,5 +4,3 @@ CannotMakeMemberAbstract : Member 'public System.Boolean System.IO.FileSystemInf 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. diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEntry.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEntry.Unix.cs index 5d46352f6dbe7..deae3fb6b6a2a 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEntry.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEntry.Unix.cs @@ -10,14 +10,20 @@ namespace System.IO.Enumeration /// Lower level view of FileSystemInfo used for processing and filtering find results. /// public unsafe ref partial struct FileSystemEntry - { + { private Interop.Sys.DirectoryEntry _directoryEntry; private bool _isDirectory; private FileStatus _status; private Span _pathBuffer; private ReadOnlySpan _fullPath; private ReadOnlySpan _fileName; - private fixed char _fileNameBuffer[Interop.Sys.DirectoryEntry.NameBufferSize]; + private FileNameBuffer _fileNameBuffer; + + // Wrap the fixed buffer to workaround visibility issues in api compat verification + private struct FileNameBuffer + { + internal fixed char _buffer[Interop.Sys.DirectoryEntry.NameBufferSize]; + } internal static FileAttributes Initialize( ref FileSystemEntry entry, @@ -89,7 +95,7 @@ public ReadOnlySpan FileName { if (_directoryEntry.NameLength != 0 && _fileName.Length == 0) { - Span buffer = MemoryMarshal.CreateSpan(ref _fileNameBuffer[0], Interop.Sys.DirectoryEntry.NameBufferSize); + Span buffer = MemoryMarshal.CreateSpan(ref _fileNameBuffer._buffer[0], Interop.Sys.DirectoryEntry.NameBufferSize); _fileName = _directoryEntry.GetName(buffer); } diff --git a/src/libraries/System.Runtime/src/MatchingRefApiCompatBaseline.txt b/src/libraries/System.Runtime/src/MatchingRefApiCompatBaseline.txt index c2e27e2e98269..a2a1bd652f263 100644 --- a/src/libraries/System.Runtime/src/MatchingRefApiCompatBaseline.txt +++ b/src/libraries/System.Runtime/src/MatchingRefApiCompatBaseline.txt @@ -23,8 +23,6 @@ CannotMakeMemberAbstract : Member 'public System.Boolean System.IO.FileSystemInf 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. MembersMustExist : Member 'public void System.ModuleHandle..ctor(System.Reflection.Module)' does not exist in the reference but it does exist in the implementation. MembersMustExist : Member 'public System.String System.String System.Type.DefaultTypeNameWhenMissingMetadata' does not exist in the reference but it does exist in the implementation. MembersMustExist : Member 'public System.String System.Type.FormatTypeNameForReflection()' does not exist in the reference but it does exist in the implementation.