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

Rewriting methods on ConcurrentDictionary throws exception on .NET 6, 7, and 8 #55

Open
Miista opened this issue Jan 23, 2025 · 0 comments
Labels
bug Something isn't working priority: low The issue has low priority question/investigation Further information or investigation is required

Comments

@Miista
Copy link
Owner

Miista commented Jan 23, 2025

As part of #54 we disabled rewriting methods on ConcurrentDictionary. We did this because doing so would result in the following errors (detailed error messages follow below table):

Runtime Error
.NET 6 System.InvalidProgramException: Common Language Runtime detected an invalid program.
.NET 7 System.InvalidProgramException: Common Language Runtime detected an invalid program.
.NET 8 System.BadImageFormatException: Bad IL format.

.NET 6 error message

System.InvalidProgramException
Common Language Runtime detected an invalid program.
   at stub_callvirt_System.Object_GetHashCode(String& )
   at impl_System.Collections.Concurrent.ConcurrentDictionary`2[System.String,System.Collections.Concurrent.ConcurrentDictionary`2[Pose.Tests.ICollectionClass,Pose.Tests.ICollectionClass]]_TryAddInternal(ConcurrentDictionary`2 , String , Nullable`1 , ConcurrentDictionary`2 , Boolean , Boolean , ConcurrentDictionary`2& )
   at stub_call_System.Collections.Concurrent.ConcurrentDictionary`2[System.String,System.Collections.Concurrent.ConcurrentDictionary`2[Pose.Tests.ICollectionClass,Pose.Tests.ICollectionClass]]_TryAddInternal(ConcurrentDictionary`2 , String , Nullable`1 , ConcurrentDictionary`2 , Boolean , Boolean , ConcurrentDictionary`2& )
   at impl_System.Collections.Concurrent.ConcurrentDictionary`2[System.String,System.Collections.Concurrent.ConcurrentDictionary`2[Pose.Tests.ICollectionClass,Pose.Tests.ICollectionClass]]_set_Item(ConcurrentDictionary`2 , String , ConcurrentDictionary`2 )
   at stub_callvirt_System.Collections.Concurrent.ConcurrentDictionary`2[System.String,System.Collections.Concurrent.ConcurrentDictionary`2[Pose.Tests.ICollectionClass,Pose.Tests.ICollectionClass]]_set_Item(ConcurrentDictionary`2 , String , ConcurrentDictionary`2 )
   at impl_Pose.Tests.LolObject_LolMethod(LolObject )
   at stub_callvirt_Pose.Tests.LolObject_LolMethod(LolObject )
   at impl_Pose.Tests.RegressionTests+<>c__DisplayClass2_0_<Can_devirtualize_methods>b__2(<>c__DisplayClass2_0 )

.NET 7 error message

System.InvalidProgramException: Common Language Runtime detected an invalid program.

System.InvalidProgramException
Common Language Runtime detected an invalid program.
   at stub_callvirt_System.Object_GetHashCode(String&)
   at impl_System.Collections.Concurrent.ConcurrentDictionary`2[System.String,System.Collections.Concurrent.ConcurrentDictionary`2[Pose.Tests.ICollectionClass,Pose.Tests.ICollectionClass]]_TryAddInternal(ConcurrentDictionary`2, String, Nullable`1, ConcurrentDictionary`2, Boolean, Boolean, ConcurrentDictionary`2&)
   at stub_call_System.Collections.Concurrent.ConcurrentDictionary`2[System.String,System.Collections.Concurrent.ConcurrentDictionary`2[Pose.Tests.ICollectionClass,Pose.Tests.ICollectionClass]]_TryAddInternal(ConcurrentDictionary`2, String, Nullable`1, ConcurrentDictionary`2, Boolean, Boolean, ConcurrentDictionary`2&)
   at impl_System.Collections.Concurrent.ConcurrentDictionary`2[System.String,System.Collections.Concurrent.ConcurrentDictionary`2[Pose.Tests.ICollectionClass,Pose.Tests.ICollectionClass]]_set_Item(ConcurrentDictionary`2, String, ConcurrentDictionary`2)
   at stub_callvirt_System.Collections.Concurrent.ConcurrentDictionary`2[System.String,System.Collections.Concurrent.ConcurrentDictionary`2[Pose.Tests.ICollectionClass,Pose.Tests.ICollectionClass]]_set_Item(ConcurrentDictionary`2, String, ConcurrentDictionary`2)
   at impl_Pose.Tests.LolObject_LolMethod(LolObject)
   at stub_callvirt_Pose.Tests.LolObject_LolMethod(LolObject)
   at impl_Pose.Tests.RegressionTests+<>c__DisplayClass2_0_<Can_devirtualize_methods>b__2(<>c__DisplayClass2_0)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)

.NET 8 error message

System.BadImageFormatException
Bad IL format.
   at stub_call_System.Numerics.INumberBase`1[System.Int32]_IsNegative(Int32)
   at impl_System.ArgumentOutOfRangeException_ThrowIfNegative[Int32](Int32, String)
   at stub_call_System.ArgumentOutOfRangeException_ThrowIfNegative[Int32](Int32, String)
   at impl_System.Collections.Concurrent.ConcurrentDictionary`2[Pose.Tests.ICollectionClass,Pose.Tests.ICollectionClass]_.ctor(ConcurrentDictionary`2, Int32, Int32, Boolean, IEqualityComparer`1)
   at stub_call_System.Collections.Concurrent.ConcurrentDictionary`2[Pose.Tests.ICollectionClass,Pose.Tests.ICollectionClass]_.ctor(ConcurrentDictionary`2, Int32, Int32, Boolean, IEqualityComparer`1)
   at impl_System.Collections.Concurrent.ConcurrentDictionary`2[Pose.Tests.ICollectionClass,Pose.Tests.ICollectionClass]_.ctor(ConcurrentDictionary`2)
   at stub_newobj_System.Collections.Concurrent.ConcurrentDictionary`2[Pose.Tests.ICollectionClass,Pose.Tests.ICollectionClass]_.ctor()
   at impl_Pose.Tests.LolObject_LolMethod(LolObject)
   at stub_callvirt_Pose.Tests.LolObject_LolMethod(LolObject)
   at impl_Pose.Tests.RegressionTests+<>c__DisplayClass2_0_<Can_devirtualize_methods>b__2(<>c__DisplayClass2_0)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
@Miista Miista added bug Something isn't working priority: low The issue has low priority question/investigation Further information or investigation is required labels Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority: low The issue has low priority question/investigation Further information or investigation is required
Projects
None yet
Development

No branches or pull requests

1 participant