Filtering on a DateTimeOffset column throws exception

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
Posts: 1
Joined: Fri 10 Jun 2022 13:08

Filtering on a DateTimeOffset column throws exception

Post by skylight0514 » Fri 10 Jun 2022 13:52

Hello folks,

using the latest version when filtering on a DateTimeOffset column (MSSQL) doesn't work and throws the following exception:

Code: Select all

System.NotSupportedException: The method is not supported with specified arguments.
   bei Devart.Data.Linq.Engine.DbMethodCallConverter.a(List`1 A_0, List`1 A_1, List`1 A_2, Type A_3, Object A_4)
   bei Devart.Data.Linq.Engine.DbMethodCallConverter.c(SqlBinary A_0)
   bei Devart.Data.Linq.Engine.DbMethodCallConverter.b(c4 A_0)
   bei Devart.Data.Linq.Engine.SqlVisitor.Visit(SqlNode node)
   bei Devart.Data.Linq.Engine.SqlVisitor.g(SqlExpression A_0)
   bei Devart.Data.Linq.Engine.SqlVisitor.h(SqlSelect A_0)
   bei Devart.Data.Linq.Engine.DbMethodCallConverter.e(SqlSelect A_0)
   bei Devart.Data.Linq.Engine.SqlVisitor.c(h A_0)
   bei Devart.Data.Linq.Engine.DbMethodCallConverter.a(h A_0)
   bei Devart.Data.Linq.Engine.SqlVisitor.Visit(SqlNode node)
   bei A_0, ResultShape& A_1)
   bei A_0)
   bei A_0)
   bei Devart.Data.Linq.DataProvider.a(Expression A_0)
   bei Devart.Data.Linq.Engine.DataQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
   bei System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   bei System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   bei Program.Main()
You can reproduce it with the following code:

Code: Select all

using Devart.Data.Linq;
using Devart.Data.Linq.Mapping;
using Devart.Data.SqlServer.Linq.Provider;
using System;
using System.Data;
using System.Data.SqlClient;
using System.Linq;

internal class Program
	class SqlDataContext : DataContext
		public SqlDataContext(IDbConnection connection) : base(connection)

	class QueryTypeDateTimeOffset
		public DateTimeOffset DateTimeOffset { get; set; }

	static void Main()
		SqlConnectionStringBuilder connectionStringBuilder = new SqlConnectionStringBuilder()
			DataSource = @"(LocalDB)\MSSQLLocalDB",
			IntegratedSecurity = true,

		SqlConnection connection = new SqlConnection(connectionStringBuilder.ToString());

		SqlDataContext dataContext = new SqlDataContext(connection);

		string query = @"SELECT DATEADD(DAY, -1, SYSDATETIMEOFFSET()) AS DateTimeOffset

		var queryable = dataContext.Query<QueryTypeDateTimeOffset>(query);

		var result = queryable
			.Where(row => row.DateTimeOffset >= DateTimeOffset.Now)
This there any chance that you can fix this in a future version?


Post Reply