diff --git a/Dapper/SqlMapper.cs b/Dapper/SqlMapper.cs index f61f89c8b..01b195a2a 100644 --- a/Dapper/SqlMapper.cs +++ b/Dapper/SqlMapper.cs @@ -3716,7 +3716,7 @@ private static void LoadReaderValueOrBranchToDBNullLabel(ILGenerator il, int ind { TypeCode dataTypeCode = Type.GetTypeCode(colType), unboxTypeCode = Type.GetTypeCode(unboxType); bool hasTypeHandler; - if ((hasTypeHandler = typeHandlers.ContainsKey(unboxType)) || colType == unboxType || dataTypeCode == unboxTypeCode || dataTypeCode == Type.GetTypeCode(nullUnderlyingType)) + if ((hasTypeHandler = typeHandlers.ContainsKey(unboxType)) || colType == unboxType || dataTypeCode == (nullUnderlyingType != null ? Type.GetTypeCode(nullUnderlyingType) : unboxTypeCode)) { if (hasTypeHandler) { diff --git a/tests/Dapper.Tests/Providers/MySQLTests.cs b/tests/Dapper.Tests/Providers/MySQLTests.cs index 4b17ff80b..19b6267f5 100644 --- a/tests/Dapper.Tests/Providers/MySQLTests.cs +++ b/tests/Dapper.Tests/Providers/MySQLTests.cs @@ -96,7 +96,7 @@ public void Issue295_NullableDateTime_MySql_ConvertZeroDatetime() } } - [FactMySql(Skip = "See https://github.com/DapperLib/Dapper/issues/295, AllowZeroDateTime=True is not supported")] + [FactMySql] public void Issue295_NullableDateTime_MySql_AllowZeroDatetime() { using (var conn = Provider.GetMySqlConnection(true, false, true)) @@ -105,7 +105,7 @@ public void Issue295_NullableDateTime_MySql_AllowZeroDatetime() } } - [FactMySql(Skip = "See https://github.com/DapperLib/Dapper/issues/295, AllowZeroDateTime=True is not supported")] + [FactMySql] public void Issue295_NullableDateTime_MySql_ConvertAllowZeroDatetime() { using (var conn = Provider.GetMySqlConnection(true, true, true))