我在应用程序中设置了远程调用类型,避免了TargetInvocationExceptions
并抓取内部异常。我调用Exception
类上的内部PrepForRemoting
方法以保留从调用方法获取的堆栈跟踪。
这似乎正确构造了堆栈跟踪属性:
"\r\nServer stack trace: \r\n
at ZBooking.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"
但是,当标准的ASP.NET黄屏幕显示它时:
[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.
在Global.asax的Application_Error中调用Server.GetLastError();
可以显示正确的堆栈跟踪。黄屏幕的堆栈跟踪来自哪里?