I have an Xamarin App using Parallel.Invoke which is working fine on Android.
Parallel.Invoke
(
() => AddOrReplaceWordsAndDefinitions(wordsAndDefinitions, conn),
() => AddOrReplaceWords(wordsAndDefinitions, conn)
);
However I'm now trying to work on the iOS version and it crashes not because of the Parallel.Invoke but because of the lambda expression () =>
If I do a Parallel.Invoke with action as below it will work on iOS but I won't have my parameters:
Parallel.Invoke
(
Action1,
Action2
);
I've tried to use Tasks instead of parallel.invoke but since my code doesn't use async, I have to use the lambda expression () =>
at some point, here or somewhere else.
I've also tried to use delegate but it's not working either on iOS. So the only options I've found so far is to use System.Action instead of normal methods and store the parameters somewhere else to access in the actions. Or having two versions of the code, one with parallel.invoke for android and one without for iOS.
If you know a better option or if you know why lambda expression are not working on Xamarin iOS let me know.
For references I'm using:
- Xamarin form v4.4.0.991265
- Simulations of iPhone8 and iPhone11 pro