Com Interop Exceptions with Timephased Data

M

mobe

I have been working on some .net code to enter timephased data into project,
via a managed addin, and have been getting Com interop errors randomly
interspersed (COMPlusExceptionCode -532459699, COMException -2146827284)

The code is reasonably simple, and using exactly the same test data and
conditions, it might fail on the 31st, or it might fail on the 12, or the
10th. With exactly the same data... The below code fails randomly on the
"timeScaleValue.Value =". When the error occurs, the timescale.value object
does not get set properly after the call to assignment.TimeScaleData(). The
Value object is a ComInteropException class object rather than a String or
Double, as it failed getting the data.

TimeScaleValues timeScaleValues = assignment.TimeScaleData(
date,
date.AddDays(1),
PjAssignmentTimescaledData.pjAssignmentTimescaledActualWork,
PjTimescaleUnit.pjTimescaleDays,
1);
foreach (TimeScaleValue timeScaleValue in timeScaleValues)
{
timeScaleValue.Value = (double)(hours * 60.0);
break;
}

I've tried a lot of variants of this code, like not setting the value, and
deleting the timescalevalue and just Add()-ing a new one, and But same
deal - random cominterop errors.

Any help/tips would be greatly appreciated
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top