Obfuscar .NET Obfuscation打破对My.Computer的引用

时间:2017-10-06 15:06:17

标签: vb.net obfuscation obfuscar

我们正在运行.NET应用程序,并在Obfuscar混淆的dll中引用My.Computer。似乎这些引用在运行时抛出异常。例如:

代码:

Dim str As String = My.Computer.Name

消息:

The type initializer for 'a.aa' threw an exception.

内部例外:

   System.MissingFieldException: Field not found: 'a`1.W'.
   at a.aa.a`1..ctor()
   at a.aa..cctor()

从这些错误消息中,看起来Obfuscar正在混淆对My.Computer.Name的引用。 (.NET Reflector显示aa.A.Name。)我不确定这有什么意义,因为它是一个"外部"参考

使用不同的方式获取计算机名称似乎确实有效,但我们的代码中有很多对My.Computer的引用,最好弄清楚如何让Obfuscar不要破坏这些,而不是在他们周围tip脚。

我认为我正在寻找一个Obfuscar XML条目来跳过这些引用,除非有人有更好的想法。

1 个答案:

答案 0 :(得分:1)

如果有人发现这个,我们的解决方案是将以下标志设置为false:

<Var name="HidePrivateApi" value="false" />

这显然降低了混淆的一些安全性,但它现在解决了我们的问题。