下面这行代码导致了异常
plug.Instance.AddDocuments(new Int32[] { val_pid }, val_ptype, val_doccat, val_subcat, val_doctype, val_notes, val_summary, SummaryAppendOptions.None, val_docStatus, new 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:
我不是在寻找实际异常的解决方案。
我的问题是,堆栈跟踪是否指向方法的哪一部分没有引用集?还是stacktrace只是为了追踪调用方法的位置?
最佳答案
堆栈跟踪显示抛出异常时的调用堆栈。根据您提供的内容,您只能推断出 AddDocuments
引发了异常。传入的任何引用类型参数都可以为 null。查明问题的最佳方法是设置断点,而不是检查值。
关于c# - 正确使用 stacktrace 进行调试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9707058/