You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
private void btnTest_Click(object sender, EventArgs e)
{
var url = $"smb://{txtPath.Text}/test.test";
var file = new SmbFile(url, _auth);
file.CreateNewFile();
var ostream = file.GetOutputStream();
ostream.Write(123);
ostream.Write(123);
var stream = (Stream)ostream;
Debug.WriteLine(stream.CanSeek); //stream.CanSeek is true
stream.Seek(0, SeekOrigin.Begin); //strangely enough this works
stream.Seek(0, SeekOrigin.End); //throws an exception:
//Exception thrown: 'System.NullReferenceException' in SharpCifs.Std.dll
//An unhandled exception of type 'System.NullReferenceException' occurred in SharpCifs.Std.dll
//Object reference not set to an instance of an object.
StackTrace:
at SharpCifs.Util.Sharpen.WrappedSystemStream.get_Length()
at SharpCifs.Util.Sharpen.WrappedSystemStream.Seek(Int64 offset, SeekOrigin origin)
at NetShareTest.Form1.btnTest_Click(Object sender, EventArgs e)
}
Looks like the CanSeek property of Stream object which is returned by implicit operator Stream should return false always. Or Seek() method should work properly and should not throw any exception.
The text was updated successfully, but these errors were encountered:
//Exception thrown: 'System.NullReferenceException' in SharpCifs.Std.dll
//An unhandled exception of type 'System.NullReferenceException' occurred in SharpCifs.Std.dll
//Object reference not set to an instance of an object.
StackTrace:
at SharpCifs.Util.Sharpen.WrappedSystemStream.get_Length()
at SharpCifs.Util.Sharpen.WrappedSystemStream.Seek(Int64 offset, SeekOrigin origin)
at NetShareTest.Form1.btnTest_Click(Object sender, EventArgs e)
}
Looks like the CanSeek property of Stream object which is returned by implicit operator Stream should return false always. Or Seek() method should work properly and should not throw any exception.
The text was updated successfully, but these errors were encountered: