ASP.NET yellow screen of death - where does it get the stack trace from?
I have a remoting-type set up within my application where I avoid TargetInvocationExceptions
and grab the inner exception. I invoke the internal PrepForRemoting
method on the Exception
class to preserve the stack trace from the invoked method.
This appears to construct the stack trace property correctly:
"\r\nServer stack trace: \r\n
at ZBook开发者_StackOverflowing.Environment.Services.BookingService.<>c_DisplayClass9`1.b_5(BookingSlot p) in C:\dev\ZBookings\core\ZZBookings.Services\BookingService.cs:line 79\r\n
at System.Linq.Enumerable.All[TSource](IEnumerable'1 source, Func'2 predicate)\r\n
at ZBookings.BookingService.MoveBooking[TBookingType](Int32 bookingId, >IEnumerable`1 bookingSlots) in C:\dev\ZBooking.Client\core\ZBookings.Services\BookingService.cs:line 79\r\n\r\n
Exception rethrown at [0]: \r\n at ZBookings.BookingService.<>c_DisplayClass9`1.b_5(BookingSlot p) in C:\dev\ZBookings\core\ZBookings.Services\BookingService.cs:line 79\r\n
at System.Linq.Enumerable.All[TSource](IEnumerable'1 source, Func'2 predicate)\r\n
at ZBookings.BookingService.MoveBooking[TBookingType](Int32 bookingId, IEnumerable`1 bookingSlots) in C:\dev\ZBookings\core\ZBookings.Services\BookingService.cs:line 79"
However, when this is displayed by the standard ASP.NET yellow screen it is:
[NullReferenceException: Object reference not set to an instance of an object.] ZBooking.ApplicationServices.MethodMarshaller.Invoke(Delegate del, ZipIdentity zipIdentity, Object[] args) in C:\dev\ZBooking\core\ZBooking.ApplicationServices\MethodMarshaller.cs:147 ZBooking.ApplicationServices.MethodMarshaller.Invoke(Delegate del, ZipIdentity zipIdentity, Object[] args) in C:\dev\ZBooking\core\ZBooking.ApplicationServices\MethodMarshaller.cs:105 ZBooking.ApplicationServices.MethodMarshaller.Call(Func'3 del, T1 arg1, T2 arg2, ZipIdentity zipIdentity) in C:\dev\ZBooking\core\ZBooking.ApplicationServices\MethodMarshaller.cs:72
...etc.
Calling Server.GetLastError();
on Application_Error in Global.asax shows the correct stack trace. Where is the yellow screen stack trace coming from?
ASP.NET's yellow screen of death gets the stack trace by constructing a StackTrace
from the exception. It does this using the StackTrace(Exception, Boolean)
constructor. It then dumps the stack by walking the StackFrame objects supplied by the StackTrace
object. It does not use the Exception.StackTrace
property.
精彩评论