Home Forums .NET libraries Xceed SFTP/FTP for .NET Exception when referencing and closing tracewriter.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #20792 |

    Hi,

    I have playing with Xceed FTP for quite few days now and have encountered a weird problem that arises intermittently. I get a weird exception when I try to reference and close the Ftpclient.TraceWriter object after issuing a FtpClient.Disconnect() command.

    The exception is very generic ‘Object reference not set to an instance of object’ and says that a ‘NullReferenceException’ has occured in System.dll. Also, I am never able to catch this exception even though I have try{}catch{} block around it. Is the handle to the TraceWriter getting GCed ??

    Following is the piece of code that pertains to this issue:

    try
    {
    if(this.ftpClient.Connected)
    {
    this.ftpClient.Disconnect();
    }

    if(this.ftpClient.TraceWriter != null) // EXCEPTION OCCURS WHEN THIS LINE EXECUTES.
    {
    this.ftpClient.TraceWriter.Close();
    }
    }
    catch(Exception ex)
    {
    MessageBox.Show(ex.ToString());
    }

    If anybody has any ideas, or faced a similar situation, please let me know.

    Thanks,
    superman

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by superman (had 3212 views)

    User (Old forums)
    Member
    Post count: 23064

    Also,

    I was testing the sample application ‘ClientFtpCS’ that comes with Xceed Ftp product. I set up a breakpoint in the code as explained below:

    //inside private void MainForm_Closing(object sender, System.ComponentModel.CancelEventArgs e)
    ..
    ..
    ..
    if( !e.Cancel )
    {
    m_asyncFtpClient.TraceWriter.Close(); //SET A BREAKPOINT HERE AND YOU WILL RECEIVE THE SAME EXCEPTION WHEN YOU STEP THROUGH IT.
    m_asyncFtpClient.TraceWriter = null;
    }
    ..
    ..

    So, may be this is a bug in Xceed Ftp. Please correct me if I am wrong.

    Thanks,
    superman

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by superman (had 226 views)

    User (Old forums)
    Member
    Post count: 23064

    The sample works fine here. I suggest that you contact <a href=”mailto:support@xceedsoft.com”>support</a> if you need more help on this issue.

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by André (had 3871 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.