Dotfuscator Windows Phone Edition - Now Available!

We recently released a brand new version of Dotfuscator, Dotfuscator Windows Phone Edition !  It is completely free to use and has all of the instrumentation and obfuscation features of the commercial version, but is specifically designed for developers of Windows Phone 7 applications!

The purpose of this post is to get you started with mobile application analytics and obfuscation using Dotfuscator, assuming no prior knowledge.  If you don’t have your own application to try it out on, we provide both Silverlight and XNA applications (including source code) to use for testing.  Let’s get started.

Getting Dotfuscator Windows Phone Edition

Getting Dotfuscator Windows Phone Edition is as easy as filling out one simple form .  We’ll wait here while you go fill it out…

Very shortly after form submission, you will receive an email containing a link to download Dotfuscator Windows Phone Edition , a serial number for registering the product, and various credentials required to properly instrument your application and use the Runtime Intelligence portal to view application analytics.

It is important that your Organization name be distinct.  If it is not distinct (for example, if you and a coworker both enter "Foo Company"), then the license email you receive will not contain RI credentials.

Sample Applications

Dotfuscator Windows Phone Edition comes with two sample applications - one Silverlight application and one XNA game.  They include the original source code, Dotfuscator configuration files for obfuscation and instrumentation, and a link to the Runtime Intelligence Portal where application usage statistics can be viewed (found in the readme.txt of each sample).

The configuration files include best practices for application analytics & obfuscation that you can view, adjust, and apply to your own applications.

To run the sample configuration files through Dotfuscator, first copy the entire samples directory to C:\temp or any location over which you have full control (otherwise you may encounter one of two errors - a file access build error, or an ilasm.exe build error when we try to create the output assembly).  Then simply open the Dotfuscator configuration file included in the sample and click the build button.

Instrumenting Your App

Instrumentation is enabled by default, but no analytics will be collected until you use the Instrumentation tab in Dotfuscator to set the required attributes.

At a minimum, you’ll need to add a BusinessAttribute (using a GUID provided by PreEmptive in the registration email), ApplicationAttribute (to distinguish between your applications), SetupAttribute & TeardownAttribute (to track application runs, and to set up the runtime environment through which more advanced messages can sent).

Due to how application lifecycles are handled on the phone, you may need to be careful where you put your SetupAttribute & TeardownAttribute.  To get up and running with an XNA game, we suggest putting the SetupAttribute on the Initialize() method, and the TeardownAttribute on a method tied to the game’s Exiting event.  To get up and running with Silverlight apps, we suggest putting a SetupAttribute on both Application_Launching() and Application_Activated(), and the TeardownAttribute on both Application_Closing() and Application_Deactivated().

That’s all you need to do to start tracking application runs! You can collect more information, such as feature runs, feature durations, performance information, and custom data in the form of extended key dictionaries (any IDictionary<string, string>).  Check out the sample applications for examples of feature tracking & using extended key dictionaries to track things like the final score of a game.

Viewing Your Analytics

To view your analytics data, go to the Windows Phone 7 Runtime Intelligence Portal and login using the credentials from your registration email.

It can take up to 24 hours for your data to process fully and appear in reports.  You can still tell whether you have successfully instrumented your application by using the Queued Data report on the Account Overview page.

If you see no data in reports or in the Queued Data report, there’s a list of common reasons in this thread .

Obfuscating Your App

Obfuscation is fully disabled by default for new projects.  You will need to turn on each desired transform individually from the Settings tab.  The most useful features for Windows Phone 7 are Renaming, Control Flow, and String Encryption.

When you turn on Renaming or Control Flow, Dotfuscator will apply those transforms to everything in the assembly that it can (while making intelligent automatic exclusions for you in the case of certain types of reflection or XAML references).  You may need to make Renaming exclusions to compensate for certain types of reflection using the Rename | Exclude tab.  A number of these cases specific to Windows Phone 7 development are addressed in this thread .

When you turn on String Encryption, you need to use the String Encryption | Include tab to specify which strings you want to be encrypted.  To select them all, either check the box on each assembly node in the treeview, or add just one custom rule on the right by clicking "Add Namespace" and changing the Name to ".*" (without the quotes).

(For the purposes of String Encryption, it helps to turn on Removal, and change Removal | Options | Removal Kind to "Remove only literals (const definitions).")

Having Trouble?

Here’s a quickstart video that demonstrates obfuscation, instrumentation and analytics for both XNA and Silverlight applications.

If you’ve instrumented your application but are not seeing your data on the Runtime Intelligence Portal, please read this thread first.

If you’ve obfuscated your application and now it won’t start, please read this thread first.

If you encounter any problems, please search or post on our specific Windows Phone 7 analytics forum or Windows Phone 7 obfuscation forum .

Tags: ,

Leave a Reply