Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with NET7 #79

Open
paillave opened this issue Jul 13, 2023 · 2 comments
Open

Issue with NET7 #79

paillave opened this issue Jul 13, 2023 · 2 comments

Comments

@paillave
Copy link

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
@ividyon
Copy link

ividyon commented Sep 18, 2023

#17
Downgrading fro 1.2.1 to 1.1.0 did work for me, but I'm still not sure if the library is even doing anything atm

@Miista
Copy link

Miista commented Jan 12, 2024

@paillave @ividyon There's a bug in versions above 1.1.0 (at least that's my experience). I haven't been able to shim anything with versions above 1.1.0.

Miista added a commit to Miista/pose that referenced this issue Jan 25, 2024
Release v2.0 to NuGet

Version 2.0 supports the following targets:
* .NET Standard 2.0
* .NET Core 2.0
* .NET Core 3.0
* .NET Framework 4.8
* .NET 7
* .NET 8

Version 2.0 fixes the following issues:
* tonerdo/pose#17
* tonerdo/pose#37
* tonerdo/pose#38
* tonerdo/pose#41
* tonerdo/pose#47
* tonerdo/pose#49
* tonerdo/pose#60
* tonerdo/pose#67
* tonerdo/pose#68
* tonerdo/pose#70
* tonerdo/pose#71
* tonerdo/pose#72
* tonerdo/pose#75
* tonerdo/pose#79
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants