Exceptions while creating an Bookmark-TreeView

Hi,

I get exceptions if I try to fill a TreeView with the bookmarks of an
pdf-doc.
The strange thing is the exceptions differ and occur sporadically.

I have to say it is a pretty large pdf with about 400 pages and 1100
bookmarks.

If I debug the code everything works fine, even if I send the
mainthread to sleep for 2sec before I read the
bookmark data everything works as expected.

I use almost the same code as you provided in your sample (http://
www.pdftron.com/pdfnet/samplecode/BookmarkTest.cs).

My assumption is the loading of the pdf-doc works asynchronously.
Because I read the bookmark data almost after I load the doc itself
the loading process might not be ready.
If so, how to get an information when the loading finished?

The errors:

- Message: Object header not found
   Conditional expression: false
   Filename : ObjParser.cpp
   Function : trn::SDF::ObjParser::GetObj
   Linenumber : 199

- Message: The dictionary does not contain required key: S
   Conditional expression: false
   Filename : Dict.cpp
   Function : trn::SDF::Dict::Get
   Linenumber : 82

- sometimes I also get an AccessViolationException or the application
crashes without any message.

Regards,
Jan

I assume that you are creating your own bookmark tree for a document
that is opened in PDFViewCtrl. If this is the case, you need to lock
the document whenever you access any information (i.e. read or write)
in the PDFViewCtrl document. For example:

view.GetDoc().Lock();
FillBookmarkTree();
view.GetDoc().Unlock();