以下代码行导致我出现异常
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是否指向该方法的哪个部分没有引用集?或者堆栈跟踪只是为了跟踪调用方法的位置?
答案 0 :(得分:4)
堆栈跟踪显示抛出异常时的调用堆栈。根据您提供的内容,您只能推断出AddDocuments
引发的异常。传入的任何引用类型参数都可以为null。确定问题的最佳方法是设置断点而不是检查值。
答案 1 :(得分:1)
您的堆栈跟踪意味着SimsBridge或SimsBridge.Bridge为空。
答案 2 :(得分:1)
该消息告诉您AddDocuments
中某处引发了空引用异常。它可以是参数之一或成员。