AutomationException: 0x800a03ec - An unexpected error occurred with the method |
|
Contents
- SYMPTOMS
- CAUSE
- RESOLUTION
SYMPTOMS
When accessing Microsoft Office Project Professional 2003 (11.0.2003.0816.15) from a Java client which invokes the getValue() method of TimeScaleValue object for several times, you may get AutomationException: 0x800a03ec - An unexpected error occurred with the method.
CAUSE
This is a bug in Microsoft Project which prevents holding references to a certain number of TimeScaleValue objects, and you will get the same 0x800a03ec error in C# or VB.NET client when retrieving the Value property of TimeScaleValue object in a loop which iterates more than 10 times. The garbage collector of .NET or Java is not clearing up the references fast enough.
RESOLUTION
To workaround this problem, wrap your code using trackObjectsInCurrentThread/releaseAllInCurrentThread and place a call to release(...) at the end of the loop to force garbage collection. For example:
for (int iSlice = 1; iSlice <= nSlices; iSlice++) {
com.linar.jintegra.Cleaner.trackObjectsInCurrentThread();
TimeScaleValue tsv = new TimeScaleValueProxy(tim.getItem(iSlice));
// your code:
...
com.linar.jintegra.Cleaner.release(...);
com.linar.jintegra.Cleaner.releaseAllInCurrentThread();
}