Application crashes at start-up after obfuscation

YurySGYurySG Posts: 5 Bronze 1
edited February 19, 2015 8:17AM in SmartAssembly
We've been using SA for many years and it was problem free experience.
Our app is .Net 4.0 based. Recently we had .Net 4.5 installed on the build PC and ran into a problem.

After obfuscation application starts just fine on the build PC but crashes at start-up on any other computer. The problem is caused by SmartAssembly, because if obfuscation is turned off the app launches just fine on other PCs as well.

So I tried to play with SA's project setting and turned off all optimizations except resigning obfuscated assembly with .snk key. It didn't help the app still crashes on all computers except the build PC.

Here is the error I'm receiving.
AppName: appname.exe AppVer: 6.9.7.0 AppStamp:51d0944a
ModName: kernel32.dll ModVer: 5.1.2600.6293 ModStamp:506bc5e5
fDebug: 0 Offset: 00012fd3

What can be done to troubleshoot this problem?

We use SA 6.6.4.95

PS: Unfortunately uninstalling .Net 4.5 is not an options since it's required by TFS 2013 server

Thanks

Comments

  • Jessica RJessica R Posts: 1,319 Rose Gold 4
    Thanks for your post and sorry to hear you're running into some trouble with SmartAssembly!

    Just to confirm--if the app has obfuscation turned off but you still build it through SmartAssembly (with no options enabled), does that build run on other machines without crashing?

    I'm also curious.. is .NET 4.5 installed on any of the other machines you've tested on?

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


  • YurySGYurySG Posts: 5 Bronze 1
    Thanks for your post and sorry to hear you're running into some trouble with SmartAssembly!
    Just to confirm--if the app has obfuscation turned off but you still build it through SmartAssembly (with no options enabled), does that build run on other machines without crashing?
    It happens with all the obfuscations turned off. The only option shown "green" in SmartAssembly is Generate Debug Info. All other options are turned off "yellow".
    I'm also curious.. is .NET 4.5 installed on any of the other machines you've tested on?
    Yes, .Net 4.5 is installed. Our application is targeting .Net 4.0.

    This is becoming a showstopper for us, please advise what we should do next.
  • rsrs Posts: 13 Bronze 2
    We too have hit this problem I think, when we upgraded our build server to use VS 2012 - in our case our obfuscated .exe starting failing to run on machines with .NET 4.0 and not .NET 4.5 installed. The problem that manifests is this one:
    http://stackoverflow.com/questions/1089 ... ssembly-ms

    .. the unobfuscated assemblies work fine so VS is building assemblies with the correct target framework version. Seems to me likely that SmartAssembly is picking up .NET assemblies from the .NET framework folder (which is .NET 4.5 where some types have been moved around) and not the .NET reference assembly folder when building.

    Can I tell SmartAssembly that it should always look in the reference assemblies path when building the "SmartAssemblyfied" version of our assemblies?
  • YurySGYurySG Posts: 5 Bronze 1
    With help of a very helpful lady from the support we have been able to find the cause of the problem. SA is very sensitive to the version of reference assemblies that are used during obfuscation and when you run your application.

    Basically what was happening is that during obfuscation version 9.0.XXX of a reference assembly was used. But the installation of the application contained version 9.0.YYY of reference assemblies. Apparently that's what was causing crashes.
  • YurySG wrote:
    With help of a very helpful lady from the support we have been able to find the cause of the problem. SA is very sensitive to the version of reference assemblies that are used during obfuscation and when you run your application.

    Basically what was happening is that during obfuscation version 9.0.XXX of a reference assembly was used. But the installation of the application contained version 9.0.YYY of reference assemblies. Apparently that's what was causing crashes.

    Can you share the solution with the rest of us?

    We are having this issue as well. In my case, the application is being built with with the .net 4.0 reference assemblies and works as expected when it's not obfuscated. After running it through obfuscation, it no longer runs and gives an error about a missing type which was added in .net 4.5. Is there a way to tell SmartAssembly to use the dlls from C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0?

    Thanks!
  • grothaggrothag Posts: 3 Bronze 1
    What is solution for this ?
Sign In or Register to comment.