Skip to content

Commit

Permalink
Migrated to VS2017 - multitarget .netstandard1.5 and .net45
Browse files Browse the repository at this point in the history
  • Loading branch information
jbtule committed Mar 21, 2017
1 parent 366b3bd commit bc454e4
Show file tree
Hide file tree
Showing 42 changed files with 691 additions and 275 deletions.
35 changes: 15 additions & 20 deletions Dynamitey.sln
Original file line number Diff line number Diff line change
@@ -1,45 +1,40 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dynamitey", "Dynamitey\Dynamitey.csproj", "{CE699AB8-4122-4369-BAA6-76244A0734E4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{CB47488D-6ECE-4697-90C2-3BDA8488F00C}"
ProjectSection(SolutionItems) = preProject
.nuget\NuGet.Config = .nuget\NuGet.Config
.nuget\NuGet.exe = .nuget\NuGet.exe
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
# Visual Studio 15
VisualStudioVersion = 15.0.26228.9
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{691EBA79-CAA4-4670-BC8B-4537F990ADBF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{C33F07DB-7ACB-4081-92C2-BB739CB605C0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SupportLibrary1", "SupportLibrary1\SupportLibrary1.csproj", "{348152A9-6A9C-4115-B60A-9E08CA72451D}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SupportLibrary", "SupportLibrary\SupportLibrary.csproj", "{18E19833-D47E-4A7F-AE64-31E28FEF8728}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dynamitey", "Dynamitey\Dynamitey.csproj", "{8902AFBA-4ACA-4880-B606-ADEC6BB21A1B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CE699AB8-4122-4369-BAA6-76244A0734E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE699AB8-4122-4369-BAA6-76244A0734E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE699AB8-4122-4369-BAA6-76244A0734E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE699AB8-4122-4369-BAA6-76244A0734E4}.Release|Any CPU.Build.0 = Release|Any CPU
{C33F07DB-7ACB-4081-92C2-BB739CB605C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C33F07DB-7ACB-4081-92C2-BB739CB605C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C33F07DB-7ACB-4081-92C2-BB739CB605C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C33F07DB-7ACB-4081-92C2-BB739CB605C0}.Release|Any CPU.Build.0 = Release|Any CPU
{348152A9-6A9C-4115-B60A-9E08CA72451D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{348152A9-6A9C-4115-B60A-9E08CA72451D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{348152A9-6A9C-4115-B60A-9E08CA72451D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{348152A9-6A9C-4115-B60A-9E08CA72451D}.Release|Any CPU.Build.0 = Release|Any CPU
{18E19833-D47E-4A7F-AE64-31E28FEF8728}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{18E19833-D47E-4A7F-AE64-31E28FEF8728}.Debug|Any CPU.Build.0 = Debug|Any CPU
{18E19833-D47E-4A7F-AE64-31E28FEF8728}.Release|Any CPU.ActiveCfg = Release|Any CPU
{18E19833-D47E-4A7F-AE64-31E28FEF8728}.Release|Any CPU.Build.0 = Release|Any CPU
{8902AFBA-4ACA-4880-B606-ADEC6BB21A1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8902AFBA-4ACA-4880-B606-ADEC6BB21A1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8902AFBA-4ACA-4880-B606-ADEC6BB21A1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8902AFBA-4ACA-4880-B606-ADEC6BB21A1B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{C33F07DB-7ACB-4081-92C2-BB739CB605C0} = {691EBA79-CAA4-4670-BC8B-4537F990ADBF}
{348152A9-6A9C-4115-B60A-9E08CA72451D} = {691EBA79-CAA4-4670-BC8B-4537F990ADBF}
{18E19833-D47E-4A7F-AE64-31E28FEF8728} = {691EBA79-CAA4-4670-BC8B-4537F990ADBF}
EndGlobalSection
EndGlobal
3 changes: 2 additions & 1 deletion Dynamitey/CacheableInvocation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Runtime.CompilerServices;
using Dynamitey.Internal.Optimization;
using Microsoft.CSharp.RuntimeBinder;
using System.Reflection;

namespace Dynamitey
{
Expand Down Expand Up @@ -261,7 +262,7 @@ public override object Invoke(object target, params object[] args)
{
case InvocationKind.Constructor:
var tTarget = (Type) target;
return InvokeHelper.InvokeConstructorCallSite(tTarget, tTarget.IsValueType, args, _argNames,
return InvokeHelper.InvokeConstructorCallSite(tTarget, tTarget.GetTypeInfo().IsValueType, args, _argNames,
ref _callSite);
case InvocationKind.Convert:
return InvokeHelper.InvokeConvertCallSite(target, _convertExplicit, _convertType, _context,
Expand Down
47 changes: 25 additions & 22 deletions Dynamitey/Dynamic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@

using System.Collections.Generic;
using System.Dynamic;
using System.Globalization;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading;

using Dynamitey.Internal;
using Dynamitey.Internal.Optimization;
Expand All @@ -30,7 +31,7 @@ namespace Dynamitey
using System;




/// <summary>
/// Main API
Expand All @@ -47,7 +48,7 @@ static Dynamic()
{
try
{
ComObjectType = typeof(object).Assembly.GetType("System.__ComObject");
ComObjectType = typeof(object).GetTypeInfo().Assembly.GetType("System.__ComObject");
ComBinder = new DynamicObjects.LateType(
"System.Dynamic.ComBinder, System.Dynamic, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
}
Expand Down Expand Up @@ -130,7 +131,7 @@ public static CallSite<T> CreateCallSite<T>(CallSiteBinder binder, String_OR_Inv
/// <returns></returns>
public static dynamic Linq(object enumerable)
{
if(enumerable.GetType().GetInterfaces().Where(it=>it.IsGenericType)
if(enumerable.GetType().GetTypeInfo().GetInterfaces().Where(it=>it.GetTypeInfo().IsGenericType)
.All(it => it.GetGenericTypeDefinition() != typeof(IEnumerable<>)))
{
var tEnum = enumerable as System.Collections.IEnumerable;
Expand Down Expand Up @@ -529,7 +530,7 @@ public static dynamic Curry(object target, int? totalArgCount = null)
/// <returns></returns>
public static dynamic Curry(Delegate target)
{
return new Curry(target, target.Method.GetParameters().Length);
return new Curry(target, target.GetMethodInfo().GetParameters().Length);
}


Expand Down Expand Up @@ -693,11 +694,12 @@ public static dynamic InvokeConvert(object target, Type type, bool @explicit =fa
/// <returns></returns>
public static dynamic CoerceToDelegate(object invokeableObject, Type delegateType)
{
if (!typeof(Delegate).IsAssignableFrom(delegateType.BaseType))
var delegateTypeInfo = delegateType.GetTypeInfo();
if (!typeof(Delegate).GetTypeInfo().IsAssignableFrom(delegateTypeInfo.BaseType))
{
return null;
}
var tDelMethodInfo = delegateType.GetMethod("Invoke");
var tDelMethodInfo = delegateTypeInfo.GetMethod("Invoke");
var tReturnType = tDelMethodInfo.ReturnType;
var tAction = tReturnType == typeof(void);
var tParams = tDelMethodInfo.GetParameters();
Expand All @@ -707,7 +709,7 @@ public static dynamic CoerceToDelegate(object invokeableObject, Type delegateTyp
: InvokeHelper.WrapFunc(tReturnType, invokeableObject, tLength);


if (!InvokeHelper.IsActionOrFunc(delegateType) || tParams.Any(it => it.ParameterType.IsValueType))
if (!InvokeHelper.IsActionOrFunc(delegateType) || tParams.Any(it => it.ParameterType.GetTypeInfo().IsValueType))
//Conditions that aren't contravariant;
{
Delegate tGetResult;
Expand Down Expand Up @@ -800,7 +802,8 @@ internal static readonly Type TypeConverterAttributeSL
/// <returns></returns>
public static dynamic CoerceConvert(object target, Type type)
{
if (target != null && !type.IsInstanceOfType(target) && !IsDBNull(target))
var typeInfo = type.GetTypeInfo();
if (target != null && !typeInfo.IsInstanceOfType(target) && !IsDBNull(target))
{

var delegateConversion = CoerceToDelegate(target, type);
Expand All @@ -809,7 +812,7 @@ public static dynamic CoerceConvert(object target, Type type)
return delegateConversion;


if (type.IsInterface && Impromptu.IsAvailable)
if (typeInfo.IsInterface && Impromptu.IsAvailable)
{


Expand Down Expand Up @@ -841,20 +844,20 @@ public static dynamic CoerceConvert(object target, Type type)
catch (RuntimeBinderException)
{
Type tReducedType = type;
if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>))
if (typeInfo.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>))
{
tReducedType = type.GetGenericArguments().First();
tReducedType = typeInfo.GetGenericArguments().First();
}

if (typeof (Enum).IsAssignableFrom(tReducedType) && target is string)
if (typeof (Enum).GetTypeInfo().IsAssignableFrom(tReducedType) && target is string)
{
target = Enum.Parse(tReducedType, target as String, true);

}
else if (target is IConvertible && typeof (IConvertible).IsAssignableFrom(tReducedType))
else if (target is IConvertible && typeof (IConvertible).GetTypeInfo().IsAssignableFrom(tReducedType))
{

target = Convert.ChangeType(target, tReducedType, Thread.CurrentThread.CurrentCulture);
target = Convert.ChangeType(target, tReducedType, CultureInfo.DefaultThreadCurrentCulture);

}
else
Expand All @@ -869,7 +872,7 @@ public static dynamic CoerceConvert(object target, Type type)
else if (TypeConverterAttributeSL != null)
{
var tAttributes =
tReducedType.GetCustomAttributes(TypeConverterAttributeSL, false);
tReducedType.GetTypeInfo().GetCustomAttributes(TypeConverterAttributeSL, false);
dynamic attribute = tAttributes.FirstOrDefault();
if (attribute != null)
{
Expand All @@ -893,11 +896,11 @@ public static dynamic CoerceConvert(object target, Type type)
}
}
}
else if (((target == null) || IsDBNull(target )) && type.IsValueType)
else if (((target == null) || IsDBNull(target )) && typeInfo.IsValueType)
{
target = Dynamic.InvokeConstructor(type);
}
else if (!type.IsInstanceOfType(target) && IsDBNull(target))
else if (!typeInfo.IsInstanceOfType(target) && IsDBNull(target))
{
return null;
}
Expand All @@ -913,7 +916,7 @@ public static dynamic CoerceConvert(object target, Type type)
public static dynamic InvokeConstructor(Type type, params object[] args)
{
string[] tArgNames;
bool tValue = type.IsValueType;
bool tValue = type.GetTypeInfo().IsValueType;
if (tValue && args.Length == 0) //dynamic invocation doesn't see constructors of value types
{
return Activator.CreateInstance(type);
Expand All @@ -935,7 +938,7 @@ public static dynamic InvokeConstructor(Type type, params object[] args)
/// <returns></returns>
public static object FastDynamicInvoke(this Delegate del, params object[] args)
{
if(del.Method.ReturnType == typeof(void)){
if(del.GetMethodInfo().ReturnType == typeof(void)){

InvokeHelper.FastDynamicInvokeAction(del, args);
return null;
Expand Down Expand Up @@ -974,7 +977,7 @@ public static IEnumerable<string> GetMemberNames(object target, bool dynamicOnly
var tList = new List<string>();
if (!dynamicOnly)
{
tList.AddRange(target.GetType().GetProperties().Select(it => it.Name));
tList.AddRange(target.GetType().GetTypeInfo().GetProperties().Select(it => it.Name));
}

var tTarget = target as IDynamicMetaObjectProvider;
Expand All @@ -984,7 +987,7 @@ public static IEnumerable<string> GetMemberNames(object target, bool dynamicOnly
}else
{

if (ComObjectType != null && ComObjectType.IsInstanceOfType(target) && ComBinder.IsAvailable)
if (ComObjectType != null && ComObjectType.GetTypeInfo().IsInstanceOfType(target) && ComBinder.IsAvailable)
{
tList.AddRange(ComBinder.GetDynamicDataMemberNames(target));
}
Expand Down
1 change: 0 additions & 1 deletion Dynamitey/DynamicObjects/BaseDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
using System.Dynamic;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Threading;
using Dynamitey.Internal.Optimization;
using Microsoft.CSharp.RuntimeBinder;
Expand Down
1 change: 0 additions & 1 deletion Dynamitey/DynamicObjects/BaseForwarder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
using System.Dynamic;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text;
using Dynamitey.Internal.Optimization;
using Microsoft.CSharp;
Expand Down
6 changes: 3 additions & 3 deletions Dynamitey/DynamicObjects/BaseObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
using System.ComponentModel;
using System.Dynamic;
using System.Linq;
using System.Runtime.Serialization;

using System.Reflection;


namespace Dynamitey.DynamicObjects
{

Expand Down Expand Up @@ -109,7 +109,7 @@ object IServiceProvider.GetService(Type serviceType)
{
aggreTypes.AddType(serviceType);

if (serviceType.IsInterface && Dynamic.Impromptu.IsAvailable)
if (serviceType.GetTypeInfo().IsInterface && Dynamic.Impromptu.IsAvailable)
{
return Dynamic.Impromptu.DynamicActLike(this, aggreTypes.GetInterfaceTypes());
}
Expand Down
4 changes: 2 additions & 2 deletions Dynamitey/DynamicObjects/Builder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Reflection;
using Dynamitey.Internal.Optimization;
Expand Down Expand Up @@ -411,7 +410,8 @@ public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, o
result = InvokeHelper(binder.CallInfo, args,tBuildType);
if (TryTypeForName(binder.Name, out tType))
{
if (tType.IsInterface && result != null && !tType.IsAssignableFrom(result.GetType()))
var typeInfo = tType.GetTypeInfo();
if (typeInfo.IsInterface && result != null && !typeInfo.IsAssignableFrom(result.GetType()))
{
// result = Impromptu.DynamicActLike(result, tType);
}
Expand Down
1 change: 0 additions & 1 deletion Dynamitey/DynamicObjects/Dictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
using System.Dynamic;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;


namespace Dynamitey.DynamicObjects
Expand Down
1 change: 0 additions & 1 deletion Dynamitey/DynamicObjects/Dummy.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using Dynamitey.Internal.Optimization;

Expand Down
Loading

0 comments on commit bc454e4

Please sign in to comment.