[英]Reasons why except block in “try..except” is bypassed
I am writing some code against a 3rd party component with no source code. 我正在针对没有源代码的第三方组件编写一些代码。 (don't comment on this :) ), something happens when calling a method on that component and even if i put it in a try except block the except block is bypassed.
(不要对此发表评论:)),在该组件上调用方法时会发生某些事情,即使我尝试将它放在except块之外,也会绕过except块。
Am i doing something wrong? 难道我做错了什么?
What can be the reason? 可能是什么原因?
begin
try
3rdPartyComponentWithNoSourceCode.MethodOne; [A]
SomeOtherCode;
except
HandleException; [A']
end;
end; [B]
debugging step by step brings me from [A] to [B], without stopping on [A']. 逐步调试使我从[A]转到[B],而无需停止[A']。
Why? 为什么?
The debugger doesn't jump to exception handlers well when you're stepping through your code. 当您单步执行代码时,调试器无法很好地跳到异常处理程序。 Put a breakpoint on HandleException instead, and it will stop there (if there is an exception in the first place).
相反,在HandleException上放置一个断点,它将在此停止(如果首先出现异常)。
A reason for not reaching HandleException
could be that any exception raised within MethodOne
might be eaten or handled by MethodOne
itself. 一种没有达到理由
HandleException
可能是内引发的任何异常MethodOne
可能被吃掉或处理MethodOne
本身。
But that's propably not the case, because: 但是事实并非如此,因为:
something happens
有事情发生
Could you expand on the something ? 你能扩展一些东西吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.