Serious Bug in Autofac 3.5.2 Breaks My Entire Project!!

81 views
Skip to first unread message

kayode...@gmail.com

unread,
Apr 22, 2016, 10:07:28 AM4/22/16
to Autofac
Upgraded to Autofac 3.5.2 and getting tons of Specified Cast Not Valid exceptions. I was able to isolate the problem to the following scenario:

public class Test
{
public Test(double data)
{

}
}
class Program
{
static void Main(string[] args)
{
ContainerBuilder builder = new ContainerBuilder();
builder.RegisterType<Test>().WithParameters(new[] {new PositionalParameter(0, 1),}).AsSelf();
var container = builder.Build();
var colorBucket = container.Resolve<Test>();

}
}


This code throws an Exception saying Specified Cast not Valid in version 3.5.2. If I revert to my old version of 2.5.3.830 this code works fine. It seems that somewhere along the upgrade path they removed the ability to autocast parameters. My entire project relies on that ability so I have to revert back to the old version.

Travis Illig

unread,
Apr 22, 2016, 12:47:01 PM4/22/16
to Autofac
Already filed as issue on GitHub. We can follow up there. https://github.com/autofac/Autofac/issues/738
Reply all
Reply to author
Forward
0 new messages