Debugging "Object reference not set to an instance of an object." error

My users (and I) get this error when trying to add a Buy To Job line to a PO that already has a Buy To Order line (not sure if that is related). The details of the error only show:

Application Error

Exception caught in: Epicor.ServiceModel

Error Detail 
============
Message: Object reference not set to an instance of an object.
Program: Epicor.ServiceModel.dll
Method: ShouldRethrowNonRetryableException

Client Stack Trace 
==================
   at Epicor.ServiceModel.Channels.ImplBase`1.ShouldRethrowNonRetryableException(Exception ex, DataSet[] dataSets)
   at Erp.Proxy.BO.POImpl.Update(PODataSet ds)
   at Erp.Adapters.POAdapter.OnUpdate()
   at Ice.Lib.Framework.EpiBaseAdapter.Update()
   at Erp.UI.App.POEntry.Transaction.Update()

I disabled the the BPMs related to PO’s but still get it. I’ve enabled Trcaing, but nothing jumps out at me in there.

What’s my next step?

Creating a new PO allows me to add the Job Material liines without any problems. So I don’t think it is something with the job.

and FWIW, the Job these materials are being bought for, is for the same Order that the BTO PO line was for.

Could there be a BPM on JobMtl or JobOper?

There are no BPM’s on any job related tables.

The purchaser just decided to make another PO for the Job Mtl lines. And that worked ok.

I’m going to write this one off as a one time thing - since I can’t repeat it now that a PO has been created for that Job Material.

I was more interested in what debugging could be done with the limited info (see error details above).

I wonder if you could use a BPM for debugging. A pre-process on the update method that either logs or displays the values of all the parameters and tables. I don’t know that you’d get anything different than tracing, but might help you spot null objects.

I sometimes decompile the assemblies and look for hints, too.