diff --git a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs index 4029e70cef29e8..878eafb8c85291 100644 --- a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs @@ -344,7 +344,10 @@ private bool Init(string path, FileMode mode, FileAccess access, FileShare share // and for regular files (most common case) // avoid one extra sys call for determining whether file can be seeked _canSeek = NullableBool.True; - Debug.Assert(Interop.Sys.LSeek(this, 0, Interop.Sys.SeekWhence.SEEK_CUR) >= 0); + + // we exclude 0-length files from the assert because those may may be pseudofiles + // (e.g. /proc/net/route) and these are not seekable on all systems + Debug.Assert(status.Size == 0 || Interop.Sys.LSeek(this, 0, Interop.Sys.SeekWhence.SEEK_CUR) >= 0); } fileLength = status.Size;