Skip to content

Issue with NET7 #79

@paillave

Description

@paillave

What am I doing wrong here?
https://dotnetfiddle.net/PdKvbF

using System;
using Pose;

public class Program
{
	public static void Main()
	{
		Shim dateTimeShim = Shim.Replace(() => DateTime.Now).With(() => new DateTime(2004, 4, 4));
		PoseContext.Isolate(() =>
		{
			// Outputs "4/4/04 12:00:00 AM"
			Console.WriteLine(DateTime.Now);
		}, dateTimeShim);
	}
}

I get this:

Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.InvalidProgramException: Common Language Runtime detected an invalid program.
   at dynamic_System.Collections.Generic.Dictionary`2[System.String,System.Resources.ResourceLocator]_FindValue(Dictionary`2, String)
   at dynamic_System.Collections.Generic.Dictionary`2[System.String,System.Resources.ResourceLocator]_TryGetValue(Dictionary`2, String, ResourceLocator&)
   at dynamic_System.Resources.RuntimeResourceSet_GetObject(RuntimeResourceSet, String, Boolean, Boolean)
   at dynamic_System.Resources.RuntimeResourceSet_GetString(RuntimeResourceSet, String, Boolean)
   at dynamic_System.Resources.ResourceManager_GetString(ResourceManager, String, CultureInfo)
   at dynamic_System.SR_InternalGetResourceString(String)
   at dynamic_System.SR_GetResourceString(String)
   at dynamic_System.PlatformNotSupportedException_.ctor(PlatformNotSupportedException)
   at stub_ctor_System.PlatformNotSupportedException_.ctor(RuntimeMethodHandle, RuntimeTypeHandle)
   at dynamic_System.Runtime.CompilerServices.Unsafe_As(TextWriter&)
   at dynamic_System.Threading.Volatile_Read(TextWriter&)
   at dynamic_System.Console_get_Out()
   at dynamic_System.Console_WriteLine(Object)
   at dynamic_Program+<>c_<Main>b__0_2(<>c)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at Pose.PoseContext.Isolate(Action entryPoint, Shim[] shims)
   at Program.Main()
Command terminated by signal 6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions