Error : Type could not be marshaled because the length of an embedded array instance does not match the declared length in the layout

后端 未结 2 1670
旧巷少年郎
旧巷少年郎 2021-01-21 01:10

i am using a COM dll in my C# Project. I have one USERINFO Structure in my COM dll which looks like :

struct USERINFO
{
        BYTE UserID[USER_ID_SIZE];//42
           


        
2条回答
  •  情歌与酒
    2021-01-21 01:36

    I had a similar problem once and it's been solved by adding a constructor for the struct:

        struct A
        {
          public A(int b, int c)
          {
            B = b;
            C = c;
          }
    
          public int B;
          public int C
        }
    

    worth trying!

提交回复
热议问题