[C++/CLI]Nativeの構造体をラッピングする② | Assertion Failed!

[C++/CLI]Nativeの構造体をラッピングする②

構造体メンバに固定長配列を含む場合のラッピング

/*
 *Native(C言語)での構造体定義
 */
typedef struct tagTEST2
{
  unsigned char str[8];
  unsigned long ulMember;
} TEST2;


/*
 *C++/CLIでラッピングしたクラス
 */
public ref class M_TEST2
{
private:
  TEST2 *st;
  array<System::Byte>^ m_str;
public:
  M_TEST2()
  {
    st = new TEST2();
    m_str = gcnew array<System::Byte>(8);
  }
  ~M_TEST2()
  {
    if (st != NULL)
    {
      delete st;
      st = NULL;
    }
  }

  property array<System::Byte>^ Str
  {
    array<System::Byte>^ get()
    {
      for (int i = 0; i < 8; i ++)
      {
        m_str[i] = st->str[i];
      }
      return m_str;
    }
    void set(array<System::Byte>^ value)
    {
      m_str = value;
      for (int i = 0; i < 8; i++)
      {
        st->str[i] = m_str[i];
      }
    }
  }
};