结合 IronPython 和 CLI 堆栈跟踪

发布于 2024-10-08 02:47:12 字数 307 浏览 0 评论 0原文

我有一个用 IronPython 编写的应用程序,它使用导入的 .NET 程序集(使用调试支持编译)中的类和方法。当程序集中的方法抛出异常时,它会在 IronPython 代码中作为异常(而不是 System.Exception)捕获,并且回溯在最后一个 IronPython 方法处结束。

我想要做的是更深入地在最后一个 IronPython 方法之后附加原始 CLI 回溯,以查看程序集中发生异常的位置。

是否有可能从捕获的 IronPython 等效项中获取原始 CLI 异常,或者在不丢失 IronPython 堆栈跟踪的情况下捕获它?

谢谢。

I have an application written in IronPython which uses classes and methods from imported .NET assembly (compiled with debug support). When a method in assembly throws an exception, it gets caught in IronPython code as Exception (not System.Exception) and the traceback ends at last IronPython method.

What I would like to do is to go deeper and append the original CLI traceback after last IronPython method to see where the exception occured inside the assembly.

Is it possible to get original CLI exception from caught IronPython equvivalent or catch it without loosing IronPython's stack trace?

Thanx.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

明月夜 2024-10-15 02:47:12

您可以从 scriptEngine.GetService() 获取 ExceptionOperations 对象。然后您可以调用 FormatException 或 GetStackFrames。您还可以将 ExceptionDetail 选项设置为 true 以从 FormatException 获取更详细的堆栈跟踪。

You can get the ExceptionOperations object from scriptEngine.GetService(). You can then call FormatException or GetStackFrames. You can also set the ExceptionDetail option to true to get more verbose stack traces from FormatException.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文