Author Archive

Cheap CEIP

Monday, February 8th, 2010 by Joe Kuemerle

Spring is (hopefully) just around the corner here in the northern hemisphere, with warming weather a young man’s fancy turns to that age old question…"what exactly are my users doing with my application?"

We’re familiar with big software vendors including Customer Experience Improvement Program (CEIP) features in their applications allowing them to gather anonymous usage data showing which features people are actually using. Analyzing that data allows them to focus their development efforts on what their users are actually doing, as well as obtaining hard measurements of how features are actually adopted in the wild. As someone whose paycheck depends on meeting the users’ requirements I really like to know how much of my time is being spent developing stuff that people actually want and use. Unfortunately, I don’t have the huge number of person-years and dollars to spend on something that is not directly related to my core application functionality to get a CEIP into my products.

CEIP Dialogs

Instrumenting an application to send its usage data back to the free Runtime Intelligence portal hosted by PreEmptive is covered in some previous blog posts (here and here ), but today I am covering a slightly different scenario. While there are great analytics capabilities in the hosted portal, my current needs are only basic usage tracking and that I must store the data at my own facility. As is normally the case in proof-of-concept situations, I have no budget, no time, and am highly visible to non-technical decision makers.

The first problem, no budget, is easily solved by using freely available tools. First, I am going to use Dotfuscator Community Edition 5.0, included in my copy of Visual Studio 2010, to perform injection of the application analytics functionality into my binaries. Since I need to store the usage data at my location I can’t use the hosted free endpoint and reporting portal, but I can use the new open source (Ms-RL license) Runtime Intelligence Endpoint Starter Kit (RI Starter Kit) to build my own application usage listener service, data repository, and basic reports.

Instrumentation via extended attributes in Dotfuscator UI

The fact that I have no time to implement this is also solved by my selection of tools. Since this is a proof-of-concept, I don’t need to create any extra code to obtain the users opt-in consent for tracking application usage. This means I can leverage Dotfuscator’s post compilation code injection model, similar to IL Weaving in Aspect Orientated Programming, to inject usage tracking directly into my test application binary without changing any source code or recompiling. In a matter of minutes I navigate through my applications structure and define the injection points from within the Dotfuscator user interface. To create a database using either SQL Express 2005 or higher or MySQL 5 or higher only takes a few minutes. Finally, setting up the WCF service project only requires updating the connection string in the web.config. Using the outstanding documentation included in the RI Starter Kit as my guide in less than an 30 minutes I have a proof of concept for tracking how often my application is run and which features the users are actually using.

Application analytics feature use report

Finally, I have to show something useful to the non-technical users. I know that application analytics data is being sent to my endpoint and stored in the database. I can easily run a few queries to get a feel for how the application is being used but not everyone is as comfortable with SQL as I am. As I review the source code included in the RI Starter Kit I see that there is also a SQL Server Reporting Services solution that contains two prewritten reports that show application and feature usage over time. A quick update of the data source, a deploy to the SSRS server, and now the business users have an easy way of seeing what our users like best about our products. To add application analytics data to executive dashboards, there’s also a SharePoint Web Part included so you can easily put an application usage graph directly into any SharePoint site (WSS 3.0 / MOSS 2007 or higher).

Application analytics SharePoint dashboard

All in all, I have spent around an hour and no money adding basic application usage tracking and analysis to an existing product and exposed that data to both technical and non-technical users. With only a small amount of code, I easily add an opt-in dialog to my product so my users can choose to send their usage data for analysis.  Now I have the start of my very own Customer Experience Improvement Program.

PreEmptive is always looking for feedback on our products, please take this new solution for a spin and leave us comments, feature requests and ideas on the project’s Codeplex page.

Dotfuscator 4.6.1200 Released

Thursday, February 4th, 2010 by Joe Kuemerle

We just shipped the latest update to Dotfuscator, the 4.6.1200 version.  This is mostly a bugfix release but includes a small enhancement that supports using project properties in the ClickOnce package signing certificate path, allowing for better portability of project files between build environments.

There are a number of updates to fix small issues in packaging support, improve handling of mixed mode assemblies and address some issues with Visual Studio integration.

For a summary of the changes in Dotfuscator 4.6.1200 check out the change log here or subscribe to the change log in your RSS reader here .

This update is available to all customers who are current with their maintenance.  Download it here , give it a try, and let us know what you think.

Dotfuscator 4.6.1000 Released (and other news)

Monday, November 9th, 2009 by Joe Kuemerle

It has been an extremely busy few months here at PreEmptive.  In addition to continuing the work for our inclusion in Visual Studio 2010, launching a new website , updating our product fulfillment, working on a PDC presentation , preparing for our spot in the TechEd EMEA 2009 keynote and other top secret stuff, the development team has turned out a huge major release of Dotfuscator.  The big news is there are some nice improvements; the bigger news is that Dotfuscator can now process an entire directory of files, a Silverlight XAP, or an entire ClickOnce application without requiring any manual steps of recreating XAPs or regenerating and resigning ClickOnce manifests.  We call this new functionality Packaging and we have even more plans for it in the future.

With Packaging, Dotfuscator is significantly more flexible and it’s much easier to have a fully integrated obfuscation/instrumentation process for Silverlight, ClickOnce, or a project with a fluctuating list of component assemblies.

This means we can gladly retire a few of our KnowledgeBase articles! Now, you can take the XAP file or ClickOnce deploy manifest that Visual Studio emits, include it as an input to Dotfuscator, and Dotfuscator will parse it and allow you to work with the all the contained assemblies in the user interface just as you would any other assembly.  When you build, Dotfuscator outputs a new XAP or full ClickOnce application (including updated and signed manifests). You have now just roundtripped a XAP or ClickOnce application through Dotfuscator with no additional outside steps required to rebuild your deployment artifacts.

Dotfuscator 4.6 Input Screenshot

In the above screenshot you can see a demonstration of the new Packaging support.  I have added a Silverlight XAP (SilverlightEuCountries.xap) and Dotfuscator shows the application library that will be processed as well as the System.Xml.Linq assembly, embedded manifest and the XML data file that will be included in the XAP file that Dotfuscator will output.  I have also added a ClickOnce application by selecting the deploy manifest (ClickOnceDemo.application) and we see that Dotfuscator will process the application assembly and include the icon file that was originally deployed with the application in the new deployment that Dotfuscator will output.  Finally I have added a directory wildcard (C:\temp\MedicalImage\MedicalImage\SourceCode\CSharp\bin\x86\Debug\*.*) as a third input.  The directory package will process the MedicalImage.exe application as well as it’s ContosoFunctions.dll library.  The the files listed in the Package Artifacts will be copied to the output directory so that the application config file and Microsoft Access database file are now included in the output from the build process.  I now do not have to invoke any post build file copy process in order to have a fully functional application and supporting files as the output from a Dotfuscator build. You can view short instructional videos on the See It Work page for Dotfuscator.

If that were all that was included in this release, it would be big news. But we’ve also added a new feature to our Runtime Intelligence instrumentation as well.  You have always been able to create extra data at runtime and send it back as a name/value dictionary embedded in your usage messages with the Extended Keys feature.  Now we have added a new property (“ExtendedKeyMethodArguments”) to all attributes that support extended keys. This tells Dotfuscator to inject code that gathers the names and values of the instrumented method’s arguments and send them as additional Extended Key data.  This means that if you are interested in exactly which values are being passed to your methods at runtime you no longer have to write additional code to gather and present the data as Extended Keys; you can specify that you want the names and values of all parameters or a subset of the parameters to be collected each time the method is invoked and included in any other Extended Key data that you may be sending back.  We also changed how some of our instrumentation works to provide a better experience for instrumenting add-ins for Office, Visual Studio, or any situation where your assembly may be hosted in a different process.

Since we stay on the bleeding edge our releases always include support for the very latest from Microsoft.  Dotfuscator 4.6.1000 is no exception.  We provide full integration with Visual Studio 2010 Beta 2 and support for .NET 4.0 applications, both obfuscation and instrumentation.

Since Visual Studio 2010 Beta 2 has a Go Live license we also provide a similar Go Live license for the Community Edition of Dotfuscator Software Services included in Visual Studio 2010.  This allows you to use the Runtime Intelligence instrumentation features included in Dotfuscator and to send usage data from your application to the free Runtime Intelligence portal which allows you to analyze your applications’ runtime environments and usage patterns.

Also included in this release are bug fixes and UI enhancements.  The best way to stay informed of any updates to Dotfuscator is to watch or subscribe to the changelog .  You can also follow us on Twitter for updates on what we are doing.

We have been working hard on this release and have much more in store for the future.  Please feel free to contact us at support@preemptive.com with any feedback or stop by and see us at TechEd EMEA , PDC 2009 or CodeMash 2010 .  Keep up with where we are going and interesting articles on our News & Events page.

With that I would like to congratulate the entire development team at PreEmptive for the extraordinary amount of work they have been doing and give a warning to Codemash that the entire development team from PreEmptive is going to be there in force this year.

Dotfuscator 4.5.1200

Wednesday, July 8th, 2009 by Joe Kuemerle

We just shipped the latest update to Dotfuscator, the 4.5.1200 version.  This release adds beta support for integration with Visual Studio 2010 Beta 1 as well as the ability to obfuscate and instrument .NET 4.0 assemblies.

Also in this release, we have added the ability to add expiration behavior to Compact Framework applications via Shelf Life.

We now support obfuscating Silverlight 3 assemblies.  In addition we have made numerous enhancements, especially to our Smart Obfuscation technology that analyzes assemblies and detects items that should be automatically excluded from renaming or removal.  We also expanded our built in rules, that provide you with an easy to use way to add preconfigured renaming and removal exclusion rules that match your situation.

We added the ability for Dotfuscator PRO to insert the SuppressIldasmAttribute into your output assemblies, thus preventing them from being disassembled by Microsoft’s Ildasm utility.  In addition, if you use Dotfuscator to create PDB’s for your application you now have greater flexibility in selecting the sequence points in your PDB and JIT optimizations for your assemblies.

We have also made many usability enhancements, including the option to have Dotfuscator search the User Defined Assembly Load Paths first rather than last when resolving references.  New preprocessing analysis has also been added to better discern cases where an already obfuscated assembly is added as an input assembly as well as enhancements to the build process.

As with any release we have resolved several customer and product issues.  One of the most interesting issues was that the analysis of large (> 1MB) methods with significant branching was failing on x64 machines with a StackOverflowException.  We build Dotfuscator targeting the AnyCPU platform so that it will run as a 64 bit application on x64 operating systems and as a 32 bit application on non-x64 systems.  We found that we could reproduce the exception on an x64 test system but if we changed our executable to force it to 32 bit mode the exception did not occur.  This is unusual behavior, as normally pure managed code provides a great abstraction from the data size of the underlying operating system.  In this case the issue may have been caused by the larger sized data in x64 depleting the allocated stack space more rapidly than 32 bit sized data.  Luckily, our crack team of developers was able to alter our algorithm to work around this situation so that we can continue to compile as AnyCPU and take full advantage of the easily available extra address space of x64 systems.

For a summary of the changes in Dotfuscator 4.5.1200 check out the change log here or subscribe to the change log in your RSS reader here .

This update is available to all customers who are current with their maintenance.  Download it here , give it a try, and let us know what you think.

Correlating Downloads to Usage With Visual Studio 2010

Wednesday, June 24th, 2009 by Joe Kuemerle

Introduction

This is the second article in my ongoing series on how to use the new, free features available in Dotfuscator Software Services Community Edition in Visual Studio 2010.  In addition to obfuscation, it allows you to track how users are using your applications; and, it can inject additional functionality such as tamper detection and application expiration.  For an introduction to Runtime Intelligence and an overview of the new features included in Dotfuscator CE, see the introductory article in this series What Is Runtime Intelligence .  I also recommend that you read the What’s New with Dotfuscator in Visual Studio 2010 Beta 1 post, a walkthrough that demonstrates some of the same new Dotfuscator CE features I will be using here.

For this example we will be using the Witty Twitter application as our sample application.  This is an open source WPF Twitter client and is available here .

Our current problem as the developer of a Windows client application is once the end user has downloaded our software we have no way of knowing if they actually installed it, much less used it.  There are a number of ways that I have seen people try to track the ratio of installations to downloads, including opening a special web page as part of the installation routine and using web analytics data to infer installations.  There is a similar issue with usage.  You don’t know if anyone started the application, unless it crashes spectacularly, and then you only hear from the three irate users and not the millions of satisfied users.

By using the new Runtime Intelligence capabilities in Dotfuscator CE you can quickly and easily determine how many people actually install and run your application.  You can gather additional details such as which operating systems and CLR versions they are using.  Since Dotfuscator CE can do this through post compilation code injection you don’t need to modify your source code to add these new capabilities to your application.

To accomplish all of this I will be using the publicly available Visual Studio 2010 Beta 1.  As long as you choose to install Dotfuscator and the Windows SDK you will have all of the tools you will need.

Implementation Without Source Code Modification

This article shows how you can add application analytics to an existing application without modifying the source code.  The first step is to download the latest Witty Twitter installer and install it.

Next, copy all of the files from the Witty installation directory to a temporary location to use as a working directory.  This is necessary because the Witty executable has dependencies on other assemblies that are installed with it and Dotfuscator will look in the input directory by default to resolve dependencies.  This also allows us to compare our final performance and functionality to the original.

Now that we have the application files in a new working folder, start Visual Studio 2010.  From the Visual Studio Tools menu select Dotfuscator Software Services.  When Dotfuscator starts up, accept the license agreement and then you will be in Dotfuscator CE’s new WPF user interface.

Now, add the input assembly you want to instrument.  Right click on the Project node of the left hand menu (titled “Dotfuscator1”) and select “Add Assemblies”.  Navigate to your working directory and select the Witty.exe file.

DotfuscatorAddAssembly

By default, Dotfuscator will harden your application by obfuscating it and renaming all possible items within your assembly. For this demonstration you don’t need renaming, so turn it off by selecting the Renaming menu node, right clicking on it, and unchecking the Enable option.  Next, enable instrumentation: navigate to the Instrumentation node; select the Options tab; check the Enable Instrumentation checkbox; then check the “Send application analytics messages” checkbox.  This tells Dotfuscator to inject the analytics instrumentation into your application.

DotfuscatorTurnOnRuntimeIntelligence

Instrumentation Step 1 – Required Assembly Attributes

All instrumented assemblies must have identifying data embedded in them so that it is accessible at runtime.  This data is included in every message and is used to identify the application, its owner, and its components for reporting purposes.  Additionally, you must identify the points in your application where usage tracking is going to be injected.  Both can be done either by using custom attributes to decorate your assembly and methods, or by using Dotfuscator’s Extended Attributes (where the configuration information is stored in the Dotfuscator project file for use during the Dotfuscation process).  For this exercise we are not modifying the application’s source code; therefore we will use Extended Attributes exclusively.

You add the required identifying data using assembly attributes as described in the Configuring Feature Analytics section of the “What’s New With Dotfuscator in Visual Studio 2010 Beta 1” post.  You will need to add both a BusinessAttribute and an ApplicationAttribute to the project with the appropriate CompanyKey and ApplicationKey values.

Instrumentation Step 2 – Tracking Application Usage

The final step is to tell the code injection engine in Dotfuscator where to inject the tracking logic.  Runtime Intelligence is designed to track usage within an application session, so it records both the start up of an application and its successful exit.  This allows you to track the actual usage of your application and to gather information on how often your application terminates unexpectedly.  There are two injection points that need to be defined: the application start up and application shutdown methods.  This is accomplished by adding the Setup and Teardown attributes as described in the Configuring Feature Analytics section of the “What’s New With Dotfuscator in Visual Studio 2010 Beta 1” post.

The Main method of the App class in the Witty Twitter application is the logical place for the startup.  In Dotfuscator CE’s Instrumentation treeview, navigate to the Main method on the Witty.App class.  Right click on the Main method and select Add Attribute.  Select the SetupAttribute.  Leave all of the SetupAttribute’s properties at their default values.

SetupAttribute

Finally, the normal exit point of the application needs to be specified so that code to implement a clean shutdown can be injected into the correct location.  Having a shutdown process provides a dual benefit: first, it ensures that all cached usage data is flushed from the in-memory buffer; second, it sends a closing message to the data collection portal so that this run of the application can be correctly tagged that it completed normally and did not shut down unexpectedly.  The best place to perform shutdown is in the last possible method in the execution flow, where you are certain that the user intends to exit the application.  For Witty, this is the OnClosed method in the MainWindow class.  To add the Teardown attribute, right click on the OnClosed method of the MainWindow class, select Add Attribute, and choose the TeardownAttribute.

TeardownAttribute

These two steps are all that is required to alter an existing application to report on its usage live from the field.  To finish, save the Dotfuscator project, then click on the Build icon to start a build.  By reviewing the build output pane, you can see that your application had both an analytics setup and analytics teardown injected into it and that renaming was disabled.

BuildOutput

By default, Dotfuscator saves the assemblies it outputs into a subdirectory named “Dotfuscated” below the project file.  Navigate to that directory and you will see a new Witty.exe file that has the same functionality as the original, but also reports its usage back to the Free Runtime Intelligence portal.  Now, back up the original Witty.exe in the Witty Program Files folder and copy the version from the Dotfuscated folder to the Witty Program Files folder and run the program.

Whenever the modified Witty starts up, it will send an application start message to the Free Runtime Intelligence Portal.  When you exit the application, it will send an application shutdown message, indicating that the application terminated normally.

Reviewing Accumulated Usage Data

To review your application’s usage, navigate to the free Runtime Intelligence Reporting Portal at http://free.runtimintelligence.com .  Navigate to the Login page and enter the CompanyKey value that you created as part of the BusinessAttribute above.  As the free portal service does not provide any authentication or privacy guarantees, any data that is sent to it should be considered publicly accessible although not publically visible by default.

As Runtime Intelligence is an analytics and trending solution, usage data is not immediately available in the reports.  There will be a delay before data from an application run is aggregated into the reports.

High Level Graphical Analysis

The first usage report we will look at is the “Application Dashboard” report.  This is a high level graphical overview of how often your applications ran.  In this example we can see that for the default reporting period (the past 30 days) we had a total of 10 application runs.  The Witty Twitter application accounted for 60% of that activity with the remaining 40% being the MedicalImage application.  The number in parentheses shows the number of incomplete application runs (those whose startup message was received but the method instrumented with the teardown code was never executed).  From this, we can infer that up to 10% of the time our users may have experienced an application failure with our MedicalImage application.  This is an indicator of possible application instability not a definitive measurement.  There may be an additional exit point in our application that we did not notice, the user may have completely disconnected their computer from the network while running the application, or any number of other issues could have prevented the portal from receiving the teardown message.

ApplicationRuns IncompleteAppRuns

The “Incomplete App Runs” chart gives a representation of how stable applications are overall and in relation to each other.  In this case we can visibly compare the stability of our applications.

The next chart is “Application Usage Over Time”.  This chart tracks the frequency of our applications usage, incomplete sessions and tampers over time.  It provides immediate feedback, allowing us to see if incomplete application sessions are trending higher or lower as we release new versions and how often our application binaries are tampered with in the wild.

ApplicationUsageOverTime

In addition to the usage data, we can see an overview of which operating systems and framework versions our applications are running under.  We can also see the percentage of application sessions that are unstable under particular operating systems or frameworks.

AppRunsByOSAndFramework

High Level Tabular Analysis

Another usage report, the “Application Scorecard” provides a more detailed tabular view of application usage.  Usage reporting is broken down by application unique identifier and application version.  Application usage (including incomplete and tampered instances) is broken down by the application’s unique identifier and version.   From this you can see the most used version of the operating system and framework per application version.  In the commercial version of Runtime Intelligence, you have the ability to uniquely identity each running instance of your application with a serial number.  This report will then summarize how many unique serial numbers were run and the total number of unique users.

ApplicationScorecard

The commercial version of Runtime Intelligence includes an additional report “Usage By Serial Number” - the free portal provides a sample.

By default, the data shown in the application reports consists of the total usage for all applications with the same CompanyKey with activity in the last month.  To change the report parameters, expand the parameter toolbar at the top of the report.  For all reports you can change the date range.  In the application reports you can also filter by an individual application or a specific version of an application, as well as specific operating system and framework versions.  Once you select the criteria for a new filter condition, click the “Refresh” button to display the filtered report.

Measuring Application Usage and Adoption

The number of unique users in the “Application Scorecard” report is a good indicator of how many unique users ran a particular version of your application.  You can compare this value with measurements of how many downloads of a given version occurred and infer an adoption ratio for your application.  This data is an excellent indicator of the adoption rates of your applications.  If your usage numbers are high but the number of users is low then you can infer that your application is both useful and being used but may not be visible enough in the marketplace.  If you have a high number of users but low average usage you may want to consider discoverability or documentation improvements as many of your users may be frustrated and giving up on using the application.

In addition, by examining the “Application Usage Over Time” section of the “Application Dashboard” and setting the filter to different versions of your application, you can visualize the upgrade pattern of your applications as you watch the usage numbers of older versions decline over time, to be replaced with higher usage of newer versions.

By examining the operating system and framework measurements, you can determine how rapidly your users upgrade their platforms.  This visibility can help you plan support for new technologies.  You can also refine your testing to ensure that your test environments match those of your users.

Usage information can be used to determine support lifecycles.  You can back up your supported versions policies with hard data of how often older versions of your software are used.  This information can also be used to measure the success of marketing efforts by providing measurements of how (or if) various campaigns resulted in higher usage of your applications.

Conclusion And Next Steps

In this post we have taken an application and added significant value by giving the application creator the ability to track actual real world usage in near real time.  We have enabled trend analysis over multiple releases of the application to measure upgrade adoption.  In addition, having hard data on usage patterns and runtime environments is invaluable when analyzing where to focus your development and testing time.

In future posts I will show how to perform more in-depth application tracking, how to protect your application binaries from tampering, and how to inject custom expiration behavior into your applications.