-
Notifications
You must be signed in to change notification settings - Fork 3
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
Enum.IsDefined
cannot be called from within PoseContext.Isolate
#26
Comments
As of right now, no, we cannot call
Specifically the following line hints at the culprit:
|
Enum.IsDefined
be called from within PoseContext.Isolate
? cannot be called from within
PoseContext.Isolate`
cannot be called from within
PoseContext.Isolate`Enum.IsDefined
cannot be called from within PoseContext.Isolate
My investigation shows that this is caused by attempting to treat The first line in If I change the constructor stub generation to emit code as if Concern: Does this impact all value type constructors? No, it doesn't seem like it impacts all value type constructors. I attempted to call |
I found the issue. It turns out that it was completely self-inflicted. During my clean up of TL;DR; Change Detailed exampleIn the following, the line The cleaned up codepublic static DynamicMethod GenerateStubForObjectInitialization(ConstructorInfo constructor)
{
var thisType = constructor.DeclaringType ?? throw new Exception($"Method {constructor.Name} does not have a {nameof(MethodBase.DeclaringType)}");
if (thisType.IsValueType)
{
thisType = thisType.MakeByRefType();
}
if (thisType.IsValueType) // <-- THIS LINE IS CAUSING THE EXCEPTION
{
}
} In the example, the line just above the offending line transforms the value type into a by-ref value type. This means that we never enter the The original code, however, used the incoming The original codepublic static DynamicMethod GenerateStubForObjectInitialization(ConstructorInfo constructor)
{
var thisType = constructor.DeclaringType ?? throw new Exception($"Method {constructor.Name} does not have a {nameof(MethodBase.DeclaringType)}");
if (thisType.IsValueType)
{
thisType = thisType.MakeByRefType();
}
if (constructor.IsValueType) // <-- THIS LINE MAKES EVERYTHING WORK AGAIN!
{
}
} |
I'm including this in a separate patch release. This means that it will go into v2.0.1. |
…from-within-posecontextisolate #26: Enum.IsDefined cannot be called from within PoseContext.Isolate
…from-within-posecontextisolate #26: Enum.IsDefined cannot be called from within PoseContext.Isolate
…from-within-posecontextisolate #26: Enum.IsDefined cannot be called from within PoseContext.Isolate
Please refer to tonerdo/pose#26
The text was updated successfully, but these errors were encountered: