4
votes

To support XP one of my projects is now targeting the .NET 4.0 and using Microsoft.Bcl.Async for the async features of .NET 4.5.

The trouble is, I am not longer able to obfuscate the resulting application using Dotfuscator (either with the professional version or the community edition included with VS 2012).

When trying to run the obfuscated executable the program crashes with the following error:

Could not load type 'System.Object' from assembly 'System.Runtime, Version=2.5.19.0

That error seems to come from the app.config settings needed by Microsoft.Bcl.Async which are:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.5.19.0" newVersion="2.5.19.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.5.19.0" newVersion="2.5.19.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

It seems someone else ran into a similar issue using different obfuscation software which was fixed by the vender.

Is there something I can do to fix this? Or this an issue with Dotfuscator? (Well to be fair, all the trouble really stems from Microsoft not supporting .NET 4.5 on XP...)

1
Hmmm... interesting. I didn't know that the Bcl.Async library worked that way. I'll have to try this and see if I can find a workaround and/or file a bug internallyEarlz
"I am not longer able to obfuscate the resulting application using Dotfuscator". Are you able to run the resulting app on Windows XP (not on the machine with .NET4.5/VS2012) without obfuscating?Gennady Vanin Геннадий Ванин
@Геннадий-Ванин - Yes the app works fine on XP and other versions of Windows before obfuscating, but after obfuscating it doesn't work on any machine.Bob Smith
@Earlz Thanks for your help!Bob Smith

1 Answers

2
votes

This issue has been fixed as of Dotfuscator version 4.10.2 (released today): http://www.preemptive.com/support/dotfuscator-support/dotfuscator-pro-change-log/520

The root cause was traced to an issue with the framework's ilasm utility: https://connect.microsoft.com/VisualStudio/feedback/details/801891/ilasm-incorrectly-updates-references-from-mscorlib-to-system-runtime-for-certain-types-when-system-runtime-is-included

If for some reason you can't update, running the obfuscation on a system with ONLY .NET 4.0 installed should also be sufficient.