Not able to catch exceptions

Advertisement

plasmax
Joined:
Posts:
2
Location:
Ontario

Not able to catch exceptions

I'm having a really weird issue with not being able to trap exceptions, specifically with PutFiles() in vb.net. I have my application working but when their is an error thrown by transferOperationResult.Check() it procedes to the catch block but when i try and display the error with the following code, it errors out again.
 Try
        transferResult = session.PutFiles(fileToSync, sp.RemotePath, False, transferOps)
        transferResult.Check()
  Catch ex As Exception
          If m_logginglevel > 1 Then
          WriteToEngineLog(MessageType.Information, "Error performing transfer: " & ex.message)

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,034
Location:
Prague, Czechia

Re: Not able to catch exceptions

Well, this looks like VB.NET, not WinSCP question.
Consider asking it on Stack Overflow instead.
In any case, we/they will need to know more details (minimal reproducible example).

Reply with quote

plasmax
Joined:
Posts:
2
Location:
Ontario

Re: Not able to catch exceptions

martin wrote:

Well, this looks like VB.NET, not WinSCP question.
Consider asking it on Stack Overflow instead.
In any case, we/they will need to know more details (minimal reproducible example).

All other errors in the application are trapped and displayed successfully. It is only when an exception is thrown by WinSCP functions that this happens. The application i'm developing is a Windows Service VB.NET application using .NET 4.6.1. The error I am testing with is an invalid path on the remotepath for putfiles(). The exception is thrown after i call transferResult.Check() but the exception object is coming through as null. I just created a windows forms app to test the same scenario and it works as it should with the exception object being populated. I will put this on StackOverflow if I can't get an answer here, but I thought that someone else using WinSCP may have encountered this a well.

Reply with quote

Advertisement

You can post new topics in this forum