diff --git a/src/Microsoft.AspNet.FeatureModel/FeatureCollection.cs b/src/Microsoft.AspNet.FeatureModel/FeatureCollection.cs index 028a1c9477..d3aaff33cf 100644 --- a/src/Microsoft.AspNet.FeatureModel/FeatureCollection.cs +++ b/src/Microsoft.AspNet.FeatureModel/FeatureCollection.cs @@ -1,6 +1,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Reflection; using System.Threading; using Microsoft.AspNet.FeatureModel.Implementation; @@ -42,11 +43,7 @@ namespace Microsoft.AspNet.FeatureModel { if (_featureByFeatureType.TryGetValue(actualType, out feature)) { -#if NET45 var isInstanceOfType = type.IsInstanceOfType(feature); -#else - var isInstanceOfType = feature != null && type == feature.GetType(); -#endif if (isInstanceOfType) { @@ -54,6 +51,8 @@ namespace Microsoft.AspNet.FeatureModel } #if NET45 return Converter.Convert(type, actualType, feature); +#else + return null; #endif } } diff --git a/src/Microsoft.AspNet.FeatureModel/FeatureObject.cs b/src/Microsoft.AspNet.FeatureModel/FeatureObject.cs index fbc69b814f..42d2bf8e79 100644 --- a/src/Microsoft.AspNet.FeatureModel/FeatureObject.cs +++ b/src/Microsoft.AspNet.FeatureModel/FeatureObject.cs @@ -27,12 +27,12 @@ namespace Microsoft.AspNet.FeatureModel public object GetInterface(Type type) { -#if NET45 if (type.IsInstanceOfType(_instance)) { return _instance; } +#if NET45 foreach (var interfaceType in _instance.GetType().GetInterfaces()) { if (interfaceType.FullName == type.FullName)