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 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"
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?