As discussed recently i am working on a Windows 8 app for WindowsVJ readers. The application is in final phase and i submitted the app at the Windows 8 app store to check if it passes the Windows 8 app store requirements. After a few hours of submission i received an email which said my application does not pass the Windows Application Certification Kit test.
The report generated mentioned following error:
The Optimized Binding References test detected the following errors:
Impact if not fixed: When using bindings, WinJS.Binding.optimizeBindingReferences should be set to true to optimize the memory usage.
How to fix: Set WinJS.Binding.optimizeBindingReferences to true in the app’s JavaScript.
Fixing this error is very simple. By adding WinJS.Binding.optimizeBindingReferences = true in default.js your application can pass through the WACK test. The code to be added would be:
WinJS.Binding.optimizeBindingReferences = true;
This variable determines whether or not binding should automatically set the ID of an element. This property should be set to true in apps that use Windows Library for JavaScript (WinJS) binding.
Before submitting an app for certification and listing in the Windows Store, Windows App Certification Kit (WACK) can be used to test the app and make sure it’s ready for submission. WACK 2.2 includes the test to check for Optimized binding references (when using bindings, WinJS.Binding.optimizeBindingReferences should be set to TRUE in the app’s JavaScript to optimize the memory usage).
Above code can be added to the beginning of the default.js file in a Visual Studio project for Windows Store apps built for Windows using JavaScript. The file would look like:
(function () {
"use strict";
WinJS.Binding.optimizeBindingReferences = true;
//Rest of Javascript Code
}
Though the documentation for WinJS.Binding at MSDN says this parameter determines whether or not binding should automatically set the ID of an element. This property should be set to true in apps that use Windows Library for JavaScript (WinJS) binding. it does not explain the reasons behind setting this parameter as true.
This feature to set WinJS.Binding flag was added later in Visual Studio to get around a memory leak. Since WinJS was automatically creating an ID property for all elements involved in data binding due to the implementation of its binding engine, it introduced a memory leak because the table in which the wwahost.exe process stores such IDs never gets cleaned up. Setting this flag to true reduces the Memory usage of a Windows 8 app. And with limited (though expanding) mobile memory, this was made a mandatory test to certify an app for Windows 8.
Windows App Certification Kit (WACK) 2.2 can be downloaded from MSDN.






















Andy, a very interesting post thanks for writing it!
[…] WinJS.Binding.optimizeBindingReferences for Windows 8 App […]