-
-
Notifications
You must be signed in to change notification settings - Fork 837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delegate factory with parameter name 'value' throws #1275
Comments
I am able to reproduce the issue using the above code. The full exception with stack trace is:
The exception source is actually in the property injector, and, sure enough, if you remove Which makes a little more sense, as |
I figured out the issue and laughed out loud because it totally makes sense. In the There are, of course, two ways a parameter can match:
Basically, the delegate factory is passing in a named parameter The 99.9% case is that parameters getting passed in here are typed parameters, so it's safe to match like this. However, this little thing seems like a special case we'll just have to handle due to the reserved word overlap. |
Fix #1275: Filter out 'value' named parameters during property injection
Describe the Bug
Delegate factory throws on instance activation when it has parameter with name
value
Steps to Reproduce
Expected Behavior
Delegate factory should produce properly activated component with
Service
property resolved.Exception with Stack Trace
Autofac.Core.DependencyResolutionException : An exception was thrown while activating UnitTests.MyComponent.
---- System.InvalidCastException : Unable to cast object of type 'System.String' to type 'UnitTests.ISomeService'.
Dependency Versions
Autofac: 6.2.0
Additional Info
What I've tried so far:
So, to work around the issue, delegate factory should not have parameter with name
value
.The text was updated successfully, but these errors were encountered: