-
-
Notifications
You must be signed in to change notification settings - Fork 65
Closed
Description
Extracted from comment in #303
Here is another test case that does not work event with 0.35.2, though it actually is basically same just with different arguments,
and it this case IsValidAt1 is ok but all others produce error (IsValidAt2 has interface as argument, IsValidAt3 has unused argument, IsValid4 without argument):
And yes this is all working properly in 0.34.2 (found problems only after i upgraded to 0.35 and my project queries basically all broke)
using DelegateDecompiler;
using System;
using System.Linq;
namespace ConsoleApp1;
static class Program
{
static void Main()
{
var q = new Entity[0].AsQueryable();
var p = new Provider();
var a = DecompileExtensions.Decompile(q.Where(x => x.IsValidAt1(DateTime.Now)));
var b = DecompileExtensions.Decompile(q.Where(x => x.IsValidAt2(p)));
var c = DecompileExtensions.Decompile(q.Where(x => x.IsValidAt3(DateTime.Now)));
var d = DecompileExtensions.Decompile(q.Where(x => x.IsValidAt4()));
}
[Computed]
public static bool IsValidAt1<TEntity>(this TEntity entity, DateTime dateTime) where TEntity : ITimeValidity => entity.IsValidAt(dateTime);
[Computed]
public static bool IsValidAt2<TEntity>(this TEntity entity, IDateTimeProvider dateTimeProvider) where TEntity : ITimeValidity => entity.IsValidAt(dateTimeProvider.Now);
[Computed]
public static bool IsValidAt3<TEntity>(this TEntity entity, DateTime dateTime) where TEntity : ITimeValidity => entity.IsValidAt(DateTime.Now);
[Computed]
public static bool IsValidAt4<TEntity>(this TEntity entity) where TEntity : ITimeValidity => entity.IsValidAt(DateTime.Now);
}
public interface IDateTimeProvider
{
public DateTime Now => default;
}
public interface ITimeValidity
{
public bool IsValidAt(DateTime time) => default;
}
public class Entity : ITimeValidity
{
}
public class Provider : IDateTimeProvider
{
}
System.NotSupportedException
HResult=0x80131515
Message=The IL opcode 'ldobj' is not supported by DelegateDecompiler. This opcode cannot be decompiled into an expression tree. Consider simplifying the method or using a different approach.
Source=DelegateDecompiler
StackTrace:
at DelegateDecompiler.Processor.ProcessInstruction(ProcessorState state, Instruction instruction)
...
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels