In V8 it works fine to use MdlScanCriteriaP() and to call mdlScanCriteria_setXAttributeTest(), since there seems no fitting method published in ElementScanCriteria.
In CE the code will lead directly to an exception.
BCOM.ElementScanCriteria scanCri = new BCOM.ElementScanCriteriaClass();
int nTest = scanCri.MdlScanCriteriaP();
Int64 nTest64 = scanCri.MdlScanCriteriaP();
During the debugging I got always something like: 0xfffffffff44c9d50 == -196305584 == scanCri.MdlScanCriteriaP(). A strange thing for a pointer to start with 0xf….
If I go further and try any mdlScanCriteria_...() function I got exceptions like: “Exception thrown at 0x00007FFF4FA90BE0 (DgnPlatform5.dll) in microstation.exe: 0xC0000005: Access violation writing location 0xFFFFFFFFF44C9D5C.”, which is no surprise with such a strange pointer.
So, there are 3 Questions:1. Is it "just" a bug inside the SDK?2. Do I need some C#-voodoo bevor I can pass this pointer to native?3. Is there a way to set XAttribute Test direct in C#, so there is no need to call MdlScanCriteriaP()?
Thanks a Lot.
Volker Hüfner said:Do I need some C#-voodoo
I can't answer your question, but while researching it I came across this vodoo...
Volker Hüfner said:Int64 nTest64 = scanCri.MdlScanCriteriaP();
During the debugging I got always something like: 0xfffffffff44c9d50
Pointers are unsigned (where would a negative pointer point?). Does this improve your debugging?
UInt64 nTest64 = ...
Regards, Jon Summers LA Solutions
I agree, pointers are unsigned. and I would have expected UInt64 from MdlScanCriteriaP(). But it returns int :-O That's why I have posted this sample with int and Int64.
Converting to unsigned did not change the value to something more useful. I do not have that much memory on my Computer to be addressed by this pointer.
Mit freundlichen Grüßen / Best regards Volker Hüfner
| AB_DATE Engineering Software | ab-date.de |
I guess I got some proof. This seems to be a bug, based on some mixture of wrong size and/or signed/unsigned with integer variables!
On one computer with a small amount of Memory, MdlScanCriteriaP() sometimes returns a value smaller than MAXINT. And with this value, the pointer is valid and the mdlScanCriteria_set… functions work suddenly fine in the combination native/managed code.
Robert Hook hook could you, or someone else of the BDN-Team proof, if this is a real bug?
If so, what would be the solution for this problem?
And if not, what will be the workaround?