0 votes
by (160 points)

I have installed Rebex.SFTP nuget to Xamarin.Android,Xamarin.ios,xamarin.UWP platforms .Able to connect to SFTP and dowmload and upload in all 3 platforms.
But,In release mode it is working in android and ios but not UWP.
Getting above exception and also getting
"System.PlatformNotSupportedException"Skipped loading symbols. Module is native, and native debugging is currently disabled.
imp#31232(...) returned null.

Anyone please help me

Applies to: Rebex SFTP

1 Answer

0 votes
by (146k points)
Could you please describe the steps that trigger the error? Are you actually trying to launch an UWP app, compiled in release mode, in a debugger? Or did this occur when you attempted some other action?
by (160 points)
Hi Lukas
I am trying to launch UWP app in release mode.
After launching app when I am trying to connect to SFTP I am facing the iisue
by (146k points)
How exactly are you launching the app? Which version of Visual Studio do you use?

Try launching the app from Visual Studio via "Debug->Start Without Debugging" in the menu (usually bound to Ctrl+F5 keyboard shortcut). Does that make any difference?
by (160 points)
I am using VS2022 vesion 17.5.5
With "Debug->Start Without Debugging" doesn't make any difference

I am getting below error in output window


MCG : warning MCG0007: Unresolved P/Invoke method 'libc!readlink' for method 'System.IntPtr dgrob.ezyvt.readlink(System.IntPtr, System.IntPtr, System.IntPtr)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
by (146k points)
This is actually a warning, not an error. It's a well-known issue on the UWP platform when using the .NET Native toolchain, but it does not prevent the app from launching and working.

Does the app indeed fail to start without debugging? Are there any other messages in the output window related to that?
by (160 points)
'App1.UWP.exe' (Win32): Loaded 'C:\Windows\System32\directmanipulation.dll'. Skipped loading symbols. Module is native, and native debugging is currently disabled.
'App1.UWP.exe' (Win32): Loaded 'C:\Windows\System32\threadpoolwinrt.dll'. Skipped loading symbols. Module is native, and native debugging is currently disabled.
'App1.UWP.exe' (Win32): Loaded 'C:\Windows\System32\WindowsCodecs.dll'. Skipped loading symbols. Module is native, and native debugging is currently disabled.
'App1.UWP.exe' (Win32): Loaded 'C:\Windows\System32\wuceffects.dll'. Skipped loading symbols. Module is native, and native debugging is currently disabled.
'App1.UWP.exe' (Win32): Loaded 'C:\Windows\System32\xmllite.dll'. Skipped loading symbols. Module is native, and native debugging is currently disabled.
'App1.UWP.exe' (Win32): Loaded 'C:\Windows\System32\userenv.dll'. Skipped loading symbols. Module is native, and native debugging is currently disabled.
'App1.UWP.exe' (Win32): Loaded 'C:\Windows\System32\profext.dll'. Skipped loading symbols. Module is native, and native debugging is currently disabled.
'App1.UWP.exe' (Win32): Loaded 'C:\Windows\System32\ninput.dll'. Skipped loading symbols. Module is native, and native debugging is currently disabled.
Exception thrown: 'System.ArgumentException' in System.Private.CoreLib.dll
Exception thrown: 'System.PlatformNotSupportedException' in System.Private.CoreLib.dll
Exception thrown: 'dgrob.vcnsk' in Rebex.Common.dll
Exception thrown: 'Rebex.Net.SftpException' in Rebex.Sftp.dll
Your trial version is too old. Please contact support@rebex.net to get a suitable trial key.
by (160 points)
Rebex.Castle.dll'. PDB file was not present when IL code was compiled to native.
(CLR Native Compilation v1.0): Loaded 'Rebex.Common.dll'. PDB file was not present when IL code was compiled to native.
 (CLR Native Compilation v1.0): Loaded 'Rebex.Curve25519.dll'. PDB file was not present when IL code was compiled to native.
(CLR Native Compilation v1.0): Loaded 'Rebex.Ed25519.dll'. PDB file was not present when IL code was compiled to native.
 (CLR Native Compilation v1.0): Loaded 'Rebex.Networking.dll'. PDB file was not present when IL code was compiled to native.
(CLR Native Compilation v1.0): Loaded 'Rebex.Sftp.dll'. PDB file was not present when IL code was compiled to native.
by (160 points)
Lukas, Please find the attached errors in output window
by (146k points)
This actually looks like a licensing issue - the trial version you are trying to use is outdated:

    Exception thrown: 'System.ArgumentException' in System.Private.CoreLib.dll
    Exception thrown: 'System.PlatformNotSupportedException' in System.Private.CoreLib.dll
    Exception thrown: 'dgrob.vcnsk' in Rebex.Common.dll
    Exception thrown: 'Rebex.Net.SftpException' in Rebex.Sftp.dll
    Your trial version is too old. Please contact support@rebex.net to get a suitable trial key.

Please upgrade to Rebex SFTP v7.0.8865 and try again.

Alternatively, if you have to use an outdated version for some reason, use the following trial key:
    Rebex.Licensing.Key = "==AQcoI6zGDiPBMNB6eKbaX0fCUdiup7wcE5bc7+ABBg0k==";
by (160 points)
App1.UWP.exe' (Win32): Loaded 'C:\Windows\System32\wshbth.dll'. Skipped loading symbols. Module is native, and native debugging is currently disabled.
'App1.UWP.exe' (Win32): Loaded 'C:\Windows\System32\mswsock.dll'. Skipped loading symbols. Module is native, and native debugging is currently disabled.
'App1.UWP.exe' (Win32): Loaded 'C:\Windows\System32\dnsapi.dll'. Skipped loading symbols. Module is native, and native debugging is currently disabled.
'App1.UWP.exe' (Win32): Loaded 'C:\Windows\System32\nsi.dll'. Skipped loading symbols. Module is native, and native debugging is currently disabled.
'App1.UWP.exe' (Win32): Loaded 'C:\Windows\System32\winrnr.dll'. Skipped loading symbols. Module is native, and native debugging is currently disabled.
Exception thrown: 'System.PlatformNotSupportedException' in System.Private.CoreLib.dll
Exception thrown: 'System.PlatformNotSupportedException' in System.Private.CoreLib.dll
'App1.UWP.exe' (Win32): Loaded 'C:\Windows\System32\cryptsp.dll'. Skipped loading symbols. Module is native, and native debugging is currently disabled.
'App1.UWP.exe' (Win32): Loaded 'C:\Windows\System32\dssenh.dll'. Skipped loading symbols. Module is native, and native debugging is currently disabled.
**__imp__#31142**(...) returned null.

Exception thrown: 'Rebex.Net.SshException' in Rebex.Networking.dll
Exception thrown: 'Rebex.Net.SshException' in Rebex.Sftp.dll
Exception thrown: 'Rebex.Net.SftpException' in Rebex.Sftp.dll
The thread 0x8880 has exited with code 0 (0x0).
Negotiation failed.
by (160 points)
I have changed licence key and updated Rebex.SFTP to  v7.0.8865  still facing issue

 try
                {
                    using (var client = new Rebex.Net.Sftp())
                    {
                        AsymmetricKeyAlgorithm.Register(EllipticCurveAlgorithm.Create);
                        // register Curve25519
                        AsymmetricKeyAlgorithm.Register(Curve25519.Create);
                        // register Ed25519
                        AsymmetricKeyAlgorithm.Register(Rebex.Security.Cryptography.Ed25519.Create);
                        client.Connect(host, port);
                        client.Login(user, pass);
                    Trace.WriteLine("Connected successfully");
                        if (!client.DirectoryExists(path))
                            ok = false;

                        client.Disconnect();
                    }
                }
by (146k points)
The error indicates that Rebex SFTP was actually able to connect to the server, but failed while negotiating an SSH session. However, we would need more information about the error to be able to tell what is going on. This exception you got is supposed to contain an InnerException with additional information. Try putting the client.Connect call inside a try/catch block and show the full error, like this:

                try
                {
                    using (var client = new Rebex.Net.Sftp())
                    {
                        ...
                        client.Connect(host, port);
                        client.Login(user, pass);
                        Trace.WriteLine("Connected successfully");
                        ...
                    }
                }
                catch (Rebex.Net.NetworkSessionException ex)
                {
                    Trace.WriteLine("SFTP error: " + ex.ToString())
                }
by (160 points)
Hi Lukas,
The issue is with KeyAlgorithms.
After removing KeyAlgorithms it worked.

AsymmetricKeyAlgorithm.Register(EllipticCurveAlgorithm.Create);
                        // register Curve25519
                        AsymmetricKeyAlgorithm.Register(Curve25519.Create);
                        // register Ed25519
                        AsymmetricKeyAlgorithm.Register(Rebex.Security.Cryptography.Ed25519.Create

I removed the above lines in UWP project then it worked
by (146k points)
Hi, thanks for letting us know!
It looks like the plugins might not be compatible with UWP's .NET Native compiler (used in release mode). Fortunately, these plugins are not actually needed on UWP, so keeping them for iOS and Android hopefully resolves the issue.
...