#2187·Dapper

Nullable input parameter not supplied when NULL

Author: ChristofColle-VIVESCreated Jan 8, 2026Updated Aug 18, 2026
Labelsbugneeds-triage

Using Dapper 2.1.66 in a C# dotnet10 solution, connecting to a Dataverse database (TDS)...

My code is :

var queryParams = new
{
	FirstName = person.FirstName,
	LastName = person.LastName,
	Email = person.Email,
	AccountId = request.CompanyId
};

var contactId = await sqlConnection.QueryFirstOrDefaultAsync<Guid?>(Data.Queries.FindContactsForRegistration, queryParams);

The first 3 parameters are non-nullable strings. The fourth parameter is a nullable GUID (uniqueidentifier).

My error output is : The parameterized query '(@FirstName nvarchar(200),@LastName nvarchar(200),@Email nvarcha' expects the parameter '@AccountId', which was not supplied.

It suggests Dapper isn't providing the @AccountId parameter to the query, when its value is NULL.