xsharp.eu • Runtime Error converting Array to FoxArray
Page 1 of 1

Runtime Error converting Array to FoxArray

Posted: Thu Jun 16, 2022 7:07 pm
by Alf
Hi to all,
today I moved to 2.12.2.0. After compiling one of my appls, I get this runtime error:
System.InvalidCastException: Das Objekt des Typs "XSharp.__Array" kann nicht in Typ "XSharp.__FoxArray" umgewandelt werden.
bei UV_classes_109.Functions.TEST(__Usual[] Xs$Args) in C:X_ALFUV_classes_109Datadict.prg:Zeile 965.


To reproduce this error, here a very simple test function:

Code: Select all

FUNCTION TEST() AS VOID
	
	LOCAL a AS ARRAY
	LOCAL n1, n2 AS DWORD
	
	a := { { "Alf", 1000 }, { "Bill", 2000 }, { "Dick", 3000 } }
	n1 := ALen( a )
// Next line causes my runtime error
	n2 := ALen( a[1] )	

RETURN
Obviously, the error is in context with a two dimension array....

Sorry for my stupidity, if this problem - and the solution - should be well known. :)

Regards
Alf

Runtime Error converting Array to FoxArray

Posted: Fri Jun 17, 2022 6:45 am
by Chris
Hi Alf,

You must be using the VFP (FoxPro) dialect in your project and/or have a reference to XSharp.VFP in it.
Is that intentional, or by accident?

.

Runtime Error converting Array to FoxArray

Posted: Fri Jun 17, 2022 11:42 am
by Alf
Hi Chris,
thanks. My problem is solved. Background information: I never used FoxPro dialect, only VO dialect. A reference to XSharp.VFP has been set (I don't know anymore why I did this - may be 20 years ago). Now I deleted this reference and now it works.
Alf