Skip to content

Commit ae84882

Browse files
fix exception when trying unsupported case for servicekey
1 parent 32d066f commit ae84882

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Ninject.Web.AspNetCore/Planning/ParameterTargetWithKeyedSupport.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ object ITarget.ResolveWithin(IContext parent)
104104
}
105105
}
106106

107+
if (result != null && !this.Type.IsAssignableFrom(result.GetType()))
108+
{
109+
throw new InvalidOperationException("Cannot convert " + result + " to " + this.Type);
110+
}
111+
107112
return result;
108113
}
109114
#endif

0 commit comments

Comments
 (0)