Application.ThreadException [英] Application.ThreadException

查看:63
本文介绍了Application.ThreadException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我通过在Application.ThreadException事件上附加事件

处理程序来捕获未处理的异常。这个

将确保我可以在主线程上处理所有未被捕获的异常




但是,假设我创建了一个新的我的应用程序中的线程和一个

未处理的异常在该线程中生成,这个异常会在这里被捕获吗?


谢谢提前,

Rakesh

解决方案

不,其他线程上的未处理异常不会被捕获。


-

Greetz,

Jan

__________________________________

阅读我的博客: http://weblogs.asp.net/jan

" Rakesh" <一个******* @ discussions.microsoft.com> schreef in bericht

news:04 **************************** @ phx.gbl ... < blockquote class =post_quotes>

我通过在Application.ThreadException事件上附加一个事件处理程序来捕获未处理的异常。这将确保我可以在主线程上处理所有未捕获的异常

但是,假设我在我的应用程序中创建了一个新线程并且
未处理的异常在那个帖子中生成,这个例外会在这里被抓住吗?

提前致谢,
Rakesh



你好Jan,


谢谢!


所以你的意思是我们必须采用相同的旧方式
在这种情况下,
try-catch?还有其他任何方式吗?


Rakesh

-----原始消息-----
不,未处理的异常在其他线程上不会被
抓住。
-
Greetz,
Jan
__________________________________
阅读我的博客: http://weblogs.asp.net/jan
Rakesh <一个******* @ discussions.microsoft.com> schreef
in berichtnews:04 **************************** @ phx.gbl ...



我通过在Application.ThreadException事件上附加一个事件处理程序来捕获未处理的异常。这将确保我可以在主线程上处理所有未捕获的异常

但是,假设我在我的应用程序中创建了一个新线程并且
未处理的异常是在那个帖子中生成的,这个例外会在这里被抓住吗?

提前致谢,
Rakesh





catch(例外e)

{

}


主要会抓住一切吗?

" Rakesh" <一个******* @ discussions.microsoft.com>在留言中写道

news:05 **************************** @ phx.gbl ... < blockquote class =post_quotes>你好Jan,

谢谢!

所以你的意思是我们必须采用相同的旧方式来尝试在这种情况下?其他任何方式?

Rakesh

-----原始消息-----
不,其他线程的未处理异常不会被


抓住了。


-
Greetz,
Jan
__________________________________
阅读我的博客:< a rel =nofollowhref =http://weblogs.asp.net/jantarget =_ blank> http://weblogs.asp.net/jan
Rakesh <一个******* @ discussions.microsoft.com> schreef


在bericht

新闻:04 **************************** @phx.gbl ...



我通过在Application.ThreadException事件上附加一个事件处理程序来捕获未处理的异常。这将确保我可以在主线程上处理所有未捕获的异常

但是,假设我在我的应用程序中创建了一个新线程并且
未处理的异常是在那个帖子中生成的,这个例外会在这里被抓住吗?

提前致谢,
Rakesh





Hi,

I am catching unhandled exception by attached an event
handler on the Application.ThreadException event. This
will ensure that I could handle all uncaught exceptions
on the main thread.

But, suppose I create a new thread within my app and an
unhandled exception is generated in that thread, will
that exception be caught here?

Thanks in advance,
Rakesh

解决方案

No, the unhandled exceptions on other threads wont be caught.

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Rakesh" <an*******@discussions.microsoft.com> schreef in bericht
news:04****************************@phx.gbl...

Hi,

I am catching unhandled exception by attached an event
handler on the Application.ThreadException event. This
will ensure that I could handle all uncaught exceptions
on the main thread.

But, suppose I create a new thread within my app and an
unhandled exception is generated in that thread, will
that exception be caught here?

Thanks in advance,
Rakesh



Hi Jan,

Thanks!

So do u mean that we have to go about the same old way of
try-catch in this case? Any other way?

Rakesh

-----Original Message-----
No, the unhandled exceptions on other threads wont be caught.
--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Rakesh" <an*******@discussions.microsoft.com> schreef in berichtnews:04****************************@phx.gbl...

Hi,

I am catching unhandled exception by attached an event
handler on the Application.ThreadException event. This
will ensure that I could handle all uncaught exceptions
on the main thread.

But, suppose I create a new thread within my app and an
unhandled exception is generated in that thread, will
that exception be caught here?

Thanks in advance,
Rakesh


.



catch (Exception e)
{
}

In the main would catch everything right?
"Rakesh" <an*******@discussions.microsoft.com> wrote in message
news:05****************************@phx.gbl...

Hi Jan,

Thanks!

So do u mean that we have to go about the same old way of
try-catch in this case? Any other way?

Rakesh

-----Original Message-----
No, the unhandled exceptions on other threads wont be


caught.


--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Rakesh" <an*******@discussions.microsoft.com> schreef


in bericht

news:04****************************@phx.gbl...

Hi,

I am catching unhandled exception by attached an event
handler on the Application.ThreadException event. This
will ensure that I could handle all uncaught exceptions
on the main thread.

But, suppose I create a new thread within my app and an
unhandled exception is generated in that thread, will
that exception be caught here?

Thanks in advance,
Rakesh


.



这篇关于Application.ThreadException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆