InvalidOperationException: Stack empty

I had the same problem, but its fixed now. Firstly I disabled PageInspector.

<appSettings>
       <add key="PageInspector:ServerCodeMappingSupport" value="Disabled"/>
</appSettings>

After that I got another error which was related to ResolveUrl method, I removed method and fixed the problem and voila! its working perfectly. Finally, I enabled PageInspector by removing previous settings and still it works.