Problem with Marshal.SizeOf in CF 2.0

P

Per Rasmussen

When I execute these two lines in CF 2.0:

Type t1 = typeof(LINECALLPARAMS);
int a1 = Marshal.SizeOf(t1);

I get a NotSupportedException on the second line. According to the docs it
should not even be able to throw this exception. Here is a stacktrace:

ved System.Runtime.InteropServices.Marshal.SizeOfInternal()
ved System.Runtime.InteropServices.Marshal.SizeOf()
ved System.Runtime.InteropServices.Marshal.SizeOf()
....

"ved" means at (in danish).

Can anybody help me out?

Thanks in advance,
Per Rasmussen.
 
G

Guest

What's your definition of LINECALLPARAMS? It likely has an embedded
pointer, which is causing the marshaler grief.

-Chris
 
P

Per Rasmussen

The definition is:

public class LINECALLPARAMS : TapiStruct
{
public LINEDIALPARAMS DialParams;
public int dwAddressID;
public LINEADDRESSMODE dwAddressMode;
public int dwAddressType;
public LINEBEARERMODE dwBearerMode;
public int dwCallDataOffset;
public int dwCallDataSize;
public int dwCalledPartyOffset;
public int dwCalledPartySize;
public int dwCallingPartyIDOffset;
public int dwCallingPartyIDSize;
public LINECALLPARAMFLAGS dwCallParamFlags;
public int dwCommentOffset;
public int dwCommentSize;
public int dwDeviceClassOffset;
public int dwDeviceClassSize;
public int dwDeviceConfigOffset;
public int dwDeviceConfigSize;
public int dwDevSpecificOffset;
public int dwDevSpecificSize;
public int dwDisplayableAddressOffset;
public int dwDisplayableAddressSize;
public int dwHighLevelCompOffset;
public int dwHighLevelCompSize;
public int dwLowLevelCompOffset;
public int dwLowLevelCompSize;
public int dwMaxRate;
public LINEMEDIAMODE dwMediaMode;
public int dwMinRate;
public int dwNoAnswerTimeout;
public int dwOrigAddressOffset;
public int dwOrigAddressSize;
public int dwPredictiveAutoTransferStates;
public int dwReceivingFlowspecOffset;
public int dwReceivingFlowspecSize;
public int dwSendingFlowspecOffset;
public int dwSendingFlowspecSize;
public int dwTargetAddressOffset;
public int dwTargetAddressSize;
public int dwTotalSize;
public int dwUserUserInfoOffset;
public int dwUserUserInfoSize;

public LINECALLPARAMS(int size);

public string CalledParty { get; }
public string Comment { get; }
public string TargetAddress { get; }
}

As you might recognize, this is from TAPI wrapper.

What puzzles me is that this worked fine in CF 1.0. What is changed?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top