[CE U16 C++] Unable to create CreateCellElement1 with the COM Api

We have an application that uses the com api of MicroStation.

With the microstation application MicroStation V8i the following code worked.

In the progress of updating to MicroStation Connect we have an issue with the function CreateCellElement1.

As a simplified example, we are using the following code:

    #import "microstation.exe"
    //#import "microstaion.tlh"

    MicroStationDGN::_ModelReferencePtr model= createModel("model");
    model->Activate();
    MicroStationDGN::Point3d p1{ 000 };
    MicroStationDGN::Point3d p2{ 100 };
    MicroStationDGN::Point3d p3{110};
    MicroStationDGN::Point3d p4{ 010 };
    constexpr int numberOfEntries = 4;
    MicroStationDGN::_ElementPtr lineArrayPtr[numberOfEntries];
    lineArrayPtr[0] = m_appPtr->CreateLineElement2(nullptr, &p1, &p2);
    lineArrayPtr[1] = m_appPtr->CreateLineElement2(nullptr, &p2, &p4);
    lineArrayPtr[2] = m_appPtr->CreateLineElement2(nullptr, &p1, &p3);
    lineArrayPtr[3] = m_appPtr->CreateLineElement2(nullptr, &p3, &p4);


    SAFEARRAY* psa = nullptr;
    try
    {
        const LONG count = numberOfEntries;
        ATL::CComSafeArray<LPDISPATCH> sa(count);
        for (LONG i = 0; i < count; i++)
        {
            sa[i] = lineArrayPtr[i].GetInterfacePtr();
        }
        psa = sa.Detach();
    }
    catch (const CAtlException& e)
    {
        return;
    }

    MicroStationDGN::_ElementPtr cellElm = m_appPtr->CreateCellElement1(qPrintable("My Cell"), &psa, &p1, VARIANT_FALSE);  //Here we get a com_error:
    HRESULT hr = m_appPtr->ActiveModelReference->AddElement(cellElm);
    //model->AddElements(&psa); //This worked

For the _com_error we sometimes got the hr response: 0x80020010 and sometimes 0x80010105 RPC_E_SERVERFAULT.

Apparently microstation crashes when the CreateCellElement1 function is called. In the attachment is also the crash dump.

Do you have any ideas how we can fix this issue?

Inserted code

    #import "microstation.exe"
    //#import "microstaion.tlh"

    MicroStationDGN::_ModelReferencePtr model= createModel("model");
    model->Activate();
    MicroStationDGN::Point3d p1{ 0, 0, 0 };
    MicroStationDGN::Point3d p2{ 1, 0, 0 };
    MicroStationDGN::Point3d p3{1, 1, 0};
    MicroStationDGN::Point3d p4{ 0, 1, 0 };
    constexpr int numberOfEntries = 4;
    MicroStationDGN::_ElementPtr lineArrayPtr[numberOfEntries];
    lineArrayPtr[0] = m_appPtr->CreateLineElement2(nullptr, &p1, &p2);
    lineArrayPtr[1] = m_appPtr->CreateLineElement2(nullptr, &p2, &p4);
    lineArrayPtr[2] = m_appPtr->CreateLineElement2(nullptr, &p1, &p3);
    lineArrayPtr[3] = m_appPtr->CreateLineElement2(nullptr, &p3, &p4);


    SAFEARRAY* psa = nullptr;
    try
    {
        const LONG count = numberOfEntries;
        ATL::CComSafeArray<LPDISPATCH> sa(count);
        for (LONG i = 0; i < count; i++)
        {
            sa[i] = lineArrayPtr[i].GetInterfacePtr();
        }
        psa = sa.Detach();
    }
    catch (const CAtlException& e)
    {
        return;
    }

    MicroStationDGN::_ElementPtr cellElm = m_appPtr->CreateCellElement1(qPrintable("My Cell"), &psa, &p1, true);  //Here Hresult returned:
    HRESULT hr = m_appPtr->ActiveModelReference->AddElement(cellElm);
    //model->AddElement(cellElm); //To add this direclty into