Skip to content

Cannot Open after Dispose #331

Closed
Closed
@bgrainger

Description

@bgrainger

Connector/NET allows the following code:

var connection = new MySqlConnection("connection string");
connection.Open();
connection.Dispose();
connection.Open();

MySqlConnector throws an ObjectDisposedException on the last line.

In practice, this could happen if a MySqlConnection object was captured by a lambda inside a using block, then invoked after the connection is disposed.

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