CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2005
    Posts
    11

    Struct declaration TypeLoadException

    Hi,

    What wrong with my struct declaration ?
    When I run my program, I got a TypeLoadException.

    Code:
    [StructLayout(LayoutKind.Explicit, CharSet=CharSet.Ansi, Size=16)] 
    struct InfoRegister 
    { 
       [FieldOffset(0)] 
       public uint TargetIdBitField; 
    
       [FieldOffset(4)] 
       [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9) ] 
       public byte[] Label; 
    
       [FieldOffset(13)] 
       public byte Mode; 
    
       [FieldOffset(14)] 
       public byte Index; 
    
       [FieldOffset(15)] 
       public byte CS; 
    
       [FieldOffset(0)] 
       [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16) ] 
       public ushort[] StructInUShortArray; 
    }
    Thanks

  2. #2
    Join Date
    Nov 2004
    Location
    Poland
    Posts
    1,355

    Re: Struct declaration TypeLoadException

    Just guessing:

    Two times [FieldOffset(0)] ?

  3. #3
    Join Date
    Nov 2004
    Posts
    105

    Re: Struct declaration TypeLoadException


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured