Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7055677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:46:39+00:00 2026-05-28T03:46:39+00:00

i am using a COM dll in my C# Project. I have one USERINFO

  • 0

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
        BYTE FirstName[NAME_SIZE];//66
        BYTE LastName[NAME_SIZE]; //66
        long Pin;
        BYTE TimeGroupIDList[IDLIST_SIZE];//10
        enum EUserKind   eUserKind;
        BYTE WarningEye;        
};

When i use this structure in my C# Application to fill this structure for User data and pass to my AddUser API it returns this Error.

Any help is appreciated.
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:46:39+00:00Added an answer on May 28, 2026 at 3:46 am

    C# does not support fixed-length arrays embedded in a struct (except in an unsafe context) so your C structure is probably being marshalled into a C# structure something like this:

    struct USERINFO
    {
        MarshalAs(UnmanagedType.ByValArray, SizeConst = 42)
        BYTE[] UserID;
        MarshalAs(UnmanagedType.ByValArray, SizeConst = 66)
        BYTE[] FirstName;
        // etc.
    };
    

    Note that the members are references to arrays, not embedded arrays.

    For the marshalling to work the arrays have to be exactly the right length (or maybe at least the right length, I forget). For example, UserID should be initialised with userInfo.UserID = new byte[42];

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a pretty mature COM dll, which we test using DUnit. One of
I have written a COM dll, and wish to register it using regsvr32 myComdll.dll
I've written a .NET DLL which is called from another application using COM interop.
I have a COM inproc DLL that we are using in our product. Now
I have a VB6 dll that is trying to create a COM object using
I have a .NET WinForms application that I've converted into a COM dll using
using: VS2008, C# I have a COM dll I need to use in a
I have already added delay loading to my project, using the instructions in http://msdn.microsoft.com/en-us/library/151kt790.aspx
I have a C++ DLL project which is created in VS 2010. It is
I have a c# class library project that uses a COM dll registered on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.