ExecutionEngineException problems

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Magnus Ullberg

    #1

    ExecutionEngineException problems

    How do i convert the following structure declaration from c++ to c#?

    #pragma pack(push,1) //Byte alignment
    struct TtsrPlayerInfo
    {
    int PlayerID;
    int ChannelID;
    char NickName[30];
    int PlayerChannelPr ivileges;
    int PlayerPrivilege s;
    int PlayerFlags;
    };
    #pragma pack(pop)

    I've tried adding the following line just above the struct but it doesnt
    seem to help. When the code runs i get a ExecutionEngine Exception.
    [StructLayout(Sy stem.Runtime.In teropServices.L ayoutKind.Seque ntial, Pack =
    1)]

    What i'm trying to do is to get data from an external DLL imported using
    DLLImport. I can get data from other dll calls just fine as long as the data
    structure doesn't contain a char[].

    Thanks,
    Magnus Ullberg



  • decrypted

    #2
    Re: ExecutionEngine Exception problems

    struct TtsrPlayerInfo
    {
    //construct
    public TtsrPlayerInfo( ) { }

    //params
    public int PlayerID;
    public int ChannelID;
    public char NickName[30];
    public int PlayerChannelPr ivileges;
    public int PlayerPrivilege s;
    public int PlayerFlags;
    }

    -dec

    g" <magnus@areacon sulting.us> wrote in message
    news:e83LFhleDH A.1764@TK2MSFTN GP09.phx.gbl...[color=blue]
    > How do i convert the following structure declaration from c++ to c#?
    >
    > #pragma pack(push,1) //Byte alignment
    > struct TtsrPlayerInfo
    > {
    > int PlayerID;
    > int ChannelID;
    > char NickName[30];
    > int PlayerChannelPr ivileges;
    > int PlayerPrivilege s;
    > int PlayerFlags;
    > };
    > #pragma pack(pop)
    >
    > I've tried adding the following line just above the struct but it doesnt
    > seem to help. When the code runs i get a ExecutionEngine Exception.
    > [StructLayout(Sy stem.Runtime.In teropServices.L ayoutKind.Seque ntial, Pack =
    > 1)]
    >
    > What i'm trying to do is to get data from an external DLL imported using
    > DLLImport. I can get data from other dll calls just fine as long as the[/color]
    data[color=blue]
    > structure doesn't contain a char[].
    >
    > Thanks,
    > Magnus Ullberg
    >
    >
    >[/color]


    Comment

    • decrypted

      #3
      Re: ExecutionEngine Exception problems

      By the way...notice in my code there is no ; after the last }...this is
      important if you missed it

      "Magnus Ullberg" <magnus@areacon sulting.us> wrote in message
      news:e83LFhleDH A.1764@TK2MSFTN GP09.phx.gbl...[color=blue]
      > How do i convert the following structure declaration from c++ to c#?
      >
      > #pragma pack(push,1) //Byte alignment
      > struct TtsrPlayerInfo
      > {
      > int PlayerID;
      > int ChannelID;
      > char NickName[30];
      > int PlayerChannelPr ivileges;
      > int PlayerPrivilege s;
      > int PlayerFlags;
      > };
      > #pragma pack(pop)
      >
      > I've tried adding the following line just above the struct but it doesnt
      > seem to help. When the code runs i get a ExecutionEngine Exception.
      > [StructLayout(Sy stem.Runtime.In teropServices.L ayoutKind.Seque ntial, Pack =
      > 1)]
      >
      > What i'm trying to do is to get data from an external DLL imported using
      > DLLImport. I can get data from other dll calls just fine as long as the[/color]
      data[color=blue]
      > structure doesn't contain a char[].
      >
      > Thanks,
      > Magnus Ullberg
      >
      >
      >[/color]


      Comment

      • Magnus Ullberg

        #4
        Re: ExecutionEngine Exception problems

        Are you sure this is c# code?
        I'm looking to convert this c++ code to c#..

        "decrypted" <decrypted@eart hlink.net> wrote in message
        news:%23AqraUue DHA.2432@TK2MSF TNGP11.phx.gbl. ..[color=blue]
        > struct TtsrPlayerInfo
        > {
        > //construct
        > public TtsrPlayerInfo( ) { }
        >
        > //params
        > public int PlayerID;
        > public int ChannelID;
        > public char NickName[30];
        > public int PlayerChannelPr ivileges;
        > public int PlayerPrivilege s;
        > public int PlayerFlags;
        > }
        >
        > -dec
        >
        > g" <magnus@areacon sulting.us> wrote in message
        > news:e83LFhleDH A.1764@TK2MSFTN GP09.phx.gbl...[color=green]
        > > How do i convert the following structure declaration from c++ to c#?
        > >
        > > #pragma pack(push,1) //Byte alignment
        > > struct TtsrPlayerInfo
        > > {
        > > int PlayerID;
        > > int ChannelID;
        > > char NickName[30];
        > > int PlayerChannelPr ivileges;
        > > int PlayerPrivilege s;
        > > int PlayerFlags;
        > > };
        > > #pragma pack(pop)
        > >
        > > I've tried adding the following line just above the struct but it doesnt
        > > seem to help. When the code runs i get a ExecutionEngine Exception.
        > > [StructLayout(Sy stem.Runtime.In teropServices.L ayoutKind.Seque ntial, Pack[/color][/color]
        =[color=blue][color=green]
        > > 1)]
        > >
        > > What i'm trying to do is to get data from an external DLL imported using
        > > DLLImport. I can get data from other dll calls just fine as long as the[/color]
        > data[color=green]
        > > structure doesn't contain a char[].
        > >
        > > Thanks,
        > > Magnus Ullberg
        > >
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • Jeffrey Tan[MSFT]

          #5
          Re: ExecutionEngine Exception problems


          Hi Magnus,

          Why do you think it is not C# code?
          What problem do you get?

          Best regards,
          Jeffrey Tan
          Microsoft Online Partner Support
          Get Secure! - www.microsoft.com/security
          This posting is provided "as is" with no warranties and confers no rights.

          --------------------
          | Reply-To: "Magnus Ullberg" <magnus@areacon sulting.us>
          | From: "Magnus Ullberg" <magnus@areacon sulting.us>
          | References: <e83LFhleDHA.17 64@TK2MSFTNGP09 .phx.gbl>
          <#AqraUueDHA.24 32@TK2MSFTNGP11 .phx.gbl>
          | Subject: Re: ExecutionEngine Exception problems
          | Date: Mon, 15 Sep 2003 08:23:42 -0500
          | Lines: 57
          | Organization: Area Consulting Group, Inc.
          | X-Priority: 3
          | X-MSMail-Priority: Normal
          | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
          | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
          | Message-ID: <uyWr1z4eDHA.23 28@TK2MSFTNGP09 .phx.gbl>
          | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
          | NNTP-Posting-Host: ky-owensboro1b-121.owboky.adel phia.net 24.52.178.121
          | Path:
          cpmsftngxa07.ph x.gbl!cpmsftngx a10.phx.gbl!TK2 MSFTNGXA05.phx. gbl!TK2MSFTNGP0 8
          .phx.gbl!TK2MSF TNGP09.phx.gbl
          | Xref: cpmsftngxa07.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1842 02
          | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
          |
          | Are you sure this is c# code?
          | I'm looking to convert this c++ code to c#..
          |
          | "decrypted" <decrypted@eart hlink.net> wrote in message
          | news:%23AqraUue DHA.2432@TK2MSF TNGP11.phx.gbl. ..
          | > struct TtsrPlayerInfo
          | > {
          | > //construct
          | > public TtsrPlayerInfo( ) { }
          | >
          | > //params
          | > public int PlayerID;
          | > public int ChannelID;
          | > public char NickName[30];
          | > public int PlayerChannelPr ivileges;
          | > public int PlayerPrivilege s;
          | > public int PlayerFlags;
          | > }
          | >
          | > -dec
          | >
          | > g" <magnus@areacon sulting.us> wrote in message
          | > news:e83LFhleDH A.1764@TK2MSFTN GP09.phx.gbl...
          | > > How do i convert the following structure declaration from c++ to c#?
          | > >
          | > > #pragma pack(push,1) //Byte alignment
          | > > struct TtsrPlayerInfo
          | > > {
          | > > int PlayerID;
          | > > int ChannelID;
          | > > char NickName[30];
          | > > int PlayerChannelPr ivileges;
          | > > int PlayerPrivilege s;
          | > > int PlayerFlags;
          | > > };
          | > > #pragma pack(pop)
          | > >
          | > > I've tried adding the following line just above the struct but it
          doesnt
          | > > seem to help. When the code runs i get a ExecutionEngine Exception.
          | > > [StructLayout(Sy stem.Runtime.In teropServices.L ayoutKind.Seque ntial,
          Pack
          | =
          | > > 1)]
          | > >
          | > > What i'm trying to do is to get data from an external DLL imported
          using
          | > > DLLImport. I can get data from other dll calls just fine as long as
          the
          | > data
          | > > structure doesn't contain a char[].
          | > >
          | > > Thanks,
          | > > Magnus Ullberg
          | > >
          | > >
          | > >
          | >
          | >
          |
          |
          |

          Comment

          • Magnus Ullberg

            #6
            Re: ExecutionEngine Exception problems

            public char NickName[30];

            Syntax error, bad array declarator. To declare a managed array the rank
            specifier precedes the variable's identifier.

            I apreciate the help, someone in interop found a solution to my problem.

            "Jeffrey Tan[MSFT]" <v-jetan@online.mi crosoft.com> wrote in message
            news:uz1$VtBfDH A.3192@cpmsftng xa07.phx.gbl...[color=blue]
            >
            > Hi Magnus,
            >
            > Why do you think it is not C# code?
            > What problem do you get?
            >
            > Best regards,
            > Jeffrey Tan
            > Microsoft Online Partner Support
            > Get Secure! - www.microsoft.com/security
            > This posting is provided "as is" with no warranties and confers no rights.
            >
            > --------------------
            > | Reply-To: "Magnus Ullberg" <magnus@areacon sulting.us>
            > | From: "Magnus Ullberg" <magnus@areacon sulting.us>
            > | References: <e83LFhleDHA.17 64@TK2MSFTNGP09 .phx.gbl>
            > <#AqraUueDHA.24 32@TK2MSFTNGP11 .phx.gbl>
            > | Subject: Re: ExecutionEngine Exception problems
            > | Date: Mon, 15 Sep 2003 08:23:42 -0500
            > | Lines: 57
            > | Organization: Area Consulting Group, Inc.
            > | X-Priority: 3
            > | X-MSMail-Priority: Normal
            > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
            > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
            > | Message-ID: <uyWr1z4eDHA.23 28@TK2MSFTNGP09 .phx.gbl>
            > | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
            > | NNTP-Posting-Host: ky-owensboro1b-121.owboky.adel phia.net 24.52.178.121
            > | Path:
            >[/color]
            cpmsftngxa07.ph x.gbl!cpmsftngx a10.phx.gbl!TK2 MSFTNGXA05.phx. gbl!TK2MSFTNGP0 8[color=blue]
            > phx.gbl!TK2MSFT NGP09.phx.gbl
            > | Xref: cpmsftngxa07.ph x.gbl[/color]
            microsoft.publi c.dotnet.langua ges.csharp:1842 02[color=blue]
            > | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
            > |
            > | Are you sure this is c# code?
            > | I'm looking to convert this c++ code to c#..
            > |
            > | "decrypted" <decrypted@eart hlink.net> wrote in message
            > | news:%23AqraUue DHA.2432@TK2MSF TNGP11.phx.gbl. ..
            > | > struct TtsrPlayerInfo
            > | > {
            > | > //construct
            > | > public TtsrPlayerInfo( ) { }
            > | >
            > | > //params
            > | > public int PlayerID;
            > | > public int ChannelID;
            > | > public char NickName[30];
            > | > public int PlayerChannelPr ivileges;
            > | > public int PlayerPrivilege s;
            > | > public int PlayerFlags;
            > | > }
            > | >
            > | > -dec
            > | >
            > | > g" <magnus@areacon sulting.us> wrote in message
            > | > news:e83LFhleDH A.1764@TK2MSFTN GP09.phx.gbl...
            > | > > How do i convert the following structure declaration from c++ to c#?
            > | > >
            > | > > #pragma pack(push,1) //Byte alignment
            > | > > struct TtsrPlayerInfo
            > | > > {
            > | > > int PlayerID;
            > | > > int ChannelID;
            > | > > char NickName[30];
            > | > > int PlayerChannelPr ivileges;
            > | > > int PlayerPrivilege s;
            > | > > int PlayerFlags;
            > | > > };
            > | > > #pragma pack(pop)
            > | > >
            > | > > I've tried adding the following line just above the struct but it
            > doesnt
            > | > > seem to help. When the code runs i get a ExecutionEngine Exception.
            > | > > [StructLayout(Sy stem.Runtime.In teropServices.L ayoutKind.Seque ntial,
            > Pack
            > | =
            > | > > 1)]
            > | > >
            > | > > What i'm trying to do is to get data from an external DLL imported
            > using
            > | > > DLLImport. I can get data from other dll calls just fine as long as
            > the
            > | > data
            > | > > structure doesn't contain a char[].
            > | > >
            > | > > Thanks,
            > | > > Magnus Ullberg
            > | > >
            > | > >
            > | > >
            > | >
            > | >
            > |
            > |
            > |
            >[/color]


            Comment

            • Jeffrey Tan[MSFT]

              #7
              Re: ExecutionEngine Exception problems


              Oh yes, in C#, it should be like this:
              public char [] NickName;

              I am glad your problem got resolved.

              Best regards,
              Jeffrey Tan
              Microsoft Online Partner Support
              Get Secure! - www.microsoft.com/security
              This posting is provided "as is" with no warranties and confers no rights.

              --------------------
              | Reply-To: "Magnus Ullberg" <magnus@areacon sulting.us>
              | From: "Magnus Ullberg" <magnus@areacon sulting.us>
              | References: <e83LFhleDHA.17 64@TK2MSFTNGP09 .phx.gbl>
              <#AqraUueDHA.24 32@TK2MSFTNGP11 .phx.gbl>
              <uyWr1z4eDHA.23 28@TK2MSFTNGP09 .phx.gbl>
              <uz1$VtBfDHA.31 92@cpmsftngxa07 .phx.gbl>
              | Subject: Re: ExecutionEngine Exception problems
              | Date: Tue, 16 Sep 2003 08:11:27 -0500
              | Lines: 110
              | Organization: Area Consulting Group, Inc.
              | X-Priority: 3
              | X-MSMail-Priority: Normal
              | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
              | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
              | Message-ID: <uR20oRFfDHA.17 52@TK2MSFTNGP10 .phx.gbl>
              | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
              | NNTP-Posting-Host: ky-owensboro1b-121.owboky.adel phia.net 24.52.178.121
              | Path:
              cpmsftngxa07.ph x.gbl!cpmsftngx a10.phx.gbl!cpm sftngxa06.phx.g bl!TK2MSFTNGP08 .
              phx.gbl!TK2MSFT NGP10.phx.gbl
              | Xref: cpmsftngxa07.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1845 38
              | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
              |
              | public char NickName[30];
              |
              | Syntax error, bad array declarator. To declare a managed array the rank
              | specifier precedes the variable's identifier.
              |
              | I apreciate the help, someone in interop found a solution to my problem.
              |
              | "Jeffrey Tan[MSFT]" <v-jetan@online.mi crosoft.com> wrote in message
              | news:uz1$VtBfDH A.3192@cpmsftng xa07.phx.gbl...
              | >
              | > Hi Magnus,
              | >
              | > Why do you think it is not C# code?
              | > What problem do you get?
              | >
              | > Best regards,
              | > Jeffrey Tan
              | > Microsoft Online Partner Support
              | > Get Secure! - www.microsoft.com/security
              | > This posting is provided "as is" with no warranties and confers no
              rights.
              | >
              | > --------------------
              | > | Reply-To: "Magnus Ullberg" <magnus@areacon sulting.us>
              | > | From: "Magnus Ullberg" <magnus@areacon sulting.us>
              | > | References: <e83LFhleDHA.17 64@TK2MSFTNGP09 .phx.gbl>
              | > <#AqraUueDHA.24 32@TK2MSFTNGP11 .phx.gbl>
              | > | Subject: Re: ExecutionEngine Exception problems
              | > | Date: Mon, 15 Sep 2003 08:23:42 -0500
              | > | Lines: 57
              | > | Organization: Area Consulting Group, Inc.
              | > | X-Priority: 3
              | > | X-MSMail-Priority: Normal
              | > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
              | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
              | > | Message-ID: <uyWr1z4eDHA.23 28@TK2MSFTNGP09 .phx.gbl>
              | > | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
              | > | NNTP-Posting-Host: ky-owensboro1b-121.owboky.adel phia.net
              24.52.178.121
              | > | Path:
              | >
              |
              cpmsftngxa07.ph x.gbl!cpmsftngx a10.phx.gbl!TK2 MSFTNGXA05.phx. gbl!TK2MSFTNGP0 8
              | > phx.gbl!TK2MSFT NGP09.phx.gbl
              | > | Xref: cpmsftngxa07.ph x.gbl
              | microsoft.publi c.dotnet.langua ges.csharp:1842 02
              | > | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
              | > |
              | > | Are you sure this is c# code?
              | > | I'm looking to convert this c++ code to c#..
              | > |
              | > | "decrypted" <decrypted@eart hlink.net> wrote in message
              | > | news:%23AqraUue DHA.2432@TK2MSF TNGP11.phx.gbl. ..
              | > | > struct TtsrPlayerInfo
              | > | > {
              | > | > //construct
              | > | > public TtsrPlayerInfo( ) { }
              | > | >
              | > | > //params
              | > | > public int PlayerID;
              | > | > public int ChannelID;
              | > | > public char NickName[30];
              | > | > public int PlayerChannelPr ivileges;
              | > | > public int PlayerPrivilege s;
              | > | > public int PlayerFlags;
              | > | > }
              | > | >
              | > | > -dec
              | > | >
              | > | > g" <magnus@areacon sulting.us> wrote in message
              | > | > news:e83LFhleDH A.1764@TK2MSFTN GP09.phx.gbl...
              | > | > > How do i convert the following structure declaration from c++ to
              c#?
              | > | > >
              | > | > > #pragma pack(push,1) //Byte alignment
              | > | > > struct TtsrPlayerInfo
              | > | > > {
              | > | > > int PlayerID;
              | > | > > int ChannelID;
              | > | > > char NickName[30];
              | > | > > int PlayerChannelPr ivileges;
              | > | > > int PlayerPrivilege s;
              | > | > > int PlayerFlags;
              | > | > > };
              | > | > > #pragma pack(pop)
              | > | > >
              | > | > > I've tried adding the following line just above the struct but it
              | > doesnt
              | > | > > seem to help. When the code runs i get a ExecutionEngine Exception.
              | > | > >
              [StructLayout(Sy stem.Runtime.In teropServices.L ayoutKind.Seque ntial,
              | > Pack
              | > | =
              | > | > > 1)]
              | > | > >
              | > | > > What i'm trying to do is to get data from an external DLL imported
              | > using
              | > | > > DLLImport. I can get data from other dll calls just fine as long
              as
              | > the
              | > | > data
              | > | > > structure doesn't contain a char[].
              | > | > >
              | > | > > Thanks,
              | > | > > Magnus Ullberg
              | > | > >
              | > | > >
              | > | > >
              | > | >
              | > | >
              | > |
              | > |
              | > |
              | >
              |
              |
              |

              Comment

              Working...