Missing Context Token in Low Trust App with SharePoint 2013 - Part 2

As I noted in my first post on this topic - https://blogs.technet.com/b/speschka/archive/2013/05/28/missing-context-token-in-low-trust-app-with-sharepoint-2013.aspx - you may find yourself in a low trust app without a context token, which basically leaves you up the creek without a paddle. I ran across another scenario where this was happening so thought I would add it to my list of app model troubleshooting tips I'm keeping here on Share-n-Dipity. In this case, I had added a AppInstalled receiver to my application, and some code within it was failing. There weren't any unhandled exceptions, but nonetheless when the page in my provider hosted app was loaded, it contained no context token.

The way I finally started narrowing this problem down was to remove the Xml for the AppInstalled receiver from the AppManifest.xml file for my application. Specifically, I commented out this:

<InstalledEventEndpoint>~remoteAppUrl/Services/AppEventReceiver.svc</InstalledEventEndpoint>

With that commented out, my page began getting the context token again. That of course then allowed me to redirect my troubleshooting efforts towards my event receiver. Overall it fits with your debugging 101 concepts of always trying to reduce scope to the smallest reproducible scenario. Just add this to the list of things to check off if you find yourself missing a context token with a low trust app.