Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expression Trees not detected #1249

Closed
CreateAndInject opened this issue Aug 9, 2018 · 4 comments
Closed

Expression Trees not detected #1249

CreateAndInject opened this issue Aug 9, 2018 · 4 comments

Comments

@CreateAndInject
Copy link
Contributor

		IQueryable<Contract> source = from a in db.Contract
		where a.ID == ID
		select a;
		ParameterExpression parameterExpression = Expression.Parameter(typeof(Contract), "a");
		ConstructorInfo constructor = (ConstructorInfo)MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/, typeof(<>f__AnonymousType91<int, string, string, string, string, DateTime, string, string, string, string, string, string, string, string>).TypeHandle);
		Expression[] obj = new Expression[14]
		{
			Expression.Property(parameterExpression, (MethodInfo)MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/)),
			Expression.Property(parameterExpression, (MethodInfo)MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/)),
			Expression.Property(parameterExpression, (MethodInfo)MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/)),
			null,
			null,
			null,
			null,
			null,
			null,
			null,
			null,
			null,
			null,
			null
		};
		MethodInfo method = (MethodInfo)MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/);
		Expression[] obj2 = new Expression[1];
		MethodInfo method2 = (MethodInfo)MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/);
		Expression[] obj3 = new Expression[2];
		MethodInfo method3 = (MethodInfo)MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/);
		Expression[] obj4 = new Expression[2]
		{
			Expression.Property(Expression.Field(Expression.Constant(this, typeof(LoanController)), FieldInfo.GetFieldFromHandle((RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/)), (MethodInfo)MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/)),
			null
		};
@siegfriedpammer
Copy link
Member

Those are expression trees that were not detected. Could you please provide the assembly?

@siegfriedpammer siegfriedpammer changed the title What's this: /*OpCode not supported: LdMemberToken*/ Expression Trees not detected Aug 9, 2018
@CreateAndInject
Copy link
Contributor Author

Web.zip

Web.Areas.Admin.Controllers.LoanController.Edit(int)

@CreateAndInject
Copy link
Contributor Author

This problem desn't fix completely:
Web.Areas.Admin.Controllers.CostReceController.Sexport
Web.Areas.Admin.Controllers.CostReceController.ExpReportList

By the way, see :Web.Areas.Admin.Controllers.AgencyController.Delete

		public ActionResult Delete(string IDS)
		{
			string[] arr = IDS.Split(',');
			int AID = base.Session["AdminID"].ParseInt();
			int s = (from a in db.Agency
			where arr.Contains(a.ID.ToString()) && (object?)a.AdminID == (object?)(int?)AID
			select a).Update((Agency a) => new Agency
			{
				IsDel = (int?)1
			});
			return Json(new Result(s));
		}

ILSpy try to convert something to (object?), but 'object' isn't value type, so it's an error,and convert to (int?) is unnecessary
The corrent code is :
where arr.Contains(a.ID.ToString()) && a.AdminID == AID

@siegfriedpammer
Copy link
Member

Can you please open new issues for these? Please describe only one problem per issue, thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 10, 2020
ElektroKill added a commit to dnSpyEx/ILSpy that referenced this issue Jul 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants