Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable list directory async for net framework #1206

Conversation

Patrick-3000
Copy link
Contributor

The Nuget package Renci.SshNet is available for .NET Framework. However, if you call ListDirectoryAsync on the SftpClient, you will encounter a MethodNotFoundException only at runtime.

@WojciechNagorski WojciechNagorski self-assigned this Oct 13, 2023
@WojciechNagorski WojciechNagorski added this to the vNext milestone Oct 13, 2023
asyncResult.Update(offset);
uploadCallback?.Invoke(offset);
});
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please undo formatting changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -2148,18 +2144,18 @@ public IAsyncResult BeginSynchronizeDirectories(string sourcePath, string destin
var asyncResult = new SftpSynchronizeDirectoriesAsyncResult(asyncCallback, state);

ThreadAbstraction.ExecuteThread(() =>
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please indent block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -2445,20 +2441,20 @@ private void InternalUploadFile(Stream input, string path, Flags flags, SftpUplo
var writtenBytes = offset + (ulong) bytesRead;

_sftpSession.RequestWrite(handle, offset, buffer, offset: 0, bytesRead, wait: null, s =>
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please indent block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -13,6 +13,10 @@
<PackageReference Include="SshNet.Security.Cryptography" Version="[1.3.0]" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make it conditional so that it only applies to TFMs that do not support IAsyncEnumerable<T> out-of-the-box.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your comment, good idea! Done.

@Rob-Hague
Copy link
Collaborator

The Nuget package Renci.SshNet is available for .NET Framework. However, if you call ListDirectoryAsync on the SftpClient, you will encounter a MethodNotFoundException only at runtime.

ListDirectoryAsync is not included in the compilation for .NET Framework. How are you calling it?

@drieseng drieseng merged commit 91d1ed2 into sshnet:develop Oct 14, 2023
@drieseng
Copy link
Member

@Patrick-3000, thanks!

@WojciechNagorski WojciechNagorski removed their assignment Oct 14, 2023
@WojciechNagorski WojciechNagorski modified the milestones: vNext, 2023.0.1 Oct 14, 2023
WojciechNagorski added a commit that referenced this pull request Oct 14, 2023
* Enable list directory async for net framework (#1206)

* Enable ListDirectoryAsync for .NET Framework
* Removed (now) unused constant.

* Remove placeholder tests (#1183)

* Remove placeholder tests

* Move Reverse perf test to benchmarks project

---------

Co-authored-by: Wojciech Nagórski <[email protected]>

* Fix integration test after moving test projects

---------

Co-authored-by: Patrick-3000 <[email protected]>
Co-authored-by: Rob Hague <[email protected]>
@Patrick-3000 Patrick-3000 deleted the enable-list-directory-async-for-net-framework branch November 2, 2023 09:58
@scott-xu
Copy link
Collaborator

scott-xu commented Dec 1, 2023

SSH.NET.nuspec needs to be updated to add dependency Microsoft.Bcl.AsyncInterfaces 7.0.0 when target net462 and netstandard2.0.
Or shall we just use Renci.SshNet.csproj to build the nuget package?
@WojciechNagorski @drieseng

@Rob-Hague
Copy link
Collaborator

Yes, IMO we should remove nuspec and AssemblyInfo and merge them into the csproj

@scott-xu
Copy link
Collaborator

scott-xu commented Dec 2, 2023

Yes, IMO we should remove nuspec and AssemblyInfo and merge them into the csproj

I drafted a new PR #1256

@WojciechNagorski
Copy link
Collaborator

The 2023.0.1 version has been released to Nuget: https://www.nuget.org/packages/SSH.NET/2023.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants