Sistema.InvalidOperationException: Pila vacía


Una vez que se ejecuta ASP.NET 4.x aplicación construida en Visual Studio 2013 Estoy recibiendo la siguiente excepción.

He intentado desactivar el PageInspector eliminando page inspector assembly

<assemblies>
    <remove assembly="Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</assemblies>

Y agregar esta configuración a la configuración de la aplicación

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

Nada ayudó.

[/Pages/TargetPage.aspx] System.Web.HttpException (0x80004005): Exception of type 'System.Web.HttpException' was thrown. ---> System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.InvalidOperationException: Stack empty.
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Collections.Generic.Stack`1.Pop()
   at Microsoft.VisualStudio.Web.PageInspector.Runtime.WebForms.SelectionMappingRenderTraceListener.EndRendering(TextWriter writer, Object renderedObject)
   at System.Web.UI.RenderTraceListener.RenderTraceListenerList.EndRendering(TextWriter writer, Object renderedObject)
   at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
   at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
   at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.LegacyPageAsyncInfo.<CallHandlersPossiblyUnderLock>b__32(Object o)
   at System.Web.HttpContext.InvokeCancellableCallback(WaitCallback callback, Object state)
   at System.Web.UI.Page.LegacyPageAsyncInfo.CallHandlersPossiblyUnderLock(Boolean onPageThread)
   at System.Web.UI.Page.LegacyPageAsyncInfo.CallHandlers(Boolean onPageThread)
   at System.Web.HttpAsyncResult.End()
   at System.Web.UI.Page.LegacyAsyncPageEndProcessRequest(IAsyncResult result)
   at System.Web.UI.Page.AsyncPageEndProcessRequest(IAsyncResult result)

¿Hay alguna manera de evitar la excepción? Muchas gracias por cualquier sugerencia

Author: mybrave, 2013-12-05

11 answers

Hay múltiples razones por las que el

System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. -
System.InvalidOperationException: Stack empty.
Microsoft.VisualStudio.Web.PageInspector.Runtime.WebForms.SelectionMappingRenderTraceListener.EndRendering(TextWriter writer, Object renderedObject)
...

Después de añadir como se propone:

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

Me di cuenta de que había duplicado el elemento seleccionado en una lista desplegable creando el problema.

 8
Author: fcm,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-07-31 13:44:23

Deshabilité el enlace del navegador en VS 2013 y pude ver la causa real del error. Por lo general, es algo subyacente cuando se establece browser link. Puedes ver cómo desactivarlo aquí: http://www.poconosystems.com/software-development/how-to-disable-browser-link-in-visual-studio-2013/

 21
Author: Jason,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-10-24 09:48:27

Esto puede suceder si el AssociatedControlID en una etiqueta está asociado con un control que no se puede encontrar.

 20
Author: Sam Jones,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-04-25 11:14:29

Espero que esto ayude a alguien.

Estaba recibiendo este error cuando mi asp:panel tiene un botón predeterminado decir XYZ y modificé el nombre XYZ y olvidé cambiar el nombre del botón predeterminado en el panel.

 5
Author: Halim,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-03-22 07:06:04

He encontrado el problema. Se cambió la forma de generar ID de controles en GridView de forma predeterminada a

ClientIDMode="Predictable" ClientIDRowSuffix="ID"

Que resultó en la excepción. No estoy seguro de por qué la excepción real fue ocultada por PageInspector stack empty. Solo revertir el cambio al original resolvió el problema.

Ahora la excepción es diferente (pero una vez que la configuración de GridView vuelva a la original, este disapper también)

System.ArgumentException: An entry with the same key already exists.
 4
Author: mybrave,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-12-06 09:25:06

También he visto este problema en algunas aplicaciones web que se ejecutan en máquinas de desarrollo utilizando Visual Studio 2013 con "Browser Link" habilitado.

En varios casos que he visto, dejar el Enlace del navegador habilitado causa todo tipo de problemas, tanto script de cliente y advertencias de seguridad, y excepciones de servidor como este (lo molesto es que parece estar habilitado por defecto, gracias Msft!)

 3
Author: nothingisnecessary,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-10-07 21:43:22

Tuve la misma excepción, pero en mi caso el problema era que faltaba lo siguiente:

<form runat="server">
</form>
 2
Author: Myster,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-07-31 01:31:17

En mi caso (ASP.NET 4.6, Visual Studio 2015) Comenté un control de texto asp y agregué una nueva lista desplegable asp, pero no actualizé el AssociatedControlID de la etiqueta asociada.

Al cambiar el ID de la lista desplegable AssociatedControlID a asp recién agregado, mi problema se solucionó.

 2
Author: Satbir,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-05-26 17:07:54

Comenzamos VisualStudio 2015 (vs2015) desde el archivo de solución de VisualStudio 2012 y mientras construíamos todos los proyectos no construíamos. Esto se debió a la opción Habilitar enlace del navegador habilitada de forma predeterminada. Desactivé la opción Habilitar enlace del navegador y reconstruí la solución que construyó todos los proyectos con éxito. Después de esto encendí la url en un navegador y Boom funcionó! Para aquellos que tienen un escenario similar al mío. ¡inténtalo !

 0
Author: Syed belgam,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-11-22 15:55:50

Que me sucede cuando agregué un nuevo <asp:Panel> a mi página y puse el DefaultButton a un botón fuera del panel (Por error). Se corrigió el error cuando cambié el DefaultButton a otro dentro del panel.

 0
Author: AmiNadimi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-02-17 12:04:38

En mi caso, debido a que tuve tantos problemas para migrar un sitio web de VS2002 a VS2015, decidí crear un nuevo proyecto en VS2015 y transferir todos los formularios web del proyecto anterior (VS2002) al nuevo (VS2015).

El nuevo proyecto tenía un sitio.Página maestra, que ya tiene una etiqueta. Debido a que estaba transfiriendo formularios web antiguos sin modificaciones, ya tenían una etiqueta también, por lo que cada página que intentaba cargar tenía dos etiquetas dentro.

Cuando eliminé la etiqueta en cada página, dejando sólo el que está en el lugar.Página maestra, el problema fue resuelto.

Espero que esto ayude.

 0
Author: Rolo,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-08-25 20:20:52