Skip to content

Bug: Querying by string field fails in VB .Net #767

@Trobeloo

Description

@Trobeloo

Bug Description

The following line raise Object reference Not Set To an instance Of an Object.
Dim myInvoice = Connection.Query(Of Factures)(Function(f) f.Country = "France").First

This line is working ok:
Dim myInvoice = Connection.Query(Of Factures)(Function(f) f.Id_Facture = 13624).First

Exception Message:

   '        System.NullReferenceException
        '        HResult = 0x80004003
        '  Message = Object reference Not Set To an instance Of an Object.
        '  Source = RepoDb
        'StackTrace:
        '        at RepoDb.QueryGroup.<> c__DisplayClass61_0.<GetFields>b__0(QueryGroup queryGroup)
        '   at RepoDb.QueryGroup.<> c__DisplayClass61_0.<GetFields>b__0(QueryGroup queryGroup)
        '   at RepoDb.QueryGroup.GetFields(Boolean traverse)
        '   at RepoDb.QueryGroup.Fix()
        '   at RepoDb.QueryGroup.Parse[TEntity](Expression`1 expression)
        '   at RepoDb.DbConnectionExtension.ToQueryGroup[TEntity](Expression`1 where)
        '   at RepoDb.DbConnectionExtension.Query[TEntity](IDbConnection connection, Expression`1 where, IEnumerable`1 fields, IEnumerable`1 orderBy, Nullable`1 top, String hints, String cacheKey, Nullable`1 cacheItemExpiration, Nullable`1 commandTimeout, IDbTransaction transaction, ICache cache, ITrace trace, IStatementBuilder statementBuilder)
        '   at TestRepoDB.Module1.Main() in D: \Data\TestRepoDB\TestRepoDB\Module1.vb:line 17

Schema and Model:

CREATE TABLE [dbo].[Factures](
[Id_Facture] [int] NOT NULL,
[Country] varchar NULL,
CONSTRAINT [PK_Factures] PRIMARY KEY CLUSTERED

And also the model that corresponds the schema.

Public Class Factures
    Public Property Id_Facture() As Integer
    Public Property Country() As String
    Public Property Company_Num_Compta As Integer
End Class

Library Version:

RepoDb v1.12.8 and RepoDb.SqlServer v1.1.3

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdeployedFeature or bug is deployed at the current releasefixedThe bug, issue, incident has been fixed.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions