C
Chakravarthy Bollapalli \(IFIN SCC COM\)
Hi,
I tried to retrieve CustomAttributes from a field in a class that has a
MarshalAs attribute but I couldn't.
Out of frustration I tried all possible combinations.
GetCustomAttributes(true);
GetCustomAttributes(false);
GetCustomAttributes(typeof(MarshalAsAttribute), true);
GetCustomAttributes(typeof(MarshalAsAttribute), false);
but all 4 calls consistently gave me 0 size sized array.
Any help or pointers on how to retrieve "MarshalAs" attributes ?
TIA
kalyan
=============================================================
PS:
Why do .GetType() calls on objects of classes having
"[StructLayout(LayoutKind.Sequential)]"
attribute throw the following exception.
----------------------------------
An unhandled exception of type 'System.TypeLoadException' occurred in
Test.exe
Additional information: Could not load type Test.ServerInfo from assembly
Test, Version=1.0.1761.19867, Culture=neutral, PublicKeyToken=null because
the format is invalid.
--------------------------------------
I tried to retrieve CustomAttributes from a field in a class that has a
MarshalAs attribute but I couldn't.
Out of frustration I tried all possible combinations.
GetCustomAttributes(true);
GetCustomAttributes(false);
GetCustomAttributes(typeof(MarshalAsAttribute), true);
GetCustomAttributes(typeof(MarshalAsAttribute), false);
but all 4 calls consistently gave me 0 size sized array.
Any help or pointers on how to retrieve "MarshalAs" attributes ?
TIA
kalyan
=============================================================
PS:
Why do .GetType() calls on objects of classes having
"[StructLayout(LayoutKind.Sequential)]"
attribute throw the following exception.
----------------------------------
An unhandled exception of type 'System.TypeLoadException' occurred in
Test.exe
Additional information: Could not load type Test.ServerInfo from assembly
Test, Version=1.0.1761.19867, Culture=neutral, PublicKeyToken=null because
the format is invalid.
--------------------------------------