Search code examples
windowsxamarinxamarin.androidvisual-studio-2017dotfuscator

Dotfuscator with Xamarin android fails build after Analyzing markup


I'm trying to use Dotfuscator Community edition with Visual Studio 2017 to build Xamarin for Android app. Visual Studio output gave me error:

1>C:\xp\XamarinForms\XamarinForms\XamarinForms.Android\PreEmptive.Dotfuscator.Xamarin.targets(347,5): error MSB3073: The command ""C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Extensions\PreEmptiveSolutions\DotfuscatorCE\dotfuscatorCLI.exe" /p:InDir="obj\Release\DotfuscatorXamarin\dfin",OutDir="obj\Release\DotfuscatorXamarin\dfout",ReportDir="DotfuscatorReports\Release" "DotfuscatorConfig.xml"" exited with code 1.

When I run that command using cmd.exe, I have the following output:

[Build Output] Resolving method references...
[Build Output] Analyzing Markup...
[Build Output] Value cannot be null.
Parameter name: key
[Build Output] Build Error.

I've opened DotfuscatorConfig.xml in Dotfuscator GUI app and tried to change some options. After I have disabled renaming in Renaming->Options->Enable renaming, build was succesfull, but it makes obfuscation pointless without renaming.

Can you help me to find, what exactly causing this problem and how to fix it?


Solution

  • (Disclaimer: I work for PreEmptive Solutions on the Dotfuscator team, and am answering this question in that capacity.)

    Update (2018-03-15): The fix for this issue has been shipped in Dotfuscator Community Edition 5.34.0 (changelog, note the "Markup Analysis" fix). You can always download the latest version for Visual Studio 2017 here.

    The previous answer, written before this release, follows.


    This appears to be a Markup Analysis bug that was recently fixed in Dotfuscator Professional Edition 4.33.0 (changelog). While this fix is not currently released in Community Edition 5.32.1 (the edition shipped with Visual Studio 2017 15.5), as a workaround for now you can disable Markup Analysis. This is better than turning renaming off entirely.

    To disable Markup Analysis, add a project property to your Dotfuscator config file with the name disable_markup_analysis and the value true. You can do this with the Community Edition GUI, or, if you'd prefer, by editing the config file directly:

    1. Open the DotfuscatorConfig.xml file in a text editor.
    2. Within the root <dotfuscator> section, add a child <propertylist> tag and its closing </propertylist> tag if they doesn't already exist.
    3. Within the <propertylist> section, add the tag <property name="disable_markup_analysis" value="true" />.