FastExpressionCompiler icon indicating copy to clipboard operation
FastExpressionCompiler copied to clipboard

Errors in Linq2db

Open jogibear9988 opened this issue 4 years ago • 20 comments
trafficstars

jogibear9988 avatar Dec 11 '20 19:12 jogibear9988

Error: InvalidProgramException Test: SelectTests.OuterApplyTest("PostgreSQL")

CSharpCode:

(Func<IQueryRunner, IDataReader, f__AnonymousType593<Parent, Child, bool, f__AnonymousType508<int, int>, f__AnonymousType508<int, int>, object[], Dictionary<int, Nullable<int>>, Dictionary<string, Nullable<int>>>>)(
	IQueryRunner qr, 
	IDataReader dr) => 
	new Func<IQueryRunner, IDataContext, IDataReader, Expression, object[], object[], f__AnonymousType593<Parent, Child, bool, f__AnonymousType508<int, int>, f__AnonymousType508<int, int>, object[], Dictionary<int, Nullable<int>>, Dictionary<string, Nullable<int>>>>(
		(Func<IQueryRunner, IDataContext, IDataReader, Expression, object[], object[], f__AnonymousType593<Parent, Child, bool, f__AnonymousType508<int, int>, f__AnonymousType508<int, int>, object[], Dictionary<int, Nullable<int>>, Dictionary<string, Nullable<int>>>>)(
			IQueryRunner qr, 
			IDataContext dctx, 
			IDataReader rd, 
			Expression expr, 
			object[] ps, 
			object[] preamble) => 
		{
			NpgsqlDefaultDataReader ldr;
			Parent Parent1;
			Child Child2;
			f__AnonymousType508<int, int> f__anonymoustype508_int, int___56038817;
			f__AnonymousType508<int, int> f__anonymoustype508_int, int___20021619;
			object[] Object[]5;
			Dictionary<int, Nullable<int>> Dictionary`26;
			Dictionary<string, Nullable<int>> Dictionary`27;
			f__AnonymousType593<Parent, Child, bool, f__AnonymousType508<int, int>, f__AnonymousType508<int, int>, object[], Dictionary<int, Nullable<int>>, Dictionary<string, Nullable<int>>> f__anonymoustype593_parent, child, bool, f__anonymoustype508_int, int_, f__anonymoustype508_int, int_, object_arr, dictionary_int, nullable_int__, dictionary_string, nullable_int_____7609730;
			ldr = ((NpgsqlDefaultDataReader)dr);
			Parent1 = ((Parent)TableBuilder.TableContext.OnEntityCreated(
				dctx,
				new Parent()
				 { 
						ParentID = ldr.IsDBNull((int)0) ?
						(int)0 :
						ldr.GetInt32((int)0),
						Value1 = ldr.IsDBNull((int)1) ?
						null :
						new Nullable<int>(ldr.GetInt32((int)1)),
				}));
			Child2 = rd.IsDBNull((int)2) ?
				null :
				((Child)TableBuilder.TableContext.OnEntityCreated(
					dctx,
					new Child()
					 { 
							ParentID = ldr.IsDBNull((int)2) ?
							(int)0 :
							ldr.GetInt32((int)2),
							ChildID = ldr.IsDBNull((int)3) ?
							(int)0 :
							ldr.GetInt32((int)3),
					}));
			f__anonymoustype508_int, int___56038817 = new f__AnonymousType508<int, int>(
				ldr.IsDBNull((int)10) ?
					(int)0 :
					ldr.GetInt32((int)10),
				ldr.IsDBNull((int)11) ?
					(int)0 :
					ldr.GetInt32((int)11));
			f__anonymoustype508_int, int___20021619 = new f__AnonymousType508<int, int>(
				ldr.IsDBNull((int)12) ?
					(int)0 :
					ldr.GetInt32((int)12),
				ldr.IsDBNull((int)13) ?
					(int)0 :
					ldr.GetInt32((int)13));
			Object[]5 = new object[] {
				((object)ldr.IsDBNull((int)14) ?
					(int)0 :
					ldr.GetInt32((int)14)),
				((object)ldr.IsDBNull((int)15) ?
					(int)0 :
					ldr.GetInt32((int)15))};
			Dictionary`26 = new Dictionary<int, Nullable<int>>()
			 { 
				(ldr.IsDBNull((int)16) ?
					(int)0 :
					ldr.GetInt32((int)16), ((Nullable<int>)ldr.IsDBNull((int)17) ?
					null :
					new Nullable<int>(ldr.GetInt32((int)17))))
			};
			Dictionary`27 = new Dictionary<string, Nullable<int>>()
			 { 
				("ChildID", ((Nullable<int>)ldr.IsDBNull((int)18) ?
					null :
					new Nullable<int>(ldr.GetInt32((int)18)))), 
				("ParentID", ((Nullable<int>)ldr.IsDBNull((int)19) ?
					null :
					new Nullable<int>(ldr.GetInt32((int)19))))
			};
			f__anonymoustype593_parent, child, bool, f__anonymoustype508_int, int_, f__anonymoustype508_int, int_, object_arr, dictionary_int, nullable_int__, dictionary_string, nullable_int_____7609730 = new f__AnonymousType593<Parent, Child, bool, f__AnonymousType508<int, int>, f__AnonymousType508<int, int>, object[], Dictionary<int, Nullable<int>>, Dictionary<string, Nullable<int>>>(
				Parent1,
				rd.IsDBNull((int)2) ?
					null :
					Child2,
				ldr.IsDBNull((int)9) ?
					false :
					ldr.GetBoolean((int)9),
				rd.IsDBNull((int)10) ?
					null :
					f__anonymoustype508_int, int___56038817,
				rd.IsDBNull((int)12) ?
					null :
					f__anonymoustype508_int, int___20021619,
				rd.IsDBNull((int)14) ?
					null :
					Object[]5,
				rd.IsDBNull((int)16) ?
					null :
					Dictionary`26,
				rd.IsDBNull((int)18) ?
					null :
					Dictionary`27);
			return f__anonymoustype593_parent, child, bool, f__anonymoustype508_int, int_, f__anonymoustype508_int, int_, object_arr, dictionary_int, nullable_int__, dictionary_string, nullable_int_____7609730;
		})).Invoke(
		qr,
		qr.DataContext,
		dr,
		qr.Expression,
		qr.Parameters,
		qr.Preambles);

ExpressionString:

var p = new ParameterExpression[17]; // the parameter expressions 
var e = new Expression[159]; // the unique expressions 
var l = new LabelTarget[0]; // the labels 
var expr = Lambda( // $
  typeof(System.Func<LinqToDB.Linq.IQueryRunner, System.Data.IDataReader, f__AnonymousType593<Tests.Model.Parent, Tests.Model.Child, bool, f__AnonymousType508<int, int>, f__AnonymousType508<int, int>, object[], System.Collections.Generic.Dictionary<int, System.Nullable<int>>, System.Collections.Generic.Dictionary<string, System.Nullable<int>>>>),
  e[0]=Invoke(
	e[1]=Lambda( // $
	  typeof(System.Func<LinqToDB.Linq.IQueryRunner, LinqToDB.IDataContext, System.Data.IDataReader, System.Linq.Expressions.Expression, object[], object[], f__AnonymousType593<Tests.Model.Parent, Tests.Model.Child, bool, f__AnonymousType508<int, int>, f__AnonymousType508<int, int>, object[], System.Collections.Generic.Dictionary<int, System.Nullable<int>>, System.Collections.Generic.Dictionary<string, System.Nullable<int>>>>),
	  e[2]=Block(
		typeof(f__AnonymousType593<Tests.Model.Parent, Tests.Model.Child, bool, f__AnonymousType508<int, int>, f__AnonymousType508<int, int>, object[], System.Collections.Generic.Dictionary<int, System.Nullable<int>>, System.Collections.Generic.Dictionary<string, System.Nullable<int>>>),
		new[] {
		p[0]=Parameter(typeof(Npgsql.NpgsqlDefaultDataReader), "ldr"),
		p[1]=Parameter(typeof(Tests.Model.Parent), "Parent1"),
		p[2]=Parameter(typeof(Tests.Model.Child), "Child2"),
		p[3]=Parameter(typeof(f__AnonymousType508<int, int>)),
		p[4]=Parameter(typeof(f__AnonymousType508<int, int>)),
		p[5]=Parameter(typeof(object[]), "Object[]5"),
		p[6]=Parameter(typeof(System.Collections.Generic.Dictionary<int, System.Nullable<int>>), "Dictionary`26"),
		p[7]=Parameter(typeof(System.Collections.Generic.Dictionary<string, System.Nullable<int>>), "Dictionary`27"),
		p[8]=Parameter(typeof(f__AnonymousType593<Tests.Model.Parent, Tests.Model.Child, bool, f__AnonymousType508<int, int>, f__AnonymousType508<int, int>, object[], System.Collections.Generic.Dictionary<int, System.Nullable<int>>, System.Collections.Generic.Dictionary<string, System.Nullable<int>>>))
		},
		e[3]=MakeBinary(ExpressionType.Assign,
		  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
			],
		  e[4]=Convert(
			p[9]=Parameter(typeof(System.Data.IDataReader), "dr"),
			typeof(Npgsql.NpgsqlDefaultDataReader))), 
		e[5]=MakeBinary(ExpressionType.Assign,
		  p[1 // (Tests.Model.Parent Parent1)
			],
		  e[6]=Convert(
			e[7]=Call(
			  null, 
			  typeof(LinqToDB.Linq.Builder.TableBuilder.TableContext).GetMethods(BindingFlags.NonPublic|BindingFlags.Static).Single(x => !x.IsGenericMethod && x.Name == "OnEntityCreated" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(LinqToDB.IDataContext), typeof(object) })),
			  p[10]=Parameter(typeof(LinqToDB.IDataContext), "dctx"), 
			  e[8]=MemberInit((NewExpression)(
				e[9]=New(/*0 args*/
				  typeof(Tests.Model.Parent).GetTypeInfo().DeclaredConstructors.ToArray()[0], new Expression[0])), 
				Bind(
				  typeof(Tests.Model.Parent).GetTypeInfo().GetDeclaredField("ParentID"), 
				  e[10]=Condition(
					e[11]=Call(
					  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
						], 
					  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
					  e[12]=Constant((int)0)),
					e[13]=Constant((int)0),
					e[14]=Call(
					  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
						], 
					  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetInt32" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
					  e[15]=Constant((int)0)),
					typeof(int))), 
				Bind(
				  typeof(Tests.Model.Parent).GetTypeInfo().GetDeclaredField("Value1"), 
				  e[16]=Condition(
					e[17]=Call(
					  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
						], 
					  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
					  e[18]=Constant((int)1)),
					e[19]=Constant(null, typeof(System.Nullable<int>)),
					e[20]=New(/*1 args*/
					  typeof(System.Nullable<int>).GetTypeInfo().DeclaredConstructors.ToArray()[0],
					  e[21]=Call(
						p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
						  ], 
						typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetInt32" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
						e[22]=Constant((int)1))),
					typeof(System.Nullable<int>))))),
			typeof(Tests.Model.Parent))), 
		e[23]=MakeBinary(ExpressionType.Assign,
		  p[2 // (Tests.Model.Child Child2)
			],
		  e[24]=Condition(
			e[25]=Call(
			  p[11]=Parameter(typeof(System.Data.IDataReader), "rd"), 
			  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
			  e[26]=Constant((int)2)),
			e[27]=Constant(null, typeof(Tests.Model.Child)),
			e[28]=Convert(
			  e[29]=Call(
				null, 
				typeof(LinqToDB.Linq.Builder.TableBuilder.TableContext).GetMethods(BindingFlags.NonPublic|BindingFlags.Static).Single(x => !x.IsGenericMethod && x.Name == "OnEntityCreated" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(LinqToDB.IDataContext), typeof(object) })),
				p[10 // (LinqToDB.IDataContext dctx)
				  ], 
				e[30]=MemberInit((NewExpression)(
				  e[31]=New(/*0 args*/
					typeof(Tests.Model.Child).GetTypeInfo().DeclaredConstructors.ToArray()[0], new Expression[0])), 
				  Bind(
					typeof(Tests.Model.Child).GetTypeInfo().GetDeclaredField("ParentID"), 
					e[32]=Condition(
					  e[33]=Call(
						p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
						  ], 
						typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
						e[34]=Constant((int)2)),
					  e[35]=Constant((int)0),
					  e[36]=Call(
						p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
						  ], 
						typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetInt32" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
						e[37]=Constant((int)2)),
					  typeof(int))), 
				  Bind(
					typeof(Tests.Model.Child).GetTypeInfo().GetDeclaredField("ChildID"), 
					e[38]=Condition(
					  e[39]=Call(
						p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
						  ], 
						typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
						e[40]=Constant((int)3)),
					  e[41]=Constant((int)0),
					  e[42]=Call(
						p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
						  ], 
						typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetInt32" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
						e[43]=Constant((int)3)),
					  typeof(int))))),
			  typeof(Tests.Model.Child)),
			typeof(Tests.Model.Child))), 
		e[44]=MakeBinary(ExpressionType.Assign,
		  p[3 // (f__AnonymousType508<int, int> f__anonymoustype508_int, int___56038817)
			],
		  e[45]=New(/*2 args*/
			typeof(f__AnonymousType508<int, int>).GetTypeInfo().DeclaredConstructors.ToArray()[0],
			e[46]=Condition(
			  e[47]=Call(
				p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
				  ], 
				typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				e[48]=Constant((int)10)),
			  e[49]=Constant((int)0),
			  e[50]=Call(
				p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
				  ], 
				typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetInt32" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				e[51]=Constant((int)10)),
			  typeof(int)), 
			e[52]=Condition(
			  e[53]=Call(
				p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
				  ], 
				typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				e[54]=Constant((int)11)),
			  e[55]=Constant((int)0),
			  e[56]=Call(
				p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
				  ], 
				typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetInt32" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				e[57]=Constant((int)11)),
			  typeof(int)))), 
		e[58]=MakeBinary(ExpressionType.Assign,
		  p[4 // (f__AnonymousType508<int, int> f__anonymoustype508_int, int___20021619)
			],
		  e[59]=New(/*2 args*/
			typeof(f__AnonymousType508<int, int>).GetTypeInfo().DeclaredConstructors.ToArray()[0],
			e[60]=Condition(
			  e[61]=Call(
				p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
				  ], 
				typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				e[62]=Constant((int)12)),
			  e[63]=Constant((int)0),
			  e[64]=Call(
				p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
				  ], 
				typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetInt32" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				e[65]=Constant((int)12)),
			  typeof(int)), 
			e[66]=Condition(
			  e[67]=Call(
				p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
				  ], 
				typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				e[68]=Constant((int)13)),
			  e[69]=Constant((int)0),
			  e[70]=Call(
				p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
				  ], 
				typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetInt32" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				e[71]=Constant((int)13)),
			  typeof(int)))), 
		e[72]=MakeBinary(ExpressionType.Assign,
		  p[5 // (object[] Object[]5)
			],
		  e[73]=NewArrayInit(
			typeof(object), 
			e[74]=Convert(
			  e[75]=Condition(
				e[76]=Call(
				  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
					], 
				  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				  e[77]=Constant((int)14)),
				e[78]=Constant((int)0),
				e[79]=Call(
				  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
					], 
				  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetInt32" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				  e[80]=Constant((int)14)),
				typeof(int)),
			  typeof(object)), 
			e[81]=Convert(
			  e[82]=Condition(
				e[83]=Call(
				  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
					], 
				  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				  e[84]=Constant((int)15)),
				e[85]=Constant((int)0),
				e[86]=Call(
				  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
					], 
				  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetInt32" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				  e[87]=Constant((int)15)),
				typeof(int)),
			  typeof(object)))), 
		e[88]=MakeBinary(ExpressionType.Assign,
		  p[6 // (System.Collections.Generic.Dictionary<int, System.Nullable<int>> Dictionary`26)
			],
		  e[89]=ListInit((NewExpression)(
			e[90]=New(/*0 args*/
			  typeof(System.Collections.Generic.Dictionary<int, System.Nullable<int>>).GetTypeInfo().DeclaredConstructors.ToArray()[0], new Expression[0])), 
			ElementInit(
			typeof(System.Collections.Generic.Dictionary<int, System.Nullable<int>>).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "Add" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int), typeof(System.Nullable<int>) })), 
			e[91]=Condition(
			  e[92]=Call(
				p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
				  ], 
				typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				e[93]=Constant((int)16)),
			  e[94]=Constant((int)0),
			  e[95]=Call(
				p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
				  ], 
				typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetInt32" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				e[96]=Constant((int)16)),
			  typeof(int)), 
			e[97]=Convert(
			  e[98]=Condition(
				e[99]=Call(
				  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
					], 
				  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				  e[100]=Constant((int)17)),
				e[101]=Constant(null, typeof(System.Nullable<int>)),
				e[102]=New(/*1 args*/
				  typeof(System.Nullable<int>).GetTypeInfo().DeclaredConstructors.ToArray()[0],
				  e[103]=Call(
					p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
					  ], 
					typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetInt32" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
					e[104]=Constant((int)17))),
				typeof(System.Nullable<int>)),
			  typeof(System.Nullable<int>))))), 
		e[105]=MakeBinary(ExpressionType.Assign,
		  p[7 // (System.Collections.Generic.Dictionary<string, System.Nullable<int>> Dictionary`27)
			],
		  e[106]=ListInit((NewExpression)(
			e[107]=New(/*0 args*/
			  typeof(System.Collections.Generic.Dictionary<string, System.Nullable<int>>).GetTypeInfo().DeclaredConstructors.ToArray()[0], new Expression[0])), 
			ElementInit(
			typeof(System.Collections.Generic.Dictionary<string, System.Nullable<int>>).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "Add" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(string), typeof(System.Nullable<int>) })), 
			e[108]=Constant("ChildID"), 
			e[109]=Convert(
			  e[110]=Condition(
				e[111]=Call(
				  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
					], 
				  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				  e[112]=Constant((int)18)),
				e[113]=Constant(null, typeof(System.Nullable<int>)),
				e[114]=New(/*1 args*/
				  typeof(System.Nullable<int>).GetTypeInfo().DeclaredConstructors.ToArray()[0],
				  e[115]=Call(
					p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
					  ], 
					typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetInt32" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
					e[116]=Constant((int)18))),
				typeof(System.Nullable<int>)),
			  typeof(System.Nullable<int>))), 
			ElementInit(
			typeof(System.Collections.Generic.Dictionary<string, System.Nullable<int>>).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "Add" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(string), typeof(System.Nullable<int>) })), 
			e[117]=Constant("ParentID"), 
			e[118]=Convert(
			  e[119]=Condition(
				e[120]=Call(
				  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
					], 
				  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				  e[121]=Constant((int)19)),
				e[122]=Constant(null, typeof(System.Nullable<int>)),
				e[123]=New(/*1 args*/
				  typeof(System.Nullable<int>).GetTypeInfo().DeclaredConstructors.ToArray()[0],
				  e[124]=Call(
					p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
					  ], 
					typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetInt32" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
					e[125]=Constant((int)19))),
				typeof(System.Nullable<int>)),
			  typeof(System.Nullable<int>))))), 
		e[126]=MakeBinary(ExpressionType.Assign,
		  p[8 // (f__AnonymousType593<Tests.Model.Parent, Tests.Model.Child, bool, f__AnonymousType508<int, int>, f__AnonymousType508<int, int>, object[], System.Collections.Generic.Dictionary<int, System.Nullable<int>>, System.Collections.Generic.Dictionary<string, System.Nullable<int>>> f__anonymoustype593_parent, child, bool, f__anonymoustype508_int, int_, f__anonymoustype508_int, int_, object_arr, dictionary_int, nullable_int__, dictionary_string, nullable_int_____7609730)
			],
		  e[127]=New(/*8 args*/
			typeof(f__AnonymousType593<Tests.Model.Parent, Tests.Model.Child, bool, f__AnonymousType508<int, int>, f__AnonymousType508<int, int>, object[], System.Collections.Generic.Dictionary<int, System.Nullable<int>>, System.Collections.Generic.Dictionary<string, System.Nullable<int>>>).GetTypeInfo().DeclaredConstructors.ToArray()[0],
			p[1 // (Tests.Model.Parent Parent1)
			  ], 
			e[128]=Condition(
			  e[25 // Call of bool
				],
			  e[27 // Extension of Tests.Model.Child
				],
			  p[2 // (Tests.Model.Child Child2)
				],
			  typeof(Tests.Model.Child)), 
			e[129]=Condition(
			  e[130]=Call(
				p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
				  ], 
				typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				e[131]=Constant((int)9)),
			  e[132]=Constant(false),
			  e[133]=Call(
				p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
				  ], 
				typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetBoolean" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				e[134]=Constant((int)9)),
			  typeof(bool)), 
			e[135]=Condition(
			  e[136]=Call(
				p[11 // (System.Data.IDataReader rd)
				  ], 
				typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				e[137]=Constant((int)10)),
			  e[138]=Constant(null, typeof(f__AnonymousType508<int, int>)),
			  p[3 // (f__AnonymousType508<int, int> f__anonymoustype508_int, int___56038817)
				],
			  typeof(f__AnonymousType508<int, int>)), 
			e[139]=Condition(
			  e[140]=Call(
				p[11 // (System.Data.IDataReader rd)
				  ], 
				typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				e[141]=Constant((int)12)),
			  e[142]=Constant(null, typeof(f__AnonymousType508<int, int>)),
			  p[4 // (f__AnonymousType508<int, int> f__anonymoustype508_int, int___20021619)
				],
			  typeof(f__AnonymousType508<int, int>)), 
			e[143]=Condition(
			  e[144]=Call(
				p[11 // (System.Data.IDataReader rd)
				  ], 
				typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				e[145]=Constant((int)14)),
			  e[146]=Constant(null, typeof(object[])),
			  p[5 // (object[] Object[]5)
				],
			  typeof(object[])), 
			e[147]=Condition(
			  e[148]=Call(
				p[11 // (System.Data.IDataReader rd)
				  ], 
				typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				e[149]=Constant((int)16)),
			  e[150]=Constant(null, typeof(System.Collections.Generic.Dictionary<int, System.Nullable<int>>)),
			  p[6 // (System.Collections.Generic.Dictionary<int, System.Nullable<int>> Dictionary`26)
				],
			  typeof(System.Collections.Generic.Dictionary<int, System.Nullable<int>>)), 
			e[151]=Condition(
			  e[152]=Call(
				p[11 // (System.Data.IDataReader rd)
				  ], 
				typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
				e[153]=Constant((int)18)),
			  e[154]=Constant(null, typeof(System.Collections.Generic.Dictionary<string, System.Nullable<int>>)),
			  p[7 // (System.Collections.Generic.Dictionary<string, System.Nullable<int>> Dictionary`27)
				],
			  typeof(System.Collections.Generic.Dictionary<string, System.Nullable<int>>)))), 
		p[8 // (f__AnonymousType593<Tests.Model.Parent, Tests.Model.Child, bool, f__AnonymousType508<int, int>, f__AnonymousType508<int, int>, object[], System.Collections.Generic.Dictionary<int, System.Nullable<int>>, System.Collections.Generic.Dictionary<string, System.Nullable<int>>> f__anonymoustype593_parent, child, bool, f__anonymoustype508_int, int_, f__anonymoustype508_int, int_, object_arr, dictionary_int, nullable_int__, dictionary_string, nullable_int_____7609730)
		  ]),
	  p[12]=Parameter(typeof(LinqToDB.Linq.IQueryRunner), "qr"), 
	  p[10 // (LinqToDB.IDataContext dctx)
		], 
	  p[11 // (System.Data.IDataReader rd)
		], 
	  p[13]=Parameter(typeof(System.Linq.Expressions.Expression), "expr"), 
	  p[14]=Parameter(typeof(object[]), "ps"), 
	  p[15]=Parameter(typeof(object[]), "preamble")),
	p[16]=Parameter(typeof(LinqToDB.Linq.IQueryRunner), "qr"), 
	e[155]=Property(
	  p[16 // (LinqToDB.Linq.IQueryRunner qr)
		],
	  typeof(LinqToDB.Linq.IQueryRunner).GetTypeInfo().GetDeclaredProperty("DataContext")), 
	p[9 // (System.Data.IDataReader dr)
	  ], 
	e[156]=Property(
	  p[16 // (LinqToDB.Linq.IQueryRunner qr)
		],
	  typeof(LinqToDB.Linq.IQueryRunner).GetTypeInfo().GetDeclaredProperty("Expression")), 
	e[157]=Property(
	  p[16 // (LinqToDB.Linq.IQueryRunner qr)
		],
	  typeof(LinqToDB.Linq.IQueryRunner).GetTypeInfo().GetDeclaredProperty("Parameters")), 
	e[158]=Property(
	  p[16 // (LinqToDB.Linq.IQueryRunner qr)
		],
	  typeof(LinqToDB.Linq.IQueryRunner).GetTypeInfo().GetDeclaredProperty("Preambles"))),
  p[16 // (LinqToDB.Linq.IQueryRunner qr)
	], 
  p[9 // (System.Data.IDataReader dr)
	]);

jogibear9988 avatar Dec 11 '20 19:12 jogibear9988

Error: System.OverflowException Test: TestextraTypesBulkCopy("PostgreSQL", Default)

CSharpCode:

(Func<IQueryRunner, IDataReader, PostgreSQLTests.ExtraBulkCopyTypesTable>)(
	IQueryRunner qr, 
	IDataReader dr) => 
	new Func<IQueryRunner, IDataContext, IDataReader, Expression, object[], object[], PostgreSQLTests.ExtraBulkCopyTypesTable>(
		(Func<IQueryRunner, IDataContext, IDataReader, Expression, object[], object[], PostgreSQLTests.ExtraBulkCopyTypesTable>)(
			IQueryRunner qr, 
			IDataContext dctx, 
			IDataReader rd, 
			Expression expr, 
			object[] ps, 
			object[] preamble) => 
		{
			NpgsqlDefaultDataReader ldr;
			PostgreSQLTests.ExtraBulkCopyTypesTable ExtraBulkCopyTypesTable1;
			ldr = ((NpgsqlDefaultDataReader)dr);
			ExtraBulkCopyTypesTable1 = ((PostgreSQLTests.ExtraBulkCopyTypesTable)TableBuilder.TableContext.OnEntityCreated(
				dctx,
				new PostgreSQLTests.ExtraBulkCopyTypesTable()
				 { 
						Id = ldr.IsDBNull((int)0) ?
						(int)0 :
						ldr.GetInt32((int)0),
						Byte = ldr.IsDBNull((int)1) ?
						null :
						((Nullable<byte>)((byte)ldr.GetInt16((int)1))),
						SByte = ldr.IsDBNull((int)2) ?
						null :
						((Nullable<SByte>)((SByte)ldr.GetInt16((int)2))),
						Int16 = ldr.IsDBNull((int)3) ?
						null :
						new Nullable<short>(ldr.GetInt16((int)3)),
						UInt16 = ldr.IsDBNull((int)4) ?
						null :
						((Nullable<UInt16>)((UInt16)ldr.GetInt32((int)4))),
						Int32 = ldr.IsDBNull((int)5) ?
						null :
						new Nullable<int>(ldr.GetInt32((int)5)),
						UInt32 = ldr.IsDBNull((int)6) ?
						null :
						((Nullable<UInt32>)((UInt32)ldr.GetInt64((int)6))),
						Int64 = ldr.IsDBNull((int)7) ?
						null :
						new Nullable<Int64>(ldr.GetInt64((int)7)),
						UInt64 = ldr.IsDBNull((int)8) ?
						null :
						((Nullable<UInt64>)((UInt64)ldr.GetDecimal((int)8))),
				}));
			return ExtraBulkCopyTypesTable1;
		})).Invoke(
		qr,
		qr.DataContext,
		dr,
		qr.Expression,
		qr.Parameters,
		qr.Preambles);

ExpressionString:

var p = new ParameterExpression[10]; // the parameter expressions 
var e = new Expression[81]; // the unique expressions 
var l = new LabelTarget[0]; // the labels 
var expr = Lambda( // $
  typeof(System.Func<LinqToDB.Linq.IQueryRunner, System.Data.IDataReader, Tests.DataProvider.PostgreSQLTests.ExtraBulkCopyTypesTable>),
  e[0]=Invoke(
	e[1]=Lambda( // $
	  typeof(System.Func<LinqToDB.Linq.IQueryRunner, LinqToDB.IDataContext, System.Data.IDataReader, System.Linq.Expressions.Expression, object[], object[], Tests.DataProvider.PostgreSQLTests.ExtraBulkCopyTypesTable>),
	  e[2]=Block(
		typeof(Tests.DataProvider.PostgreSQLTests.ExtraBulkCopyTypesTable),
		new[] {
		p[0]=Parameter(typeof(Npgsql.NpgsqlDefaultDataReader), "ldr"),
		p[1]=Parameter(typeof(Tests.DataProvider.PostgreSQLTests.ExtraBulkCopyTypesTable), "ExtraBulkCopyTypesTable1")
		},
		e[3]=MakeBinary(ExpressionType.Assign,
		  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
			],
		  e[4]=Convert(
			p[2]=Parameter(typeof(System.Data.IDataReader), "dr"),
			typeof(Npgsql.NpgsqlDefaultDataReader))), 
		e[5]=MakeBinary(ExpressionType.Assign,
		  p[1 // (Tests.DataProvider.PostgreSQLTests.ExtraBulkCopyTypesTable ExtraBulkCopyTypesTable1)
			],
		  e[6]=Convert(
			e[7]=Call(
			  null, 
			  typeof(LinqToDB.Linq.Builder.TableBuilder.TableContext).GetMethods(BindingFlags.NonPublic|BindingFlags.Static).Single(x => !x.IsGenericMethod && x.Name == "OnEntityCreated" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(LinqToDB.IDataContext), typeof(object) })),
			  p[3]=Parameter(typeof(LinqToDB.IDataContext), "dctx"), 
			  e[8]=MemberInit((NewExpression)(
				e[9]=New(/*0 args*/
				  typeof(Tests.DataProvider.PostgreSQLTests.ExtraBulkCopyTypesTable).GetTypeInfo().DeclaredConstructors.ToArray()[0], new Expression[0])), 
				Bind(
				  typeof(Tests.DataProvider.PostgreSQLTests.ExtraBulkCopyTypesTable).GetTypeInfo().GetDeclaredProperty("Id"), 
				  e[10]=Condition(
					e[11]=Call(
					  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
						], 
					  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
					  e[12]=Constant((int)0)),
					e[13]=Constant((int)0),
					e[14]=Call(
					  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
						], 
					  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetInt32" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
					  e[15]=Constant((int)0)),
					typeof(int))), 
				Bind(
				  typeof(Tests.DataProvider.PostgreSQLTests.ExtraBulkCopyTypesTable).GetTypeInfo().GetDeclaredProperty("Byte"), 
				  e[16]=Condition(
					e[17]=Call(
					  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
						], 
					  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
					  e[18]=Constant((int)1)),
					e[19]=Constant(null, typeof(System.Nullable<byte>)),
					e[20]=Convert(
					  e[21]=ConvertChecked(
						e[22]=Call(
						  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
							], 
						  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetInt16" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
						  e[23]=Constant((int)1)),
						typeof(byte)),
					  typeof(System.Nullable<byte>)),
					typeof(System.Nullable<byte>))), 
				Bind(
				  typeof(Tests.DataProvider.PostgreSQLTests.ExtraBulkCopyTypesTable).GetTypeInfo().GetDeclaredProperty("SByte"), 
				  e[24]=Condition(
					e[25]=Call(
					  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
						], 
					  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
					  e[26]=Constant((int)2)),
					e[27]=Constant(null, typeof(System.Nullable<System.SByte>)),
					e[28]=Convert(
					  e[29]=ConvertChecked(
						e[30]=Call(
						  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
							], 
						  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetInt16" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
						  e[31]=Constant((int)2)),
						typeof(System.SByte)),
					  typeof(System.Nullable<System.SByte>)),
					typeof(System.Nullable<System.SByte>))), 
				Bind(
				  typeof(Tests.DataProvider.PostgreSQLTests.ExtraBulkCopyTypesTable).GetTypeInfo().GetDeclaredProperty("Int16"), 
				  e[32]=Condition(
					e[33]=Call(
					  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
						], 
					  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
					  e[34]=Constant((int)3)),
					e[35]=Constant(null, typeof(System.Nullable<short>)),
					e[36]=New(/*1 args*/
					  typeof(System.Nullable<short>).GetTypeInfo().DeclaredConstructors.ToArray()[0],
					  e[37]=Call(
						p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
						  ], 
						typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetInt16" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
						e[38]=Constant((int)3))),
					typeof(System.Nullable<short>))), 
				Bind(
				  typeof(Tests.DataProvider.PostgreSQLTests.ExtraBulkCopyTypesTable).GetTypeInfo().GetDeclaredProperty("UInt16"), 
				  e[39]=Condition(
					e[40]=Call(
					  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
						], 
					  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
					  e[41]=Constant((int)4)),
					e[42]=Constant(null, typeof(System.Nullable<System.UInt16>)),
					e[43]=Convert(
					  e[44]=ConvertChecked(
						e[45]=Call(
						  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
							], 
						  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetInt32" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
						  e[46]=Constant((int)4)),
						typeof(System.UInt16)),
					  typeof(System.Nullable<System.UInt16>)),
					typeof(System.Nullable<System.UInt16>))), 
				Bind(
				  typeof(Tests.DataProvider.PostgreSQLTests.ExtraBulkCopyTypesTable).GetTypeInfo().GetDeclaredProperty("Int32"), 
				  e[47]=Condition(
					e[48]=Call(
					  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
						], 
					  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
					  e[49]=Constant((int)5)),
					e[50]=Constant(null, typeof(System.Nullable<int>)),
					e[51]=New(/*1 args*/
					  typeof(System.Nullable<int>).GetTypeInfo().DeclaredConstructors.ToArray()[0],
					  e[52]=Call(
						p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
						  ], 
						typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetInt32" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
						e[53]=Constant((int)5))),
					typeof(System.Nullable<int>))), 
				Bind(
				  typeof(Tests.DataProvider.PostgreSQLTests.ExtraBulkCopyTypesTable).GetTypeInfo().GetDeclaredProperty("UInt32"), 
				  e[54]=Condition(
					e[55]=Call(
					  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
						], 
					  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
					  e[56]=Constant((int)6)),
					e[57]=Constant(null, typeof(System.Nullable<System.UInt32>)),
					e[58]=Convert(
					  e[59]=ConvertChecked(
						e[60]=Call(
						  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
							], 
						  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetInt64" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
						  e[61]=Constant((int)6)),
						typeof(System.UInt32)),
					  typeof(System.Nullable<System.UInt32>)),
					typeof(System.Nullable<System.UInt32>))), 
				Bind(
				  typeof(Tests.DataProvider.PostgreSQLTests.ExtraBulkCopyTypesTable).GetTypeInfo().GetDeclaredProperty("Int64"), 
				  e[62]=Condition(
					e[63]=Call(
					  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
						], 
					  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
					  e[64]=Constant((int)7)),
					e[65]=Constant(null, typeof(System.Nullable<System.Int64>)),
					e[66]=New(/*1 args*/
					  typeof(System.Nullable<System.Int64>).GetTypeInfo().DeclaredConstructors.ToArray()[0],
					  e[67]=Call(
						p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
						  ], 
						typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetInt64" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
						e[68]=Constant((int)7))),
					typeof(System.Nullable<System.Int64>))), 
				Bind(
				  typeof(Tests.DataProvider.PostgreSQLTests.ExtraBulkCopyTypesTable).GetTypeInfo().GetDeclaredProperty("UInt64"), 
				  e[69]=Condition(
					e[70]=Call(
					  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
						], 
					  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "IsDBNull" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
					  e[71]=Constant((int)8)),
					e[72]=Constant(null, typeof(System.Nullable<System.UInt64>)),
					e[73]=Convert(
					  e[74]=ConvertChecked(
						e[75]=Call(
						  p[0 // (Npgsql.NpgsqlDefaultDataReader ldr)
							], 
						  typeof(System.Data.IDataRecord).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "GetDecimal" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(int) })),
						  e[76]=Constant((int)8)),
						typeof(System.UInt64),
						typeof(System.Decimal).GetMethods().Single(x => !x.IsGenericMethod && x.Name == "op_Explicit" && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(new[] { typeof(System.Decimal) }))),
					  typeof(System.Nullable<System.UInt64>)),
					typeof(System.Nullable<System.UInt64>))))),
			typeof(Tests.DataProvider.PostgreSQLTests.ExtraBulkCopyTypesTable))), 
		p[1 // (Tests.DataProvider.PostgreSQLTests.ExtraBulkCopyTypesTable ExtraBulkCopyTypesTable1)
		  ]),
	  p[4]=Parameter(typeof(LinqToDB.Linq.IQueryRunner), "qr"), 
	  p[3 // (LinqToDB.IDataContext dctx)
		], 
	  p[5]=Parameter(typeof(System.Data.IDataReader), "rd"), 
	  p[6]=Parameter(typeof(System.Linq.Expressions.Expression), "expr"), 
	  p[7]=Parameter(typeof(object[]), "ps"), 
	  p[8]=Parameter(typeof(object[]), "preamble")),
	p[9]=Parameter(typeof(LinqToDB.Linq.IQueryRunner), "qr"), 
	e[77]=Property(
	  p[9 // (LinqToDB.Linq.IQueryRunner qr)
		],
	  typeof(LinqToDB.Linq.IQueryRunner).GetTypeInfo().GetDeclaredProperty("DataContext")), 
	p[2 // (System.Data.IDataReader dr)
	  ], 
	e[78]=Property(
	  p[9 // (LinqToDB.Linq.IQueryRunner qr)
		],
	  typeof(LinqToDB.Linq.IQueryRunner).GetTypeInfo().GetDeclaredProperty("Expression")), 
	e[79]=Property(
	  p[9 // (LinqToDB.Linq.IQueryRunner qr)
		],
	  typeof(LinqToDB.Linq.IQueryRunner).GetTypeInfo().GetDeclaredProperty("Parameters")), 
	e[80]=Property(
	  p[9 // (LinqToDB.Linq.IQueryRunner qr)
		],
	  typeof(LinqToDB.Linq.IQueryRunner).GetTypeInfo().GetDeclaredProperty("Preambles"))),
  p[9 // (LinqToDB.Linq.IQueryRunner qr)
	], 
  p[2 // (System.Data.IDataReader dr)
	]);

jogibear9988 avatar Dec 11 '20 19:12 jogibear9988

Error: InvalidCastException Test: MappingTests.TesCollection

CSharpCode:

(Func<object, object>)(object object__23780681) => 
{
	SampleClass sampleclass__63059985;
	sampleclass__63059985 = new SampleClass(
		object__23780681,
		new System.Delegate[]{default(System.Func<Tests.TypeMapping.Wrappers.SampleClass, int>), default(System.Func<Tests.TypeMapping.Wrappers.SampleClass, int>), default(System.Func<Tests.TypeMapping.Wrappers.SampleClass, int, Tests.TypeMapping.Wrappers.OtherClass>), default(System.Action<Tests.TypeMapping.Wrappers.SampleClass>), default(System.Func<Tests.TypeMapping.Wrappers.SampleClass, int, Tests.TypeMapping.Wrappers.RegularEnum1>), default(System.Func<Tests.TypeMapping.Wrappers.SampleClass, int, Tests.TypeMapping.Wrappers.FlagsEnum>), default(System.Func<Tests.TypeMapping.Wrappers.SampleClass, Tests.TypeMapping.Wrappers.RegularEnum1, int>), default(System.Func<Tests.TypeMapping.Wrappers.SampleClass, Tests.TypeMapping.Wrappers.FlagsEnum, int>), default(System.Func<Tests.TypeMapping.Wrappers.SampleClass, Tests.TypeMapping.Wrappers.RegularEnum1>), default(System.Func<Tests.TypeMapping.Wrappers.SampleClass, Tests.TypeMapping.Wrappers.FlagsEnum>), default(System.Action<Tests.TypeMapping.Wrappers.SampleClass, bool>), default(System.Action<Tests.TypeMapping.Wrappers.SampleClass, Tests.TypeMapping.Wrappers.RegularEnum1>), default(System.Action<Tests.TypeMapping.Wrappers.SampleClass, Tests.TypeMapping.Wrappers.FlagsEnum>), default(System.Func<Tests.TypeMapping.Wrappers.SampleClass, int, Tests.TypeMapping.Wrappers.RegularEnum2>), default(System.Func<Tests.TypeMapping.Wrappers.SampleClass, Tests.TypeMapping.Wrappers.RegularEnum2, int>), default(System.Func<Tests.TypeMapping.Wrappers.SampleClass, Tests.TypeMapping.Wrappers.RegularEnum2>), default(System.Action<Tests.TypeMapping.Wrappers.SampleClass, Tests.TypeMapping.Wrappers.RegularEnum2>), default(System.Func<Tests.TypeMapping.Wrappers.SampleClass, string, string>), null, default(System.Func<Tests.TypeMapping.Wrappers.SampleClass, string, int>)});
	new Action<SampleClass>(
		default(Action<SampleClass>)).Invoke(
		sampleclass__63059985);
	return sampleclass__63059985;
});

ExpressionString:

var p = new ParameterExpression[2]; // the parameter expressions 
var e = new Expression[6]; // the unique expressions 
var l = new LabelTarget[0]; // the labels 
var expr = Lambda( // $
  typeof(System.Func<object, object>),
  e[0]=Block(
	typeof(Tests.TypeMapping.Wrappers.SampleClass),
	new[] {
	p[0]=Parameter(typeof(Tests.TypeMapping.Wrappers.SampleClass))
	},
	e[1]=MakeBinary(ExpressionType.Assign,
	  p[0 // (Tests.TypeMapping.Wrappers.SampleClass sampleclass__63059985)
		],
	  e[2]=New(/*2 args*/
		typeof(Tests.TypeMapping.Wrappers.SampleClass).GetTypeInfo().DeclaredConstructors.ToArray()[0],
		p[1]=Parameter(typeof(object)), 
		e[3]=Constant(null, typeof(System.Delegate[])
		  // !!! Please provide the non-default value
		  ))), 
	e[4]=Invoke(
	  e[5]=Constant(null, typeof(System.Action<Tests.TypeMapping.Wrappers.SampleClass>)
		// !!! Please provide the non-default value
		),
	  p[0 // (Tests.TypeMapping.Wrappers.SampleClass sampleclass__63059985)
		]), 
	p[0 // (Tests.TypeMapping.Wrappers.SampleClass sampleclass__63059985)
	  ]),
  p[1 // (object object__23780681)
	]);

jogibear9988 avatar Dec 11 '20 19:12 jogibear9988

@jogibear9988 I was able to reproduce this Test: MappingTests.TesCollection - took me awhile.

dadhi avatar Dec 12 '20 16:12 dadhi

Okay. But should it be fixed? Because it still fails.

jogibear9988 avatar Dec 12 '20 18:12 jogibear9988

Yes, I will work on this. At the moment I am going incrementally by replacing the Compile in my fork one by one and fixing the issues. It helps because there are a lot of tests and I can find related problematic Compile faster. Now I did replaced the next bunch of Compiles and found that Mapping tests are down.. so fixing..

dadhi avatar Dec 12 '20 19:12 dadhi

??? Wich fork? of Linq2db? If you use the Fork, wich already has the replaced compiles, you could switch to MS compiler. Then run all tests. Then you could switch to yours and run them again. All test wich I found since now, directly fail on the expression wich is wrong, not on a wrong returned value (or something similar)

jogibear9988 avatar Dec 12 '20 19:12 jogibear9988

??? Wich fork? of Linq2db

My fork of Linq2Db where I am switching the Compile to CompileFast directly.

dadhi avatar Dec 12 '20 20:12 dadhi

@dadhi any news?

jogibear9988 avatar Feb 03 '21 12:02 jogibear9988

@jogibear9988 Not yet. Past months did something else, but planning to be back to FEC soon.

dadhi avatar Feb 03 '21 13:02 dadhi

@jogibear9988 I've decided to release the V3 as-is, without the fixes for this issue. The previews are being for a while now and releasing the RTM version I am hoping to see more adoption and feedback which I can iterate upon.

I hope to see more fine-grain issues after the release and fixing those will benefit all the adopters. Moreover, the new version contains diagnostics tools to improve the quality of life for everyone and decrease the fear of using the FEC.

Though I am still planning to return to the Linq2db when I have time.

dadhi avatar Mar 17 '21 12:03 dadhi

@dadhi should i test this once more? do you think some of them are fixed?

jogibear9988 avatar Mar 25 '22 16:03 jogibear9988

@jogibear9988 Not sure. Need to look again.

dadhi avatar Mar 25 '22 16:03 dadhi

@jogibear9988 Is there a way to quickly check the current FEC sources, are you still having the PR or branch for that or should I go back to mine (update it, etc.)?

dadhi avatar Mar 25 '22 17:03 dadhi

I'll take a look on Sunday

jogibear9988 avatar Mar 25 '22 18:03 jogibear9988

For mee it looks like most of the tests now work

jogibear9988 avatar Mar 30 '22 20:03 jogibear9988

PR Branch was merged to linq2db, so it has support for switching expressionCompiler in it's release

jogibear9988 avatar Mar 30 '22 20:03 jogibear9988

I'm looking if we will enable the linq2db unit tests also using FEC. Maybe this is possible in a way.

jogibear9988 avatar Mar 30 '22 20:03 jogibear9988

@jogibear9988 I am planning to release the FEC in current state of things. So if you find some bugs, keep them posted to be addressed separately.

dadhi avatar Apr 13 '22 18:04 dadhi

v3.3.0 is out

dadhi avatar Apr 26 '22 21:04 dadhi