During the migration of. Net framework based projects to. Net core based projects, an error of ambiguousexception was thrown in the original project:

After troubleshooting, the problem appears in the following code:

Expression.Call(left, typeof (string).GetMethod("Contains"), right)

When a program dynamically constructs a lambda expression, it needs to obtain the contains method of string type through reflection, but now the contains method seems to be missing

I tried "test".Contains("..") in the IDE, and found that not only are contains still in use, but also there are no problems when using them

Then,I found a solution through the forums.asp.net

Expression.Call(left, typeof (string).GetMethod("Contains", new[] { typeof(string) }), right)

In other words, the type of parameter should be specified during reflection.