pose icon indicating copy to clipboard operation
pose copied to clipboard

Bug with a test app

Open DmitryJustDmitry opened this issue 3 years ago • 0 comments

Hi, stumled in something looks like a bug.

  1. Create simple app:
using System;
using Pose;
namespace HelloWorld
{
    class Hello {         
        static void Main(string[] args)
        {
             Shim dtShim = Shim.
                Replace(() => DateTime.Now).
                With(() => new DateTime(2004, 4, 4));
            PoseContext.Isolate(() => {Console.WriteLine(DateTime.Now);}, dtShim);
            System.Console.WriteLine("Fine!");
        }
    }
}
  1. And a simple project:
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <LangVersion>8.0</LangVersion> 
    <Nullable>enable</Nullable>
    <IsPackable>false</IsPackable>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Pose" Version="1.2.1" />
  </ItemGroup>
</Project>
  1. Trying to debug (Ubuntu 20.04, VS Code (latest), .net 6, built with dotnet build -a x64) - getting infinite stack message, ending like:

at DynamicClass.stub_System.SR_get_Arg_PlatformNotSupported(System.RuntimeMethodHandle, System.RuntimeTypeHandle) at DynamicClass.dynamic_System.PlatformNotSupportedException_.ctor(System.PlatformNotSupportedException) at DynamicClass.stub_ctor_System.PlatformNotSupportedException_.ctor(System.RuntimeMethodHandle, System.RuntimeTypeHandle) at DynamicClass.dynamic_Internal.Runtime.CompilerServices.Unsafe_As(Char ByRef) at DynamicClass.stub_Internal.Runtime.CompilerServices.Unsafe_As(Char ByRef, System.RuntimeMethodHandle, System.RuntimeTypeHandle) at DynamicClass.dynamic_System.String_EqualsHelper(System.String, System.String) at DynamicClass.stub_System.String_EqualsHelper(System.String, System.String, System.RuntimeMethodHandle, System.RuntimeTypeHandle)

at DynamicClass.stub_System.String_Equals(System.String, System.String, System.RuntimeMethodHandle, System.RuntimeTypeHandle) at DynamicClass.stub_System.String_op_Equality(System.String, System.String, System.RuntimeMethodHandle, System.RuntimeTypeHandle) at DynamicClass.dynamic_System.Resources.ResourceManager_GetFirstResourceSet(System.Resources.ResourceManager, System.Globalization.CultureInfo) at DynamicClass.stub_System.Resources.ResourceManager_GetFirstResourceSet(System.Resources.ResourceManager, System.Globalization.CultureInfo, System.RuntimeMethodHandle, System.RuntimeTypeHandle) at DynamicClass.dynamic_System.Resources.ResourceManager_GetString(System.Resources.ResourceManager, System.String, System.Globalization.CultureInfo) at DynamicClass.stub_virt_System.Resources.ResourceManager_GetString(System.Resources.ResourceManager, System.String, System.Globalization.CultureInfo, System.RuntimeMethodHandle, System.RuntimeTypeHandle) at DynamicClass.dynamic_System.SR_InternalGetResourceString(System.String) at DynamicClass.stub_System.SR_InternalGetResourceString(System.String, System.RuntimeMethodHandle, System.RuntimeTypeHandle) at DynamicClass.dynamic_System.SR_GetResourceString(System.String) at DynamicClass.stub_System.SR_GetResourceString(System.String, System.RuntimeMethodHandle, System.RuntimeTypeHandle)

at DynamicClass.stub_System.SR_get_Arg_PlatformNotSupported(System.RuntimeMethodHandle, System.RuntimeTypeHandle) at DynamicClass.dynamic_System.PlatformNotSupportedException_.ctor(System.PlatformNotSupportedException) at DynamicClass.stub_ctor_System.PlatformNotSupportedException_.ctor(System.RuntimeMethodHandle, System.RuntimeTypeHandle) at DynamicClass.dynamic_Internal.Runtime.CompilerServices.Unsafe_As(System.IO.TextWriter ByRef) at DynamicClass.stub_Internal.Runtime.CompilerServices.Unsafe_As(System.IO.TextWriter ByRef, System.RuntimeMethodHandle, System.RuntimeTypeHandle) at DynamicClass.dynamic_System.Threading.Volatile_Read(System.IO.TextWriter ByRef) at DynamicClass.stub_System.Threading.Volatile_Read(System.IO.TextWriter ByRef, System.RuntimeMethodHandle, System.RuntimeTypeHandle) at DynamicClass.dynamic_System.Console_get_Out() at DynamicClass.stub_System.Console_get_Out(System.RuntimeMethodHandle, System.RuntimeTypeHandle) at DynamicClass.dynamic_System.Console_WriteLine(System.Object) at DynamicClass.stub_System.Console_WriteLine(System.Object, System.RuntimeMethodHandle, System.RuntimeTypeHandle) at DynamicClass.dynamic_HelloWorld.Hello+<>c_<Main>b__0_2(<>c) at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Span`1<System.Object> ByRef, System.Signature, Boolean, Boolean) at System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo) at System.Delegate.DynamicInvokeImpl(System.Object[]) at System.Delegate.DynamicInvoke(System.Object[]) at Pose.PoseContext.Isolate(System.Action, Pose.Shim[]) at HelloWorld.Hello.Main(System.String[])

DmitryJustDmitry avatar Jan 06 '22 11:01 DmitryJustDmitry