Describe the bug
I have the following code:
public interface IEntity { }
public class Entity<T> : IEntity { }
var entityType = typeof(Entity<>).MakeGenericType(typeof(int));
var constructor = entityType.GetConstructor(Type.EmptyTypes);
var initializer = constructor!.ConstructObjectInitializer<IEntity>();
An exception will always be thrown saying that the constructor was obtained from a different type.
Expected behavior
I want the generated expression to be typed according to the known base type.
Environment (please complete the following information):
- OS: Windows 11
- .NET Version: .NET 7
- Package Version: 1.1.2