Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Diagnostics.Tracing;
using System.Linq;
using System.Net.Security;
using System.IO;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Security.Authentication;
Expand Down Expand Up @@ -182,6 +183,18 @@ bool TestWeakReferences()
[Fact]
public async Task ConnectWithCertificateChain()
{
FileStream file = new FileStream("/proc/net/route", FileMode.Open, FileAccess.Read);

System.Console.WriteLine($"Position: {file.Position}, CanSeek: {file.CanSeek}, Length: {file.Length}");

file.Position = 1;

System.Console.WriteLine($"SafeFileHandle: {file.SafeFileHandle}");

System.Console.WriteLine($"Position: {file.Position}, CanSeek: {file.CanSeek}, Length: {file.Length}");
file.ReadByte();
System.Console.WriteLine($"Position: {file.Position}, CanSeek: {file.CanSeek}, Length: {file.Length}");

X509Certificate2 certificate = _certificates.ServerCert;
X509Certificate2Collection chain = _certificates.ServerChain;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
using System.Diagnostics;
using System.IO;
using System.IO.Strategies;
using System.Runtime.InteropServices;
using System.Threading;
using Internal;

namespace Microsoft.Win32.SafeHandles
{
Expand Down Expand Up @@ -333,7 +335,15 @@ 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);
long result = Interop.Sys.LSeek(this, 0, Interop.Sys.SeekWhence.SEEK_CUR);
if (result < 0)
{
var errno = Interop.Sys.GetErrNo();
Console.WriteLine("LSeek failed with error: " + errno + " message: " + Marshal.GetPInvokeErrorMessage(errno));
Console.WriteLine($"Path '{path}' {(File.Exists(path) ? "exists" : "doesn't exist")}.");
Console.WriteLine($"Path '{path}' = {new FileInfo(path).Attributes}.");
}
//Debug.Assert(result >= 0);
}

fileLength = status.Size;
Expand Down
Loading