my application was worked fine but suddenly it is stop working and give this error [InvalidOperationException: Stack empty.] System.ThrowHelper.ThrowInvalidOperationExcep
For me, it was the Brower Link. Disabling it worked for me. For more reference check out https://docs.microsoft.com/en-us/aspnet/visual-studio/overview/2013/using-browser-link
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.