Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1040543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:14:14+00:00 2026-05-16T15:14:14+00:00

I currently have code which produces the following LINQ expression (taken from the WhoCanHelpMe

  • 0

I currently have code which produces the following LINQ expression (taken from the WhoCanHelpMe showcase project). Its purpose is to bind together two expressions but I don’t know if the following is actually a valid expression:

.Where(p => (p.PostCodes
      .Any(pc =>(pc = value(PatchByPostCodeSpecification).postCode)) &&
         Invoke(p => p.Teams
                    .Any(t => (Convert(t.TeamType) = 
                     Convert(value(PatchByBookingTypeSpecification).bookingType))), 
         p
       )
      ));

When the expression is evaluated I get an Object reference not set to an instance of an object exception with the following stack trace:

at NHibernate.Loader.Criteria.CriteriaQueryTranslator.GetEntityName(ICriteria subcriteria, String propertyName)
at NHibernate.Loader.Criteria.CriteriaQueryTranslator.GetColumns(String propertyName, ICriteria subcriteria)
at NHibernate.Loader.Criteria.CriteriaQueryTranslator.GetColumnsUsingProjection(ICriteria subcriteria, String propertyName)
at NHibernate.Criterion.CriterionUtil.GetColumnNamesUsingPropertyName(ICriteriaQuery criteriaQuery, ICriteria criteria, String propertyName, Object value, ICriterion critertion)
at NHibernate.Criterion.CriterionUtil.GetColumnNamesForSimpleExpression(String propertyName, IProjection projection, ICriteriaQuery criteriaQuery, ICriteria criteria, IDictionary2 enabledFilters, ICriterion criterion, Object value)
at NHibernate.Criterion.SimpleExpression.ToSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary
2 enabledFilters)
at NHibernate.Loader.Criteria.CriteriaQueryTranslator.GetWhereCondition(IDictionary2 enabledFilters)
at NHibernate.Loader.Criteria.CriteriaJoinWalker..ctor(IOuterJoinLoadable persister, CriteriaQueryTranslator translator, ISessionFactoryImplementor factory, ICriteria criteria, String rootEntityName, IDictionary
2 enabledFilters)
at NHibernate.Criterion.SubqueryExpression.ToSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary2 enabledFilters)
at NHibernate.Criterion.Junction.ToSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary
2 enabledFilters)
at NHibernate.Loader.Criteria.CriteriaQueryTranslator.GetWhereCondition(IDictionary2 enabledFilters)
at NHibernate.Loader.Criteria.CriteriaJoinWalker..ctor(IOuterJoinLoadable persister, CriteriaQueryTranslator translator, ISessionFactoryImplementor factory, ICriteria criteria, String rootEntityName, IDictionary
2 enabledFilters)
at NHibernate.Loader.Criteria.CriteriaLoader..ctor(IOuterJoinLoadable persister, ISessionFactoryImplementor factory, CriteriaImpl rootCriteria, String rootEntityName, IDictionary2 enabledFilters)
at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results)
at NHibernate.Impl.CriteriaImpl.List(IList results)
at NHibernate.Impl.CriteriaImpl.List()
at NHibernate.Linq.CriteriaResultReader
1.List()
at NHibernate.Linq.CriteriaResultReader1.<GetEnumerator>d__0.MoveNext()
at System.Collections.Generic.List
1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable
1 source)
at Environment.Core.Specifications.QuerySpecification2.SatisfyingElementsFrom(IQueryable1 candidates) in C:\DEV\Environment\Environment\app\Environment.Core\Specifications\QuerySpecification.cs:line 30
at Environment.Data.NHibernate.LinqRepository1.FindAll(ILinqSpecification2 specification) in C:\DEV\Environment\Environment\app\Environment.Data\NHibernate\LinqRepository.cs:line 43
……..

UPDATE

I’ve tried running the query without using a complex expression:

.Where(p => (p.PostCodes
      .Any(pc =>
          (pc = value(PatchByPostCodeSpecification).postCode)
          )));

The same error still occurred.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:14:14+00:00Added an answer on May 16, 2026 at 3:14 pm

    This was caused because the expression was comparing two PostCode objects rather than comparing on properties. I changed the expression so that the following is produced:

    .Where(p => (p.PostCodes
      .Any(pc =>
          (pc.Name = value(PatchByPostCodeSpecification).postCode.Name)
          )));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have the following code which delays showing a fixed bar after a
i have a code which download the apk from server by using Asynctask, Currently
I am currently writing a compiler which produces x86-32 code. However, I have a
I currently have this code which stores XML into an XML-type column called data,
I currently have this code which reads the first field in a database record
I currently have some code which when you press the submit button, a marker
I have some code which I'm currently using to change the static-IP of a
I have this following code which will return all the current semesters. How do
I currently have code that does the following: private final static ExecutorService pool =
I have a project in c# which uses bindings to use some c++ code.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.