Visitar URL original
cannot get anymore int of enumerator class (alpha2) · Issue #1809 · pythonnet/pythonnet · GitHub
Skip to content

cannot get anymore int of enumerator class (alpha2) #1809

Description

@maxcapodi78

Environment

  • Pythonnet version: 3.0.0 Alpha 2
  • Python version: 3.9
  • Operating System: Windows
  • .NET Runtime:

Details

  • Describe what you were trying to get done.

    In v2.5.2 I'm able to get a C# Enumerator and get the int value. In alpha 2 it seems that the full enumerator class is returned but the int command is not working.

  • What commands did you run to trigger this issue? If you can provide a
    Minimal, Complete, and Verifiable example
    this will help us understand the issue.

    my_enum = csharp_object.GetObjType()
    int(my_enum) --> Failing now, working before
  • If there was a crash, please include the traceback here.
    cannot get int of object of class ComponentType (name of enumerator class)

Activity

  1. filmor commented on Jun 8, 2022

    @filmor
    Member

    You mean enum, right? An Enumerator is a very different thing.

    This issue should be fixed on the current master (if you have the .NET SDK installed, you can install it using pip install git+https://github.com/pythonnet/pythonnet, I'll cut it as rc1 this weekend (see #1661).

    Thanks for the report, and feel free to reopen if this doesnot work for you :)

  2. maxcapodi78 commented on Jun 8, 2022

    @maxcapodi78
    Author

    Hi @filmor you are correct. Thank you. I'll test it asap

  3. maxcapodi78 commented on Jun 8, 2022

    @maxcapodi78
    Author

    Hi @filmor I've checked and the problem is still there. now it's even worst because it is making crashing the debugger. the picture shows the expression evaluation of the enum and the int command that makes failing the debugger.
    image

  4. maxcapodi78 commented on Jun 8, 2022

    @maxcapodi78
    Author

    @filmor I cannot reopen the PR since you have to do it.

  5. maxcapodi78 commented on Jun 8, 2022

    @maxcapodi78
    Author

    @filmor I've also done a deeper check and verified that my object has the int property. When I try to call explicitily I get the following error

    Out[13]: <bound method 'int'>

    Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
    at Python.Runtime.Runtime.PyLong_FromLongLong(Int64 value)
    at Python.Runtime.PyInt..ctor(Int64 value)
    at Python.Runtime.EnumOps`1.int(T value)
    --- End of inner exception stack trace ---
    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
    at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    at Python.Runtime.MethodBinder.Invoke(BorrowedReference inst, BorrowedReference args, BorrowedReference kw, MethodBase info, MethodBase[] methodinfo)
    at Python.Runtime.MethodObject.Invoke(BorrowedReference target, BorrowedReference args, BorrowedReference kw, MethodBase info)
    at Python.Runtime.MethodBinding.tp_call(BorrowedReference ob, BorrowedReference args, BorrowedReference kw)

    Process finished with exit code -532462766

  6. maxcapodi78 commented on Jun 8, 2022

    @maxcapodi78
    Author

    I've created another issue. We can keep this one closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions