Amicable
Amicable

Reputation: 3101

Correctly using stacktrace to debug

The following line of code is causing me an Exception

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 })

And this is the exception detail.

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?

Upvotes: 4

Views: 332

Answers (3)

PPC-Coder
PPC-Coder

Reputation: 3632

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.

Upvotes: 4

Brian Rasmussen
Brian Rasmussen

Reputation: 116481

The message is telling you that somewhere in AddDocuments a null reference exception was thrown. It could be one of the parameters or a member.

Upvotes: 1

Kit Fisto
Kit Fisto

Reputation: 4515

Your stack trace means that either SimsBridge or SimsBridge.Bridge is null.

Upvotes: 1

Related Questions