From ffb73a1ed8a3fe6da38303127c277e33952efedb Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Thu, 27 Mar 2014 15:07:28 -0700 Subject: [PATCH] Fix build issues with Injector This was causing intellisense failures in VS. It looks like the commandline is able to accidentally pick up the compatability extensions from the model binding assembly, but this is not the case in VS. Changed this code not to rely on compatability extensions. --- src/Microsoft.AspNet.Mvc.Core/Injector.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNet.Mvc.Core/Injector.cs b/src/Microsoft.AspNet.Mvc.Core/Injector.cs index 461550241d..826cbde3c4 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Injector.cs +++ b/src/Microsoft.AspNet.Mvc.Core/Injector.cs @@ -32,7 +32,12 @@ namespace Microsoft.AspNet.Mvc { var type = obj.GetType(); - var property = type.GetProperty(propertyName); + var property = type.GetRuntimeProperty(propertyName); + if (property == null) + { + return; + } + if (property.PropertyType.IsAssignableFrom(typeof(TProperty))) { property.SetValue(obj, value); @@ -43,7 +48,12 @@ namespace Microsoft.AspNet.Mvc { var type = obj.GetType(); - var property = type.GetProperty(propertyName); + var property = type.GetRuntimeProperty(propertyName); + if (property == null) + { + return; + } + if (property.PropertyType.IsAssignableFrom(typeof(TProperty))) { property.SetValue(obj, services.GetService());