Skip to content

Operator '==' cannot be applied to operands of type 'System.Text.Json.JsonElement' and '<null>' #629

@minhtranes

Description

@minhtranes

Version:v5.0.3

Issue

I tried the demo/DemoApp/JSONDemo.cs and got the below error:

[11:03:38 ERR] Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Operator '==' cannot be applied to operands of type 'System.Text.Json.JsonElement' and '<null>'
   at CallSite.Target(Closure, CallSite, Object, Object)
   at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)

Troubleshoot

Trying to troubleshoot, I found that the issue comes from RulesEngine.HelperFunctions.Utils.CreateAbstractClassType when it try to compare the JsonValueKind with null

if (input == null)
{
    return typeof(object);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions