From 6782c8e1e92218321a078011c7a5b7021626291f Mon Sep 17 00:00:00 2001 From: Simon Gockner Date: Thu, 13 Jun 2019 11:10:50 +0200 Subject: [PATCH] - add targetFramework .net45 - change creation of empty array for .net45 --- LightweightIocContainer/LightweightIocContainer.csproj | 4 +++- .../Registrations/TypedFactoryRegistration.cs | 5 +++++ .../Test.LightweightIocContainer.csproj | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/LightweightIocContainer/LightweightIocContainer.csproj b/LightweightIocContainer/LightweightIocContainer.csproj index ff860b7..dd7c631 100644 --- a/LightweightIocContainer/LightweightIocContainer.csproj +++ b/LightweightIocContainer/LightweightIocContainer.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + netstandard2.0;net45 SimonG Copyright(c) 2019 SimonG. All Rights Reserved. A lightweight IOC Container that is powerful enough to do all the things you need it to do. @@ -10,6 +10,7 @@ latest true https://github.com/SimonG96/LightweightIocContainer + 1.1.0-beta2 @@ -20,6 +21,7 @@ + diff --git a/LightweightIocContainer/Registrations/TypedFactoryRegistration.cs b/LightweightIocContainer/Registrations/TypedFactoryRegistration.cs index 9978ef0..ee3d1d1 100644 --- a/LightweightIocContainer/Registrations/TypedFactoryRegistration.cs +++ b/LightweightIocContainer/Registrations/TypedFactoryRegistration.cs @@ -115,8 +115,13 @@ namespace LightweightIocContainer.Registrations } else { +#if NET45 + generator.Emit(OpCodes.Ldc_I4_0); + generator.Emit(OpCodes.Newarr, typeof(object)); +#elif NETSTANDARD MethodInfo emptyArray = typeof(Array).GetMethod(nameof(Array.Empty))?.MakeGenericMethod(typeof(object)); generator.EmitCall(OpCodes.Call, emptyArray, null); +#endif } generator.EmitCall(OpCodes.Callvirt, typeof(IIocContainer).GetMethod(nameof(IIocContainer.Resolve), new[] { typeof(Type), typeof(object[])}), null); diff --git a/Test.LightweightIocContainer/Test.LightweightIocContainer.csproj b/Test.LightweightIocContainer/Test.LightweightIocContainer.csproj index 5fa4de4..21cccf3 100644 --- a/Test.LightweightIocContainer/Test.LightweightIocContainer.csproj +++ b/Test.LightweightIocContainer/Test.LightweightIocContainer.csproj @@ -1,7 +1,7 @@ - netcoreapp2.1 + netcoreapp2.1;net45 false