diff --git a/appveyor.yml b/appveyor.yml index e7ae20d..f2f4932 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,9 @@ -version: '1.2.0.{build}' +version: '1.2.1.{build}' +image: Visual Studio 2022 +environment: + matrix: + - targetframework: net48 + - targetframework: netcoreapp3.1 configuration: - Debug - Release @@ -7,7 +12,7 @@ build_script: - dotnet restore - dotnet build -c %CONFIGURATION% test_script: - - ps: dotnet test .\test\Pose.Tests\Pose.Tests.csproj + - ps: dotnet test -f %TARGETFRAMEWORK% .\test\Pose.Tests\Pose.Tests.csproj - ps: if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } cache: - '%USERPROFILE%\.nuget\packages' diff --git a/src/Pose/Helpers/StubHelper.cs b/src/Pose/Helpers/StubHelper.cs index b6e966d..ea82b76 100644 --- a/src/Pose/Helpers/StubHelper.cs +++ b/src/Pose/Helpers/StubHelper.cs @@ -80,7 +80,7 @@ public static string CreateStubNameFromMethod(string prefix, MethodBase method) if (genericArguments.Length > 0) { name += "["; - name += string.Join(',', genericArguments.Select(g => g.Name)); + name += string.Join(",", genericArguments.Select(g => g.Name)); name += "]"; } } diff --git a/src/Pose/IL/Stubs.cs b/src/Pose/IL/Stubs.cs index 05de1c5..a6facc6 100644 --- a/src/Pose/IL/Stubs.cs +++ b/src/Pose/IL/Stubs.cs @@ -4,6 +4,7 @@ using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; +using System.Runtime.Serialization; using Pose.Helpers; namespace Pose.IL @@ -26,13 +27,15 @@ internal static class Stubs static Stubs() { - s_getMethodFromHandleMethod = typeof(MethodBase).GetMethod("GetMethodFromHandle", new Type[] { typeof(RuntimeMethodHandle), typeof(RuntimeTypeHandle) }); - s_createRewriterMethod = typeof(MethodRewriter).GetMethod("CreateRewriter", new Type[] { typeof(MethodBase), typeof(bool) }); - s_rewriteMethod = typeof(MethodRewriter).GetMethod("Rewrite"); - s_getMethodPointerMethod = typeof(StubHelper).GetMethod("GetMethodPointer"); - s_devirtualizeMethodMethod = typeof(StubHelper).GetMethod("DevirtualizeMethod", new Type[] { typeof(object), typeof(MethodInfo) }); - s_getTypeFromHandleMethod = typeof(Type).GetMethod("GetTypeFromHandle"); - s_getUninitializedObjectMethod = typeof(RuntimeHelpers).GetMethod("GetUninitializedObject"); + s_getMethodFromHandleMethod = typeof(MethodBase).GetMethod(nameof(MethodBase.GetMethodFromHandle), new Type[] { typeof(RuntimeMethodHandle), typeof(RuntimeTypeHandle) }); + s_createRewriterMethod = typeof(MethodRewriter).GetMethod(nameof(MethodRewriter.CreateRewriter), new Type[] { typeof(MethodBase), typeof(bool) }); + s_rewriteMethod = typeof(MethodRewriter).GetMethod(nameof(MethodRewriter.Rewrite)); + s_getMethodPointerMethod = typeof(StubHelper).GetMethod(nameof(StubHelper.GetMethodPointer)); + s_devirtualizeMethodMethod = typeof(StubHelper).GetMethod(nameof(StubHelper.DevirtualizeMethod), new Type[] { typeof(object), typeof(MethodInfo) }); + s_getTypeFromHandleMethod = typeof(Type).GetMethod(nameof(Type.GetTypeFromHandle)); + + // see https://github.com/dotnet/runtime/blob/main/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/DefaultValueHolder.cs + s_getUninitializedObjectMethod = typeof(FormatterServices).GetMethod(nameof(FormatterServices.GetUninitializedObject)); } public static DynamicMethod GenerateStubForDirectCall(MethodBase method) diff --git a/src/Pose/Pose.csproj b/src/Pose/Pose.csproj index c664158..261fe13 100644 --- a/src/Pose/Pose.csproj +++ b/src/Pose/Pose.csproj @@ -3,7 +3,7 @@