Comments (11)
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.
"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.
Thanks for the info, I will get it from here.
from fastexpressioncompiler.
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.
@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.
Check the v1.6 if it is still reproducible.
from fastexpressioncompiler.
Same exception in v1.6...
System.InvalidProgramException: Common Language Runtime detected an invalid program.
at (Closure5 , TimeSlice ) at System.Linq.Enumerable.WhereEnumerableIterator
1.MoveNext()
at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
from fastexpressioncompiler.
Hi @OscarKoo,
Thanks for checking. I will try to reproduce.
from fastexpressioncompiler.
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.
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.
Outdated, closing.
from fastexpressioncompiler.
Related Issues (20)
- Optimize any nested lambda compilation (LINQ) by compiling right after collect one-by-one HOT 1
- Support LightExpression.Expression.TryConvertDelegateIntrinsic for converting one type of delegate to another
- Support custom C# printing for the LightExpression.Expression
- CompileFast doesn't work with HasFlag HOT 7
- Use UnsafeAccessAttribute to speedup the net8.0 HOT 1
- Add direct net8.0 target as soon as Appveyor CI will support it HOT 1
- Comparisons with nullable types HOT 2
- NullReferenceException with V4.X when trying to map HOT 12
- Support reading IL for Test Assertions on the NET_FRAMEWORK and on NET_7_0_OR_LESS HOT 1
- Value can not be null(parametr 'meth') HOT 17
- Allow to pass the representation of constant values to the ToCSharpString that are not literals
- System.AccessViolationException when mapping using Mapster HOT 1
- ToCSharpString outputs ? for Nullable which does not produce the compile-able code HOT 1
- ToExpressionString wrongly declares Label instead of LabelTarget array HOT 1
- Support ToCSharpString of the block in the ternary expression
- Calling a user defined == operator runs into a CLR invalid program exception HOT 2
- Optimize conditional expressions with the DefaultExpression left or right operand the same way as ConstantExpression HOT 1
- Fix and optimize the Switch support HOT 1
- Optimize Switch with OpCodes.Switch
- Coalesce nullable with 0 is not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastexpressioncompiler.