You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using Newtonsoft.Json.Linq;staticvoidMain(string[]args){varcontext=new EvalContext();
context.RegisterType(typeof(JArray));
context.Execute(@"new JArray().Contains(""D"")");}
The error is as follows
Z.Expressions.Compiler.Shared.EvalException
HResult=0x80131500
Message=Oops! No applicable member has been found for the expression. The error occurred for expression "." at position 12 near ".Contains(\"D\")".
Source=Z.Expressions.Eval
StackTrace:
at .(ExpressionScope , Expression , Type , String , List`1 , Boolean , List`1 , SyntaxNode , Expression& )
at .(ExpressionScope , SyntaxNode , Type , Expression , List`1 )
at .(ExpressionScope , SyntaxNode , Expression , Boolean )
at .(ExpressionScope , SyntaxNode , Expression , Boolean )
at .(ExpressionScope , SyntaxNode , Expression , Boolean )
at Z.Expressions.CodeCompiler.CSharp.ExpressionParser.ParseSyntax(ExpressionScope scope, SyntaxNode node, Type resultType)
at .[](EvalContext , String , IDictionary`2 , Type , EvalCompilerParameterKind , ExpressionScope , String , Boolean , Boolean )
at .[](EvalContext , String , IDictionary`2 , Type , EvalCompilerParameterKind , Boolean , Boolean , Boolean )
at Z.Expressions.EvalContext.Execute[TResult](String code)
at SomeTest.Program.Main(String[] args) in E:\Desktop\Program\C#\SomeTest\Program.cs:line 66
此异常最初是在此调用堆栈中引发的:
[外部代码]
SomeTest.Program.Main(string[]) (位于 Program.cs 中)
JArray.Contains(JToken T) only accepts JToken, so EvalContext considers No applicable member
But we know that Newtonsoft.Json.Linq defines implicit type conversion from String to JToken, and this statement works properly in VS.
The text was updated successfully, but these errors were encountered:
The following statement will report an error.
The error is as follows
JArray.Contains(JToken T)
only acceptsJToken
, so EvalContext considers No applicable memberBut we know that
Newtonsoft.Json.Linq
defines implicit type conversion from String to JToken, and this statement works properly in VS.The text was updated successfully, but these errors were encountered: