WP8 Error – Cannot clear the icon while in a list Parameter name: value

When using the ApplicationBar in the Windows Phone Application and dynamically setting the IconButtons from code behind , I encounter this error .

Cannot clear the icon while in a list Parameter name: value

The cause of the error and the fix is pretty straight forward .

I was setting the IconUri of the ApplicationBarIcon button programmatically and the value of the IconUri was not set for one of the IconButtons.

WP8 Error - Cannot clear the icon while in a list Parameter name: value

Setting the right IconUri resolved the issue.