Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Issue with StringArray property
#1
Hello,
I have an issue reading a property declared as array of strings.


My unit (generated by CrossTalk ClassGen) contains a property AllIDs: StringArray read AllIDsRead:

Code:
function SelectionChangedEventArgs.AllIDsRead: StringArray;
begin
  with TRight.GetPropValue(Self, '', 'AllIDs') do try
    Result := NET.mscorlib.StringArray(Results.ReadObject);
  finally Free; end;
end;


When this function is called, I get an exception from:

\CrossTalk\Source\Atozed.CrossTalk.Streams.pas

function TCTStreamReader.ReadObject(aClass: TClass = nil): TObject;
 -> raise ECTException.Create('Unknown type found during unboxing.');

because xType = dtObjectList {205}

I also have a function returning an StringArray (not a property), and this one works without error:

Code:
function FAL_GAN_LINK.GetAllDataRecordsIds: StringArray;
begin
  with TRight.MethodCall(Self, '', 'GetAllDataRecordsIds', 0) do try
    Result := NET.mscorlib.StringArray(Results.ReadObject);
  finally Free; end;
end;

with xType = dtNewObject {206} in ReadObject.

Is it a bug with StringArray properties?
Reply
#2
Can you make a simple ready to run demo (console project please) and send me the DPR and CTP file? You can code it all in the DPR to avoid even needing a .pas file.
Reply
#3
Hello,
It took some time, but the sample project is here.
Can you take a look at it?
Thanks


Attached Files
.zip   TestStringArrayCrosstalk.zip (Size: 19.55 KB / Downloads: 5)
Reply
#4
What version of Delphi are you using? This project when I loaded it said it wanted to upgrade from D2007. D2007 has not been supported by CrossTalk for several years.
Reply
#5
We use Delphi 10.2. I didn't include .dproj file in zip, it may be the reason of message?
Reply
#6
Possibly. I will proceed without it. I just needed to verify that you were not using an old unsupported IDE.
Reply
#7
Is it correct that this assembly is compiled as x64 only? If so is there a reason for this? Except in rare cases, .NET assemblies should be ANY and not X64 or X86.

CrossTalk does support X64, but it takes me a lot longer to debug as I have to change the dev test environment.

I assume this is a test assembly of yours? If so, is it possible to rebuild as ANY instead of X64?

// TestStringArrayProperty, Version=1.0.6978.15731, Culture=neutral, PublicKeyToken=null

// Global type: <Module>
// Architecture: x64
// Runtime: .NET 4.0
Reply
#8
The dll just contains MyClass.cs, you can recompile it.
This one is compiled with ANY.


Attached Files
.zip   TestStringArrayProperty.zip (Size: 1.76 KB / Downloads: 4)
Reply
#9
Thanks. My dev day is already scheduled today but I will get to this as soon as I can.
Reply
#10
I've scheduled this into my dev day today.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)