Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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'
2 changes: 1 addition & 1 deletion src/Pose/Helpers/StubHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 += "]";
}
}
Expand Down
17 changes: 10 additions & 7 deletions src/Pose/IL/Stubs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/Pose/Pose.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Title>Pose</Title>
<Description>Replace any .NET method (including static and non-virtual) with a delegate</Description>
<PackageVersion>1.2.1</PackageVersion>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<DebugType>portable</DebugType>
<AssemblyName>Pose</AssemblyName>
<PackageId>Pose</PackageId>
Expand Down
2 changes: 1 addition & 1 deletion test/Pose.Tests/Pose.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1;net48</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down