Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ForEach not working for objects? #176

Open
thetoolwiz opened this issue Dec 28, 2021 · 0 comments
Open

ForEach not working for objects? #176

thetoolwiz opened this issue Dec 28, 2021 · 0 comments

Comments

@thetoolwiz
Copy link

thetoolwiz commented Dec 28, 2021

I have a TListView and I'm doing this to iterate over the Items in it:

  FWorker := Parallel.ForEach<TListItem>( lview1.Items );

  FWorker.Execute(
            procedure( const task: IOmniTask; const aLI : TListItem )
            begin
            . . . . 

I get this error:

First chance exception at $75CBB5B2. Exception class Exception with message 'TValue of type tkClass cannot be converted to TOmniValue'. Process ThreadingTest2VCL.exe (8516)

in procedure OtlCommon.TOmniValue.SetAsTValue(const value: TValue);

If I change it to a pointer, that fails as well, I'm guessing because the iterator returns an object.

Is this a bug, or "as designed"?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant