正确使用堆栈跟踪调试 [英] Correctly using stacktrace to debug

查看:136
本文介绍了正确使用堆栈跟踪调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的代码行引起了我的异常。

The following line of code is causing me an Exception

plug.Instance.AddDocuments(新的Int32 [] {} val_pid,val_ptype, val_doccat,val_subcat,val_doctype,val_notes,val_summary,SummaryAppendOptions.None,val_docStatus,新的String [] {} PDFFile)

这是异常详细信息。

System.Exception was caught
 Message=Object reference not set to an instance of an object. - Error when trying to save    document
 Source=SimsBridge

 StackTrace:
   at SimsBridge.Bridge.AddDocuments(Int32[] personIds, Int32 PersonType, String docCatagory, Int32 subCatagory, String docType, String notes, String summary, SummaryAppendOptions summaryOptions, String documentStatusCode, String[] filePaths)
   at ManagedScanDesktop.Form1.SimsScanComplete(String[] files) in C:\Working\ManagedScanDesktop 1.8\v1.8\ManagedScanDesktop\ManagedScanDesktop\Form1.cs:line 2619
InnerException: 

我又不是寻找一个解决方案,以实际的异常。

I'm not looking for a solution to the actual exception.

我的问题是,它的堆栈跟踪指向方法的哪一部分不具有参考设置?或者是堆栈跟踪只跟踪到被调用的方法?

My question is, does the stacktrace point to which part of the method doesn't have a reference set? Or is stacktrace just to trace to where the method is called?

推荐答案

堆栈跟踪显示您调用堆栈的异常时,抛出。从您提供什么,你只能推断出一个例外是从 AddDocuments 抛出。任何传入的引用类型的参数可以为空。要找准问题,最好的办法是设置一个断点,比检查值。

The stack trace shows you the call stack when an exception is thrown. From what you've provided you can only deduce that an exception was thrown from AddDocuments. Any of the reference type parameters passed in could be null. The best way to pinpoint the problems is to set a breakpoint and than inspect the values.

这篇关于正确使用堆栈跟踪调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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