Coder Social home page Coder Social logo

Comments (11)

dadhi avatar dadhi commented on May 20, 2024

Interesting, as I understood whatever is inside Where2 is expression to compile?
If so, what is the type of w, w.DateType and w.Id ?

from fastexpressioncompiler.

OscarKoo avatar OscarKoo commented on May 20, 2024

"whatever is inside Where2 is expression to compile" - Yes, as last time the picture I showed you. (if you remember)

"what is the type of w, w.DateType and w.Id?" - w is an Entity "class", w.DateType is "int", w.Id is "string".
public class TimeSlice
{
public string Id { get; set; }
public byte[] RowVersion { get; set; }
public string ModalityId { get; set; }
public int DateType { get; set; }
public DateTime AvailableDate { get; set; }
public string StartTime { get; set; }
public string EndTime { get; set; }
public int Duration { get; set; }
public int TimeSliceType { get; set; }
public int? MaxNumber { get; set; }
public int? MaxPercentage { get; set; }
public string Description { get; set; }
}

from fastexpressioncompiler.

dadhi avatar dadhi commented on May 20, 2024

Thanks for the info, I will get it from here.

from fastexpressioncompiler.

dadhi avatar dadhi commented on May 20, 2024

Hi @OscarKoo ,

I have added the sample test here and it is working just fine with the latest source.

Did you check on the latest source or v1.5?

from fastexpressioncompiler.

OscarKoo avatar OscarKoo commented on May 20, 2024

@dadhi
Yes, I used your latest source which you gave me in the last issue.

Since there is no vs2015 on my machine, so I have to download "msbuild 2015" to build your dll. (https://www.microsoft.com/en-us/download/details.aspx?id=48159)

And this Exception only happens on the testing server (not on my machine). and the testing server is windows server 2008 R2 (with .net framework 4.5.1), and my machine is windows7 (with .net framework 4.5.1).

I'm not sure whether this Execption only happens in my particular scenario, either the way I built the dll or the testing server environment...

If you can not find anything wrong, maybe I have to wait your new upcoming release and try again. Thanks for your investigation.

from fastexpressioncompiler.

dadhi avatar dadhi commented on May 20, 2024

Check the v1.6 if it is still reproducible.

from fastexpressioncompiler.

OscarKoo avatar OscarKoo commented on May 20, 2024

Same exception in v1.6...

System.InvalidProgramException: Common Language Runtime detected an invalid program.
at (Closure5 , TimeSlice ) at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext()
at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)

from fastexpressioncompiler.

dadhi avatar dadhi commented on May 20, 2024

Hi @OscarKoo,

Thanks for checking. I will try to reproduce.

from fastexpressioncompiler.

dadhi avatar dadhi commented on May 20, 2024

@OscarKoo,

May I ask you to add the Test below with the sample Entity class into Test project with NUnit, targeting the same .net 4.5.1 and try to run it?

   [Test]
    public void Complex_expression_with_DateTime_Strings_and_Int()
    {
        var dtNow = DateTime.Now;
        var version = new Entity { DateType = 1, AvailableDate = dtNow };
        var startTime = "b"; // a <= b
        var endTime = "x"; // y >= x
        var timeSliceId = "42";

        Expression<Func<Entity, bool>> e = w =>
            w.DateType == version.DateType &&
            w.AvailableDate == version.AvailableDate &&
            string.Compare(w.StartTime, startTime) <= 0 &&
            string.Compare(w.EndTime, endTime) >= 0 &&
            w.Id != timeSliceId;

        var f = e.CompileFast(true);


        var tested = new Entity
        {
            DateType = 1, AvailableDate = dtNow,
            StartTime = "a", EndTime = "y"
        };
        Assert.IsTrue(f(tested));
    }

    public class Entity
    {
        public string Id { get; set; }
        public int  DateType { get; set; }
        public string StartTime { get; set; }
        public string EndTime { get; set; }
        public DateTime AvailableDate { get; set; }
    }

from fastexpressioncompiler.

dadhi avatar dadhi commented on May 20, 2024

Hi @OscarKoo,
I have released v1.9 which improves handling of ValueTypes, and may fix this issue. Is it possible for you to check?

from fastexpressioncompiler.

dadhi avatar dadhi commented on May 20, 2024

Outdated, closing.

from fastexpressioncompiler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.