What are the challenges you face when working across database platforms? Take the survey

Odd behaviour application-wide after obfuscation with SA 6.90.114

DarrenSDarrenS Posts: 1 New member
Terribly sorry for the obtuse question title, but I'm not sure how else to summarize this.

I've begun obfuscating a fairly significant C# .NET project after several years of development and I'm seeing a large number of unusual situations that, while consistent with a particular obfuscated version, can seemingly change between obfuscation compiles. While we've applied obfuscation to other products with success, this is the first time we've tried to obfuscate our primary product (it's ~750k lines) and the result is too inconsistent to release. This project incorporates OpenGL and WinForms.

Some examples of issues I've seen are UI-related such as being unable to leave a DataGridView cell after editing (e.g., the cursor remains trapped inside a cell), or some OnValueChanged events not firing for NumericUpDown controls, etc. Other examples might manifest as math failures (such as a value on a Y-axis of a plot not being correct).



In this case, the image on the left (from our unobfuscated version) is correct while the image on the right is incorrect.

The code that generates the values is fairly straightforward, but I'll be the first to admit that some aspects of obfuscation elude me and that I could be missing something. In the event the comments aren't sufficient, the following code is invoked to determine what the y-axis labels for the plot should be and iterates over each label position in order to set them.

It seems like the obfuscator is adding some unnecessary casting as an int here or that the order of operations for the multiplication is being changed.

// determine the range for the plotted value
float range = this.max - this.min;
// determine the 'step' size that represents the number of ticks we'll be using on the legend
float step = range / (this.numTicks - 1);

// generate the text values for the y-axis labels
for (int i = 1; i < this.numTicks - 1; i++)
  // Obtain the text instance from the library library
  ti = textLib.Get(string.Format("{0}_tick_{1}", this.name, i));

  // set the text value for the y-axis label
  ti.Text = string.Format("{0:#.##e+00}", this.min + step * i);

Something in there, or related to that is not playing nicely with obfuscation, but I'm not sure what. 

Then, when the plot is rendered, the following code is called:

// Iterate over y-axis labels
for (int i = 0; i < this.numTicks; i++)
  // obtain the y-axis text instance object
  ti = textLib.Get(string.Format("{0}_tick_{1}", this.name, i));

  // set the position of the y-axis text instance object
  ti.Position = new System.Drawing.Point((int)(rampLeft - 14 - ti.Length), (int)(this.tickPositions[i].Y + rampBottom - 4));

  // render

Again, this code works fine pre-obfuscation.

Anyway, I'm looking for any suggestions on even where to start. My project settings follow:

  • No strong naming
  • No automated error reporting
  • No feature usage reporting
  • Several merged dependencies
  • No dependency embedding (this appeared to cause other issues)
  • All assemblies obfuscated with Unicode unprintable characters and standard renaming (although I've tried less intense versions of this option without success)
  • Strongest control flow obfuscation for all assemblies
  • References dynamic proxy for all assemblies
  • Resource compression and encryption for all resources
  • Strings encoded with improved encryption, and compressed
  • MSIL disassembler protection enabled
  • No debugging information generated
  • (all other settings off/disabled)
I've tried many variations on this without success - all permutations result in a UI that is either corrupt or unusable in some manner.

Thanks to all who take a look. At this point I'm not sure whether we'll be able to proceed with obfuscating this product in the manner we had hoped, so any input would be very welcome.


Sign In or Register to comment.