[i-model SDK] Element Geometry Causing AccessViolationException

Hello all,

I'm creating an application to extract geometry and properties from i-model files; I've been using the Desktop i-model SDK (V01.00.01.26) and noticed an issue when attempting to read the Building.i.dgn sample data. There are a number of Cell elements (one such element has element ID 4025) that contain MSBsplineSurface geometry, when attempting to get the geometry using IModelElement::Geometry there is an AccessViolationException. Here is a stack trace that shows where the exception is being generated:

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at Bentley.GeometryNET.MSBsplineSurface.RegisterNativePointer(RefCountedMSBsplineSurface* nativeP)
   at Bentley.GeometryNET.MSBsplineSurface.CreateFromNative(IntPtr nativeBits)
   at Bentley.DgnPlatformNET.ElementGraphicsProcessorImpl._ProcessSurface(ElementGraphicsProcessorImpl* , MSBsplineSurface* surface)
   at Bentley.DgnPlatform.ElementGraphicsOutput.Process(ElementHandle* , IElementGraphicsProcessor* , DgnModelRef* )
   at Bentley.DgnPlatformNET.ElementGraphicsOutput.Process(Element element, ElementGraphicsProcessor processor)
   at Bentley.DgnPlatformNET.DgnCommonGeometry.ElementGraphicsToIGeometry(Element element)
   at Bentley.IModel.Core.IModelElement.get_Geometry()

I've also found another developer posting about what appears to be the same issue: https://communities.bentley.com/communities/other_communities/chinafirst/f/microstation-projectwise/130771/imodel-sdk/398986

I'm unsure if this is an issue with the data, the SDK, or my code. Has anyone else experienced this? Is this a known issue? If so will it be fixed in a future release?

Thank you very much,

Matthew

Parents
  • Hi Matthew,

    Is this issue still outstanding? Are you using the x86 or x64 version of the SDK? Is there any way that you can send me the file and a snippet of your code? If you don't want to post it to the thread can you please email me (chris dot franklyn at bentley).

  • Unfortunately we are still experiencing this issue and have learned that some of our customers have experienced it as well. We are working on getting permission to share some customer data but in the mean time Building.i.dgn which is included with the V01.00.01.26 SDK as sample data has this issue. (Unfortunately it is slightly too big to be uploaded here...)


    Details of the issue:

    We are using the Desktop i-model SDK V01.00.01.26, released 04/14/2016; which is currently available on the Bentley Fulfillment Center. We believe the issue to be related to the element with ID "4025", this element can be selected within Microstation by using the following Key-In command: "select byelemid 4025".

    We are compiling a C++ DLL with /clr (to load the C# libraries) with the Visual Studio 2015 compiler.

    Sample code roughly outlining what our code is doing:

    IModel^ model = IModel::Open(dataset);
    IEnumerator<IModelElement^>^ elemIter = model->Elements->GetEnumerator();
    IModelElement^ elem;
    
    while (elemIter->MoveNext())
    {
      elem = elemIter->Current;
      // This call to Geometry() causes the issue if
      // the geometry type is an MBSplineSurface.
      IGeometry^ geom = elem->Geometry();
      // process geom...
    }

    Any help would be greatly appreciated, if you need any additional details please let me know.

    Thank you very much,

    Matthew

Reply
  • Unfortunately we are still experiencing this issue and have learned that some of our customers have experienced it as well. We are working on getting permission to share some customer data but in the mean time Building.i.dgn which is included with the V01.00.01.26 SDK as sample data has this issue. (Unfortunately it is slightly too big to be uploaded here...)


    Details of the issue:

    We are using the Desktop i-model SDK V01.00.01.26, released 04/14/2016; which is currently available on the Bentley Fulfillment Center. We believe the issue to be related to the element with ID "4025", this element can be selected within Microstation by using the following Key-In command: "select byelemid 4025".

    We are compiling a C++ DLL with /clr (to load the C# libraries) with the Visual Studio 2015 compiler.

    Sample code roughly outlining what our code is doing:

    IModel^ model = IModel::Open(dataset);
    IEnumerator<IModelElement^>^ elemIter = model->Elements->GetEnumerator();
    IModelElement^ elem;
    
    while (elemIter->MoveNext())
    {
      elem = elemIter->Current;
      // This call to Geometry() causes the issue if
      // the geometry type is an MBSplineSurface.
      IGeometry^ geom = elem->Geometry();
      // process geom...
    }

    Any help would be greatly appreciated, if you need any additional details please let me know.

    Thank you very much,

    Matthew

Children
No Data