none
C# Argument Not Proper Exception RRS feed

  • Question

  • I have the following function in my COM dll class

    [DispId(1610809401)]

    intWriteBinValues(refstringSignal, refArrayvalues, refboolWithEv);

    When I am using tthis function as

    mt.WriteBinValues(StateSignal, vals, value);

    where StateSignal is string

    vals is not of array type it is of some class type variable which is giving run time exception when I am running the code. How can I solve this exception?

    value is of bool type.

    Monday, June 3, 2013 3:24 AM

Answers

  • Does it work if you create and pass an array like this: ‘Array vals2 = new Array()’ and call like this: ‘mt.WriteBinValues(ref StateSignal, ref vals2, ref value)’? What is vals?

    Monday, June 3, 2013 6:00 AM
  • Not all string classes are the same.  If the dll was written in a generic c language (not c++ or C#) then you wil have a problem.  Try making the string a null terminate array.

                int WriteBinValues(ref char[] Signal, ref Array values, ref bool WithEv);
                string test = "The quick brown fox jumped over the lazy dog";
                char[] Signal = (test + "\0").ToCharArray();


    jdweng

    Monday, June 3, 2013 7:46 AM

All replies

  • Does it work if you create and pass an array like this: ‘Array vals2 = new Array()’ and call like this: ‘mt.WriteBinValues(ref StateSignal, ref vals2, ref value)’? What is vals?

    Monday, June 3, 2013 6:00 AM
  • Not all string classes are the same.  If the dll was written in a generic c language (not c++ or C#) then you wil have a problem.  Try making the string a null terminate array.

                int WriteBinValues(ref char[] Signal, ref Array values, ref bool WithEv);
                string test = "The quick brown fox jumped over the lazy dog";
                char[] Signal = (test + "\0").ToCharArray();


    jdweng

    Monday, June 3, 2013 7:46 AM