解决 dotfuscator 无法正常编译的问题

某天准备生成APPX包,突然就一直生成不了了,查看任务管理器,在运行一个ildsm的任务,强行中断编译过程,输出结果可以看出是在混淆过程的出的问题

一步步reset-hard commit 定位问题,发现是 https://github.com/manuelroemer/Nullable 包的引入导致的问题

在配置文件中增加以下内容

      
<namespace name="System.Diagnostics.CodeAnalysis" />

<type name=".*" regex="true" excludetype="false"> <method name=".*" regex="true"> <customattribute name="System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute" regex="true" /> </method> </type>

仍然无效

改成

      <type name=".*" regex="true" excludetype="false">
        <method name=".*" regex="true">
          <customattribute name="System.Diagnostics.CodeAnalysis.*" regex="true"/>
        </method>
      </type>

还是无效

尝试把原来就有的

      <type name=".*Attribute" regex="true" />

改成

      <type name=".*Attribute" regex="true" >
        <method name=".*" regex="true" />
        <propertymember name=".*" regex="true" />
        <field name=".*" regex="true" />
      </type>

仍然无效

目前确定两个与nullable有关的commit c0be5606 Commit 16359c10的确导致了这个问题。但具体是哪些操作导致的待查。

原文地址:https://www.cnblogs.com/yinyue200/p/12710927.html