4

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?

1
  • Its the second statement you're saying. Commented Mar 14, 2012 at 17:41

3 Answers 3

4

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.

Sign up to request clarification or add additional context in comments.

3 Comments

If that is the case, why wouldn't the stack trace show the corresponding line inside the "AddDocuments" method?
This is correct, I have checked it. The stack trace tells you the function call and the line number where the error occurs, not the line itself. My answer was wrong then.
@Arun I think because it's a "call" stack, most likely the exception was thrown during some code that was trying to use a null object so the target method never gets invoked.
1

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

1 Comment

The StackTrace is saying that something inside SimsBridge.Bridge is null
1

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.