1. Petr Czerny
  2. PowerBuilder
  3. Friday, 3 December 2021 15:55 PM UTC

I try call .net function (copy form PB help Calling .NET Assembly in an Application) imported by .NET DLL Importer 

  //array argument
        public void TestByteArray(byte[] bArray)
        {
            for(int i = 0; i < bArray.Length; i++)
            {
            }
        }

and get error: Error calling external object function xxxxxxx (V externí součásti došlo k výjimce.) at line 23 in function of_xxxxxxx of object nvo_test_pb.

In help is written that array of base types is supported:

PowerBuilder

C#

Array (one and two dimension)

Reference

Generic Nullable<T>

int

short

Supported

Supported

Supported

uint

ushort

Supported

Supported

Supported

long

int

Supported

Supported

Supported

longptr

int32/int64

Supported

Supported

Supported

ulong

uint

Supported

Supported

Supported

longlong

long/Int64

Supported

Supported

Supported

boolean

bool

Supported

Supported

Supported

char

string/char

Supported

Supported

Supported

string

string

Supported

Supported

Unsupported

real

float

Supported

Supported

Supported

double

double

Supported

Supported

Supported

decimal

decimal

Supported

Supported

Supported

blob

byte[]

Supported

Supported

Supported

Date

DateTime

Supported

Supported

Supported

DateTime

DateTime

Supported

Supported

Supported

Time

DateTime

Supported

Supported

Supported

But in answer:

Powerserver parameters to DotNet Component (appeon.com)

is witten by Marco Meoni: Unfortunately non-primitive type parameters such as arrays are unsupported in AppeonDotNetComponent

How is It?

Thanks.

 
Petr Czerny Accepted Answer Pending Moderation
  1. Friday, 3 December 2021 16:16 PM UTC
  2. PowerBuilder
  3. # 1

No, I use PowerBuilder.

And I try it on PB2021 too.

With same result.

Comment
  1. Petr Czerny
  2. Friday, 3 December 2021 17:17 PM UTC
Thanks...

But I know that and I did it exactly by this.

According to the documentation, the one-dimensional array should have no restrictions.
  1. Helpful
  1. Petr Czerny
  2. Friday, 3 December 2021 17:36 PM UTC
My example is taken directly from this help.



.NET DLL Importer creates:



//*-----------------------------------------------------------------*/

//* .NET function : TestByteArray

//* Argument:

//* Blob ablo_barray

//* Return : (None)

//*-----------------------------------------------------------------*/

/* .NET function name */

String ls_function



/* Set the dotnet function name */

ls_function = "TestByteArray"



Try

/* Create .NET object */

If Not This.of_createOnDemand( ) Then

Return

End If



/* Trigger the dotnet function */

This.testbytearray(ablo_barray)

Catch(runtimeerror re_error)



If This.ib_CrashOnException Then Throw re_error



/* Handle .NET error */

This.of_SetDotNETError(ls_function, re_error.text)

This.of_SignalError( )



End Try



An error occurs when calling this function on row: This.testbytearray(ablo_barray)

  1. Helpful
  1. Armeen Mazda @Appeon
  2. Friday, 3 December 2021 20:39 PM UTC
Please open a support ticket and provide a test case so we can check if this is a bug: https://www.appeon.com/standardsupport/newbug
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Friday, 3 December 2021 16:13 PM UTC
  2. PowerBuilder
  3. # 2

Are you using PowerServer?  If yes, then upgrade to PowerServer 2021 and this will work.  PowerServer 2021 doesn't have many unsupported features anymore that old generation of PowerServer had.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.