-
-
Notifications
You must be signed in to change notification settings - Fork 65
Closed
Description
In following code decompiling Ext2() throws error while decompiling Ext1() works properly.
This only happens in recent 0.35 version, it works properly with previous version.
The only difference in extension methods is explicit type casting in Ext1() while Ext2() uses implicit casting because of generic constraint.
using DelegateDecompiler;
using System.Linq;
namespace ConsoleApp1;
static class Program
{
static void Main()
{
var q = new Cls[0].AsQueryable();
var a = DecompileExtensions.Decompile(q.Select(x => x.Ext1()));
var b = DecompileExtensions.Decompile(q.Select(x => x.Ext2()));
}
[Computed]
public static int Ext1<T>(this T value) where T : Intf => ((Intf)value).Value;
[Computed]
public static int Ext2<T>(this T value) where T : Intf => value.Value;
}
public interface Intf
{
public int Value { get; }
}
public class Cls : Intf
{
public int Value { get; set; }
}
System.NotSupportedException
HResult=0x80131515
Message=The IL opcode 'constrained.' 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