Application crashes at start-up after obfuscation

.NET obfuscator and automated error reporting

Moderators: Luke Jefferson, melvyn.harbour, dom.smith

Application crashes at start-up after obfuscation

Postby YurySG » Mon Jul 01, 2013 4:37 am

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
YurySG
 
Posts: 3
Joined: Mon Jul 01, 2013 4:28 am

Postby jessica.ramos » Wed Jul 03, 2013 12:00 am

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
Technical Support
Red Gate Software Ltd.
jessica.ramos
 
Posts: 235
Joined: Mon Apr 23, 2012 1:13 pm

Re:

Postby YurySG » Fri Jul 12, 2013 9:49 pm

jessica.ramos wrote: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".

jessica.ramos wrote: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.
YurySG
 
Posts: 3
Joined: Mon Jul 01, 2013 4:28 am

Postby rs » Sun Jul 21, 2013 10:51 pm

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?
rs
 
Posts: 11
Joined: Wed May 12, 2010 10:18 am

Postby YurySG » Mon Jul 22, 2013 1:10 am

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
 
Posts: 3
Joined: Mon Jul 01, 2013 4:28 am

Re:

Postby Soyin » Tue Aug 27, 2013 9:29 pm

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!
Soyin
 
Posts: 1
Joined: Tue Aug 27, 2013 9:16 pm


Return to SmartAssembly 6

Who is online

Users browsing this forum: No registered users and 0 guests