Hello all,
I want to iterate over all Itemtypes in a all Libraries but I get an Memory Exception in the second iteration in following Code:
try { ItemTypeLibraryPtr itemTypeLibrary = ItemTypeLibrary::FindByName(libName.c_str(), *ISessionMgr::GetActiveDgnFile()); for (ItemTypeLibrary::iterator iter = itemTypeLibrary->begin(); iter != itemTypeLibrary->end(); ++iter) { if (WString::IsNullOrEmpty(iter->GetName())) continue; auto name = iter-> GetName(); } } catch (...) { printf("Error\n"); }
The Exception appears when I try to retrieve the name or the internalName of the Item Type:
The Try - catch Block is not throwing aswell.
Am I using the iterator in wrong way or is there an alternative possibility to retrieve the Names of all Itemtypes in a library?
Thanks in advance
Manu
This is a reproducible issue. We have filed below bug:
BUG 1037870 : Exception occurred while iterating ItemType by using C++
For now, you can use below revised header file to replace your current one to overcome this bug.
https://communities.bentley.com/cfs-file/__key/communityserver-discussions-components-files/343173/CustomItemType.h
Just add one line as below shown: