Hi
We are building a rather large application platform using WPF and are running into a very strange exception which causes our application to crash. We have no definitive way to reproduce it and cannot reproduce it in a smaller sample application, but the really annoying thing is that it seems very illogical to us.
Let me give you some detail. We crash with the following stacktrace:
[ArgumentException], "TimeSpan does not accept floating point Not-a-Number values."
at System.TimeSpan.Interval(Double value, Int32 scale)
at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at XXX.ApplicationPlatform.Program.Main() in C:\projects\XXX\Source\ApplicationPlatform\ApplicationPlatform\Program.cs:line 98
From this we conclude that we are not directly causing the exception, but we may be causing it indirectly. Looking into the Dispatcher.Invoke method using Reflector it seems that the following call fails, more specifically, the call internally to TimeSpan.FromMilliseconds:
returnthis.InvokeImpl(priority, TimeSpan.FromMilliseconds(-1.0), method, this.CombineParameters(arg, args), false);
We seems particularly strange to us is that this method is probably being called all the time withouot problems, to why does -1.0 al of a sudden become a NaN or at least, why does -1.0 return true in double.IsNaN?
The application is multithreaded with lots of data being fetched async, but this exception does not seem to directly be runing in on of our async methods, it seems more like part of the wpf message pump (or equivalent)
UPDATE: Forget to add these the first time. We also receive other strange "internal" exceptions related to timespans and the internals of the WPF messaging pump. These exception does not always seem to break our app, but are very strange and we would like to figure those out as well. Here are the stack traces we receive:
ApplicationPlatform.vshost.exe Error: 0 : 2009-03-04 10:06:11: Exception[OverflowException]: TimeSpan overflowed because the duration is too long.
StackTrace: at System.TimeSpan.Subtract(TimeSpan ts)
at System.Windows.Media.Animation.Clock.ComputeNextTickNeededTime(Nullable`1 expirationTime, TimeSpan parentTime, Double parentSpeed)
at System.Windows.Media.Animation.Clock.ComputeLocalStateHelper(Boolean performTickOperations, Boolean seekedAlignedToLastTick)
at System.Windows.Media.Animation.Clock.ComputeLocalState()
at System.Windows.Media.Animation.ClockGroup.ComputeTreeState()
at System.Windows.Media.Animation.TimeManager.Tick()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
InnerException:
-
ApplicationPlatform.vshost.exe Error: 0 : 2009-03-04 11:05:02: Exception[ArgumentException]: TimeSpan does not accept floating point Not-a-Number values.
StackTrace: at System.TimeSpan.Interval(Double value, Int32 scale)
at System.Windows.Media.MediaContext.ScheduleNextRenderOp(TimeSpan minimumDelay)
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
InnerException:
-
So somehow the internals get "screwed" up and it seems that the basic math being performed fails. Our fault? We don't know and can't seem to find out!
Any input, ideas or comments that may help us debug these things would be greatly appreciated
Soren
We are building a rather large application platform using WPF and are running into a very strange exception which causes our application to crash. We have no definitive way to reproduce it and cannot reproduce it in a smaller sample application, but the really annoying thing is that it seems very illogical to us.
Let me give you some detail. We crash with the following stacktrace:
[ArgumentException], "TimeSpan does not accept floating point Not-a-Number values."
at System.TimeSpan.Interval(Double value, Int32 scale)
at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at XXX.ApplicationPlatform.Program.Main() in C:\projects\XXX\Source\ApplicationPlatform\ApplicationPlatform\Program.cs:line 98
From this we conclude that we are not directly causing the exception, but we may be causing it indirectly. Looking into the Dispatcher.Invoke method using Reflector it seems that the following call fails, more specifically, the call internally to TimeSpan.FromMilliseconds:
returnthis.InvokeImpl(priority, TimeSpan.FromMilliseconds(-1.0), method, this.CombineParameters(arg, args), false);
We seems particularly strange to us is that this method is probably being called all the time withouot problems, to why does -1.0 al of a sudden become a NaN or at least, why does -1.0 return true in double.IsNaN?
The application is multithreaded with lots of data being fetched async, but this exception does not seem to directly be runing in on of our async methods, it seems more like part of the wpf message pump (or equivalent)
UPDATE: Forget to add these the first time. We also receive other strange "internal" exceptions related to timespans and the internals of the WPF messaging pump. These exception does not always seem to break our app, but are very strange and we would like to figure those out as well. Here are the stack traces we receive:
ApplicationPlatform.vshost.exe Error: 0 : 2009-03-04 10:06:11: Exception[OverflowException]: TimeSpan overflowed because the duration is too long.
StackTrace: at System.TimeSpan.Subtract(TimeSpan ts)
at System.Windows.Media.Animation.Clock.ComputeNextTickNeededTime(Nullable`1 expirationTime, TimeSpan parentTime, Double parentSpeed)
at System.Windows.Media.Animation.Clock.ComputeLocalStateHelper(Boolean performTickOperations, Boolean seekedAlignedToLastTick)
at System.Windows.Media.Animation.Clock.ComputeLocalState()
at System.Windows.Media.Animation.ClockGroup.ComputeTreeState()
at System.Windows.Media.Animation.TimeManager.Tick()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
InnerException:
-
ApplicationPlatform.vshost.exe Error: 0 : 2009-03-04 11:05:02: Exception[ArgumentException]: TimeSpan does not accept floating point Not-a-Number values.
StackTrace: at System.TimeSpan.Interval(Double value, Int32 scale)
at System.Windows.Media.MediaContext.ScheduleNextRenderOp(TimeSpan minimumDelay)
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
InnerException:
-
So somehow the internals get "screwed" up and it seems that the basic math being performed fails. Our fault? We don't know and can't seem to find out!
Any input, ideas or comments that may help us debug these things would be greatly appreciated
Soren