UnmanagedType.LPArray and ClassInterfaceType.None


i having problem piece of code. can call getconnectionrawdata method unmanaged code (powerbuilder), when try reference properties of connectiondata errors. if rid of "[classinterface(classinterfacetype.none)]" have no problem accessing properties of connectiondata. there dll conflict? attributes used properly? appreciated.

    [comvisible(true)]
    [classinterface(classinterfacetype.none)]
    [guid("1b09a9e8-480f-4b4b-95f5-2cd6586b44a7")]
    public class dbconfigproxyfacade : idbconfigproxy, idisposable
    {

        [comvisible(true)]
        [return: marshalas(unmanagedtype.lparray)]
        public connectiondata[] getconnectionrawdata(connectiontype i_connectiontype)
        {
            try
            {
                connectiondata[] connectiondata = _internalweb.getconnectionrawdata(i_connectiontype);
                return connectiondata;
            }
            catch (exception ex)
            {
                errormessage = string.format("failed connection data configuration service. attempting top file. {0}", ex.message);
                return new connectiondata[] {};
            }

        }

why using lparray? requires second parameter says how many items in array.

in case, looks easier use self-describing safearray.


mattias, c# mvp


.NET Framework  >  Common Language Runtime Internals and Architecture



Comments

Popular posts from this blog

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

Azure DocumentDB Owner resource does not exist

SQL Server 2008 - High Memory Usage