Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expression of type System.Linq.Expressions.ConstantExpression is not supported

See original GitHub issue

Not sure why this exception happen has 3 nodes: Game, GameInfor, User

This query run well on neo4j match (g:Game)-[:GAME_HAS_GAMEINFOR]->(n:GameInfor)<-[:USER_HAS_GAMEINFOR]- (u:User) where g.Name = ‘GreenDNA’ return n,u order by n.SupportScore limit 10

but couldn’t make it run on Neo4jClient

                    .Where("g.Name = 'GreenDNA'")
                    .Return((n, u) => new SupportRank
                        User = u.As<SocialUser>(),
                        GameInfo = n.As<UserGameInfo>(),
                        Position = 0

Error: Expression of type System.Linq.Expressions.ConstantExpression is not supported thrown

public class SupportRank
    public SocialUser User { get; set; }
    public UserGameInfo GameInfo { get; set; }
    public int Position { get; set; }
    public SupportRank(){}
    public SupportRank(SocialUser user, UserGameInfo gameInfo, int position)
        this.User = user;
        this.GameInfo = gameInfo;
        this.Position = position;

public class SocialUser

    public string Username { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public int Year { get; set; }
    public int Month { get; set; }
    public int Day { get; set; }
    public string Gender { get; set; }
    public string Country { get; set; }
    public string AvatarURL { get; set; }
    public bool isLogged { get; set; }
    public bool IsBanned { get; set; }
    public SocialUser()
        : base()


    public SocialUser(string username, string firstName, string lastName,
        int year, int month, int day, string gender, string country, 
        string avatarURL, bool isLogged, bool isBanned)
        this.Username = username;
        this.FirstName = firstName;
        this.LastName = lastName;
        this.Year = year;
        this.Month = month;
        this.Day = day;
        this.Gender = gender;
        this.Country = country;
        this.AvatarURL = avatarURL;
        this.isLogged = isLogged;
        this.IsBanned = IsBanned;
public class UserGameInfo
    public string ID { get; set; }
    public int AchievementDifficulty { get; set; }
    public double UserAbility { get; set; }
    public string GameInfo { get; set; }
    public int NoCorrect { get; set; }
    public int NoIncorrect { get; set; }
    public string ArrayDifficulties { get; set; }
    public int SupportScore { get; set; }
    public int ShareScore { get; set; }
    public int AchievementScore { get; set; }
    public UserGameInfo()
    public UserGameInfo(string id, int achievementDifficulty, double userAbility,
        string gameInfo, int noCorrect, int noIncorrect, string arrayDifficulties,
        int supportScore, int shareScore, int achievementScore)
        this.ID = id;
        this.AchievementDifficulty = achievementDifficulty;
        this.UserAbility = userAbility;
        this.GameInfo = gameInfo;
        this.NoCorrect = noCorrect;
        this.NoIncorrect = noIncorrect;
        this.ArrayDifficulties = arrayDifficulties;
        this.SupportScore = supportScore;
        this.ShareScore = shareScore;
        this.AchievementScore = achievementScore;

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

cskardoncommented, Oct 6, 2016

As a work around - I would use the With clause to set your bool const:

public static void CallCypher(IGraphClient gc, bool val)
    var query = gc.Cypher
        .With($"n, {val} as b") //Return 'val' as 'b' which is then set in the Return clause.
        .Return((n, b) => new ReturnClassWithBool
            BooleanValue = b.As<bool>(),
            Count = n.Count()

    var res = query.Results;

using the following class as the return class.

public class ReturnClassWithBool
    public bool BooleanValue { get; set; }
    public long Count { get; set; }
stevewash123commented, Oct 6, 2016

Thanks! Perfect

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Neo4jClient - Expression of type System.Linq. ...
Expression of type System.Linq.Expressions.ConstantExpression is not supported. the query is simple: return await _graphClient.Cypher.
Read more >
Expression of type System.Linq.Expressions. ...
An exception of type 'System.NotSupportedException' occurred in Neo4jClient.dll but was not handled in user code Additional information: ...
Read more >
ConstantExpression Class (System.Linq.Expressions)
Represents an expression that has a constant value.
Read more >
This library provides allow list scanners that check expressions against a given list of allowed items. Two different types are provided:.
Read more >
Dynamically Generating LINQ Expressions
This gives Entity Framework and similar libraries the opportunity to take the LINQ expression and transform it into an SQL query.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found