Thanks to visit codestin.com
Credit goes to github.com

Skip to content

TNEmulator.Refresh throws NullReferenceException when constructing a different exception #23

@sgbench

Description

@sgbench

Location in source:

throw new TNHostException("The TN3270 connection was lost", this.currentConnection.DisconnectReason, null);

Specifically, this.currentConnection is sometimes null when this line of code is executed.

I believe this can be fixed by changing this.currentConnection.DisconnectReason to this.DisconnectReason, which checks this.currentConnection for null.

Context: We're using Open3270 to automate a third-party terminal that sometimes experiences long response times. We need a way to interrupt Open3270 when this happens. We'd like the interruption to be immediate and graceful, if possible. Currently we interrupt the wait by calling TNEmulator.Close from a different thread. However, this causes the above line of code to be executed when this.currentConnection is null, masking the intended TNHostException.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions