Skip to content

Bug: A 'NullReferenceException' Is Thrown for NULL Query Expression #600

@mikependon

Description

@mikependon

As reported by the user, a NullReferenceException is thrown if the Query Expression is equate to a NULL values.

connection.Query<Person>(e => e.Name == null);

It has happened on the latest compiler, in which such basic scenario is apparently not covered by the Integration Tests. We have added the below's Integration Test.

[TestMethod]
public void TestSqlConnectionQueryAsyncViaExpressionWithNullValue()
{
    // Setup
    var tables = Helper.CreateIdentityTables(10);
    var last = tables.Last();

    using (var connection = new SqlConnection(Database.ConnectionStringForRepoDb))
    {
        // Act
        connection.InsertAll(tables);

        // Act
        var result = connection.QueryAsync<IdentityTable>(c => c.ColumnNVarChar == null).Result;

        // Assert
        Assert.AreEqual(0, result.Count());
    }
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdeployedFeature or bug is deployed at the current releasefixedThe bug, issue, incident has been fixed.priorityTop priority feature or things to dotodoThings to be done in the future

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions