当我混淆此表单并“调试”它时
public partial class Form1 : Form
{
public void Form1()
{
InitializeComponents();
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
Console.WriteLine("Name: "+this.Name);
Console.WriteLine("FullName: "+this.GetType().FullName);
}
}输出如下:
名称: Form1 FullName:#Yab.#Zab
问题
为什么FullName被混淆了?
Form1是公开的,所以我希望SmartAssembly会忽略它。
附加信息
Form1是public partial,designer.cs也是
我的SmartAssembly设置如下:
<ApplicationName />
<Destination DestinationFileName=".\bin.obfuscated\MyProject.Form1.exe" />
<Assemblies>
<Assembly AssemblyName="MyProject.Form1, Culture=neutral, PublicKeyToken=omitted">
<Merging>
<ResourcesCompression Compress="0" />
<MemberRefsProxy />
<Pruning />
<Obfuscation Obfuscate="1">
<Exclusions />
</Obfuscation>
<ControlFlow Obfuscate="1" />
</Merging>
</Assembly>
</Assemblies>
<Options>
<Obfuscation FieldsNameMangling="2" NameMangling="1" />
<ExceptionReporting />
<FeatureUsageReporting Template="res:SmartUsageWithUIConsentFirstRun1033.dll" />
<StrongNameSigning KeyFileName="PathToKeyFile" Sign="1" />
<OtherProtections />
<StringsEncoding />
<OtherOptimizations />
<Debugging />
</Options>发布于 2014-06-12 13:33:22
首先,在应用程序项目中,公共类不会被SmartAssembly忽略(在库项目中它将被忽略)。
其次,表单的名称属性是在运行时设置的属性。在您的例子中,它可能被初始化为代码中的某个地方的"Form1“,也许在设计器中。
此值可以随时更改,例如:
public Form1()
{
InitializeComponent();
this.Name = "foo";
}因此,SmartAssembly不能混淆这个值,这将是错误的,并会改变您的代码的行为。
当SmartAssembly混淆您的代码时,它只更改类型、字段和方法的名称。当您试图获取类型的名称时,获取类型的模糊名称是合乎逻辑的。
https://stackoverflow.com/questions/24056299
复制相似问题