是否可以从ILAsm文件中删除.property语句以供生产使用? [英] Is it OK to remove .property statements from ILAsm files for production use?

查看:173
本文介绍了是否可以从ILAsm文件中删除.property语句以供生产使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据修改ILASM文件在我模糊的程序仍在工作。 (参考其中C#方法名不应混淆?

Still working on my obfuscation program based on modifying ILAsm files. (Ref. Which C# method names should not be obfuscated? )

在看ILASM代码,我得到了.property语句不用于任何东西,至少对于执行程序的印象。我是正确的思维,他们只在那里为Visual Studio提供元数据?如果是这样,它是OK简单地删除它们时ILASM代码将只用于生产,将永远不会与Visual Studio中使用的生产模块?

In looking at the ILAsm code, I get the impression that the .property statements aren't used for anything, at least not for program execution. Am I right in thinking they are only there to provide metadata for Visual Studio? And if so, is it OK to simply remove them when the ILAsm code will only be used to produce production modules that will never be used with Visual Studio?

推荐答案

你是正确的,事实的东西被声明为一个属性不影响程序的执行。
作为本书的微软内部.NET IL汇编有关物业在介绍该章的状态,JIT编译器和执行引擎是完全不知道的属性,并没有IL指令做出任何引用该属性的概念。

You're correct that the fact something is declared as a property does not affect program execution. As the book Inside Microsoft .NET IL Assembler states in its introduction to the chapter concerning properties, the JIT compiler and execution engine are completely unaware of properties, and no IL instructions make any reference to the property concept.

请注意,Visual Studio是没有元数据的只有消费者。如果你带 .property 和重组,您将有getter和setter方法,但它显然不是一个属性了。这其中,最明显的例子变成了一个问题:如果一个什么对象的实例被传递给它使用反射来调用类的每个属性的另一种方法?属性不会被发现和运行时的行为已更改为所提出的混淆方法的结果。

Note that Visual Studio is not the only consumer of metadata. If you strip .property and reassemble, you'll have the getter and setter methods, but it obviously isn't a property any more. The most obvious example of where this becomes a problem : what if an instance of an object gets handed off to another method which uses reflection to invoke each property on the class? The properties would not be found and run-time behavior has changed as a result of the proposed obfuscation method.

当然,情景如反射和序列化是一个常见的问题与混淆工具,在你前面的问题进行了讨论。所以,我要说的是,这是有问题的,但其在一组类似的情景那些在其他线程讨论的问题 - 尤其是那些元数据被消耗或正在运行时进行序列化场景

Of course, scenarios such as reflection and serialization are a common gotcha with obfuscation tools, as was discussed in your previous question. So, what I'm saying is, it is problematic, but its problematic in a similar set of scenarios as those discussed in your other thread -- particularly those scenarios where metadata is being consumed or serialization is being performed at run-time.

我上面提到的具有不同的名称本书的最新版本:的专家.NET 2.0 IL汇编;它可能是你一个有益的参考。 编译为.NET公共语言运行也可能是有价值的。

The latest edition of the book I mentioned above has a different name: Expert .NET 2.0 IL Assembler; it may be a useful reference to you. Compiling for the .NET Common Language Runtime may also be valuable.

这篇关于是否可以从ILAsm文件中删除.property语句以供生产使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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