Atozed Forums

Full Version: Issue with StringArray property
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
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:

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

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


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:

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

with xType = dtNewObject {206} in ReadObject.

Is it a bug with StringArray properties?
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.
It took some time, but the sample project is here.
Can you take a look at it?
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.
We use Delphi 10.2. I didn't include .dproj file in zip, it may be the reason of message?
Possibly. I will proceed without it. I just needed to verify that you were not using an old unsupported IDE.
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
The dll just contains MyClass.cs, you can recompile it.
This one is compiled with ANY.
Thanks. My dev day is already scheduled today but I will get to this as soon as I can.
I've scheduled this into my dev day today.
Pages: 1 2 3