本文介绍了如果我的源代码中没有发生ArgumentOutOfRangeException异常,如何捕获?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
我正在尝试捕获ArgumentOutOfRangeException的异常,但是它发生在我在应用程序中使用的dll引用中.
我用Google搜索了此异常,但没有解决方案适合我.
我用try {} catch(ArgumentOutOfRangeException ex){}包围了使用该dll的代码,但仍会发生异常.
错误日志文件中有一些文字.
Hi All
I am trying to catch the exception of ArgumentOutOfRangeException but it happens in a dll reference which I use in my app.
I Googled this exception but no solution works for me.
I surround the code which I use this dll with try{}catch(ArgumentOutOfRangeException ex){} but exception still occur.
there is some text of error log file.
"Exception:
System.ArgumentOutOfRangeException: The added or subtracted value results in an un-representable DateTime.
Parameter name: value
at System.DateTime.AddTicks(Int64 value)
at Genetec.Sdk.Media.MediaPlayer.OnTimeLineRefreshTicks(Object sender, EventArgs e)
at System.Windows.Threading.DispatcherTimer.FireTick(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)... "
推荐答案
// this line is inside form Load
mediaPlayback.Dispatcher.UnhandledException += OnUnhandeledException;
private void OnUnhandeledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
e.Handled = true;
}
希望对您有帮助
谢谢大家
穆罕默德·贝赫里(Mohamed Behery)
I hope that help
thanks for all
Mohamed Behery
这篇关于如果我的源代码中没有发生ArgumentOutOfRangeException异常,如何捕获?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!