Si añado la siguiente línea a un método de acción ASP.NET MVCLanzar Excepción con SecurityException interior sólo muestra la excepción interna en ASP.NET MVC
throw new Exception("outer", new SecurityException("inner"));
el error que se muestra realmente en la pantalla amarilla de la muerte es la SecurityException interna sin ninguna mención de la excepción externa.
SecurityException
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: inner
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SecurityException: inner]
¿Este comportamiento es esperado?
Parece que no importa de qué tipo es la excepción externa. Incluso si se trata de otra SecurityException, el mensaje nunca se muestra. El mensaje de error SecurityException predeterminado es tan vago que quiero verlo y agregar información más específica. Esto funciona bien si no incluyo la SecurityException original como innerException pero, idealmente, me gustaría hacer esto.
Estoy viendo que esto es cierto para cualquier excepción interna, no solo para la excepción de seguridad. –