Google Группы больше не поддерживают новые публикации и подписки в сети Usenet. Опубликованный ранее контент останется доступен.
Закрыть

Unhandled exception occurs when calling MethodInfo.Invoke

3 просмотра
Перейти к первому непрочитанному сообщению

Stokes

не прочитано,
14 мар. 2003 г., 15:05:0614.03.2003
I am currently writing an application that heavily relies on calling
MethodInfo.Invoke and I am not guaranteed that the method I am invoking will
not be throwing an exception inside of it. I have a try/catch block set up
around my call to MethodInfo.Invoke, yet for some reason if the method that
is invoked throws an exception, the application will break into the debugger
with the error that an unhandled exception has been thrown. Is there
something I am overlooking here?


Mike Boilen [MS]

не прочитано,
14 мар. 2003 г., 19:08:1614.03.2003
This is an implementation detail of the way the .net Compact Framework
handles exceptions. The debugger cannot "see" the try...catch statement
around the call to MethodInfo::Invoke from the place where the exception is
thrown. Because of this, it indicates that there is an unhandled exception
when the debugger is connected. If you continue from the exception, it
will still be caught by the try...catch you have around your call to
MethodInfo::Invoke. If there is no debugger attached, you will not see any
notification about an unhandled exception.

Sorry for the confusion.

Mike Boilen
Developer
.NET Compact Framework

This posting is provided "AS IS" with no warranties, and confers no rights.
http://www.gotdotnet.com/team/netcf/FAQ.aspx

--------------------
| From: "Stokes" <bre...@spammail.com>
| Subject: Unhandled exception occurs when calling MethodInfo.Invoke
| Date: Fri, 14 Mar 2003 12:05:06 -0800
| Lines: 9
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
| Message-ID: <#$FA$Sm6CH...@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host: itron9-1.itron.com 198.182.9.1
| Path:
cpmsftngxa08.phx.gbl!cppssbbsa01.microsoft.com!news-out.cwix.com!newsfeed.cw
ix.com!news-hub.siol.net!newsfeed.media.kyoto-u.ac.jp!msrtrans1!TK2MSFTNGP08
.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa08.phx.gbl
microsoft.public.dotnet.framework.compactframework:19012
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Stokes

не прочитано,
14 мар. 2003 г., 19:49:2314.03.2003
Unfortunately, running outside the debugger is not really an option for me.
The tool I am trying to write is the equivalent of nUnit for the compact
framework, so our developers will pretty much be running in the debugger all
the time. I know there is the option to set the flag in the Exceptions
options to Continue if an Unhandled Exception is thrown, but I was just
wondering if there was any other way of getting around this. I know in the
Desktop version, the exception from Invoke is handled and then wrapped in a
TargetInvocationException, is something like this not possible to implement
in the Compact Framework version due to the limitations you described in
your response?

Sorry for making this a bigger issue than it probably needs to be, but for
our unit testing, we allow for the test to expect certain exceptions and it
would really be nice if it didn't break into the debugger when this
exception was received.

"Mike Boilen [MS]" <mbo...@online.microsoft.com> wrote in message
news:GYVSCco6...@cpmsftngxa08.phx.gbl...


> This is an implementation detail of the way the .net Compact Framework
> handles exceptions. The debugger cannot "see" the try...catch statement
> around the call to MethodInfo::Invoke from the place where the exception
is
> thrown. Because of this, it indicates that there is an unhandled
exception
> when the debugger is connected. If you continue from the exception, it
> will still be caught by the try...catch you have around your call to
> MethodInfo::Invoke. If there is no debugger attached, you will not see
any
> notification about an unhandled exception.
>
> Sorry for the confusion.
>
> Mike Boilen
> Developer

> NET Compact Framework
>
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> http://www.gotdotnet.com/team/netcf/FAQ.aspx
>
> --------------------
> | From: "Stokes" <bre...@spammail.com>
> | Subject: Unhandled exception occurs when calling MethodInfo.Invoke
> | Date: Fri, 14 Mar 2003 12:05:06 -0800
> | Lines: 9
> | X-Priority: 3
> | X-MSMail-Priority: Normal
> | X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
> | Message-ID: <#$FA$Sm6CH...@TK2MSFTNGP10.phx.gbl>
> | Newsgroups: microsoft.public.dotnet.framework.compactframework
> | NNTP-Posting-Host: itron9-1.itron.com 198.182.9.1
> | Path:
>
cpmsftngxa08.phx.gbl!cppssbbsa01.microsoft.com!news-out.cwix.com!newsfeed.cw
>
ix.com!news-hub.siol.net!newsfeed.media.kyoto-u.ac.jp!msrtrans1!TK2MSFTNGP08

Brian Smith [MSFT]

не прочитано,
31 мар. 2003 г., 18:52:1631.03.2003
Sorry, there is no work-around available other than what you describe --
changing the exception options in Visual Studio. If the method you are
Invoking can only throw certain kind of exceptions, you could only
"Continue" those exceptions, but there is no wrapping exception or other
indication you can use to uniquely identify exceptions from Method.Invoke.

This posting is provided "AS IS" with no warranties, and confers no

rights.ng this a bigger issue than it probably needs to be, but for

0 новых сообщений