解决方法在Dotfuscator反思错误? [英] Workaround for Reflection Bug in Dotfuscator?

查看:350
本文介绍了解决方法在Dotfuscator反思错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我打电话Type.GetProperties(),但在运行Dotfuscator后,它返回零的项目,当它返回大于零了。

I am calling Type.GetProperties(), but after running Dotfuscator, it is returning zero items, when it returned more than zero before.

public class Test
{
    public int Number { get; set; }

    public void ShowInfo()
    {
        Type type = this.GetType();

        PropertyInfo[] props = type.GetProperties();
        Console.WriteLine("type [" + type.Name + "] props count: " + props.Length);
    }
}

如果我排除了数财产内Dotfuscator重命名,那么它的工作原理,但除此之外,它没有。但是,我不可能做到这一点的在我的项目的所有属性,因为这会导致可能的错误。

If I exclude the "Number" property from renaming within Dotfuscator, then it works, but otherwise it doesn't. However, it is not possible for me to do this for all properties in my project, as it would lead to possible bugs.

是否有任何的变通方法?甚至其他免费加密应用程序,我可以用?

Are there any workarounds for this method? Or even other "free" obfuscation applications I could use?

我已经试图寻找在其网站上提交错误,但我只使用社区版所以似乎并没有对尽可能多的支持。

I have already tried looking on their website to submit a bug, but I am only using the community edition so there doesn't seem to be as much support for it.

推荐答案

Dotfuscator自动去除属性(只是元数据无论如何 - 真正的工作是通过get / set方法对的方法自动创建完成)重命名时。它还重命名底层get / set方法为好。根据你正在努力做什么,你都需要从重命名排除任何属性的元数据本身,还是get / set方法(也可能两者都有)。

Dotfuscator automatically strips properties (which are just metadata anyway - the real work is done by the get/set pair of methods that are automatically created) during renaming. It also renames the underlying get/set methods as well. Depending on what you are trying to do, you'll need to exclude either the property metadata itself, or the get/set methods (or possibly both) from renaming.

如果您需要保留的财产元数据的完整性(例如,简单地列出一个类型的属性),您可以指示Dotfuscator从检查他们在重命名排除选项卡上的树形视图或使用​​重命名排除特性自定义的正则表达式物业的规定。这只会排除属性的元数据 - 该get / set方法仍然会更名为

If you need to keep the property metadata intact (for example, to simply list the properties in a Type), you can instruct Dotfuscator to exclude properties from renaming by checking them in the tree view on the Renaming Exclusions tab or using a custom regex property rule. This will only exclude the property metadata - the get/set methods will still be renamed.

如果您需要保持get / set方法(因为,例如,你想获取或设置由反射属性值),您可以指示Dotfuscator排除那些方法由扩展属性的树重命名查看和检查get / set方法下,或通过使用自定义的正则表达式的方法规则。

If you need to keep the get/set methods (because, for example, you are trying to get or set a property's value by reflection), you can instruct Dotfuscator to exclude those methods from renaming by expanding the property in the tree view and checking the get/set methods underneath, or by using a custom regex method rule.

这篇关于解决方法在Dotfuscator反思错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆