I’m getting the below stack trace when I try to setup a ListView control with a static datasource of an array of objects. The application errors out in ui.js on this line:
var rendered = WinJS.Promise.as(this.renderer(itemForRendererPromise, recycledElement)).
then(WinJS.UI._normalizeRendererReturn);
TypeError: Object expected at renderItemAsync
(ms-appx://microsoft.winjs.1.0/js/ui.js:20074:9) at Anonymous
function (ms-appx://microsoft.winjs.1.0/js/ui.js:22477:54) at
_renderItem (ms-appx://microsoft.winjs.1.0/js/ui.js:10557:9) at _elementForItem (ms-appx://microsoft.winjs.1.0/js/ui.js:10637:13) at _itemFromItemPromise
(ms-appx://microsoft.winjs.1.0/js/ui.js:10333:9) at _itemAtIndex
(ms-appx://microsoft.winjs.1.0/js/ui.js:10341:9) at Anonymous
function (ms-appx://microsoft.winjs.1.0/js/ui.js:17393:21) at
Promise_ctor (ms-appx://microsoft.winjs.1.0/js/base.js:1865:17) at
_LayoutCommon_measureItems (ms-appx://microsoft.winjs.1.0/js/ui.js:17338:17) at Anonymous
function (ms-appx://microsoft.winjs.1.0/js/ui.js:17296:29)
It turns out this was because I had moved the list item template (WinJS.Binding.Template) I was using to the bottom of he HTML page. It appears if you don’t place the template before the listview, it will throw this error. Pretty weird but at least it’s an easy fix.