Skip to content

Interface properties are not available on implementor classes that have been obfuscated #1181

Closed

Description

@tracktownsoftware

Environment

  • Pythonnet version: 2.5.1
  • Python version: 3.7.7
  • Operating System: Windows 10 (10.0.1863 Build 18363)

Details

  • Describe what you were trying to get done.

The .Net Framework assembly I'm using has been obfuscated.

  • Most classes in the assembly implement properties for ISomeInterface
  • Property names on classes have been obfuscated into gibberish, including property names that implement ISomeInterface
  • In C# I can get at ISomeInterface properties when the object is cast to type ISomeInterface
  • In python+pythonnet the ISomeInterface properties are not available. I do see property names that are obfuscated gibberish.

My workaround in python+pythonnet is to call the get_{interfacepropertyname} and set_{interfacepropertyname} methods that are available. Pythonnet apparently sees that an interface is implemented.

If it helps I can make a simple obfuscated .Net Framework assembly showing this issue.

What are your thoughts? I'm new to Python and maybe there is a way to cast an object to an interface that I'm not seeing. Thanks.

Activity

  1. lostmsu commented on Jul 10, 2020

    @lostmsu
    Member

    Python does not have a notion of "casting" types, which causes this problem. However, Python.NET might provide functions for that in the future. We already have something similar for choosing between function overloads.

  2. tracktownsoftware commented on Jul 10, 2020

    @tracktownsoftware
    Author

    Thank you for your quick response! I'll look into working with the owner of the assembly to see if obfuscation can be dialed back a bit.

  3. lostmsu commented on Feb 21, 2021

    @lostmsu
    Member

    This should be fixed with #1240

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