IL2CPP Makes API Call Fail (Mono does not)

Hi,

I was about to release my facial recognition app onto the Google Play store when I discovered it needed to be a 64-bit build. Having developed my app using Mono in Unity 2019.2.11f1, I had no idea it would fail when I switched to IL2CPP.

I don’t get any errors, it just hangs at this line when running on a Samsung Galaxy:
var res = await client.PublicModels.CelebrityModel.Predict(new ClarifaiFileImage(bytes)).ExecuteAsync();

I have a Debug.Log statement before and after that line and when IL2CPP is selected, the Debug.Log never gets called after the line above.

Are there any known issues with IL2CPP that might cause issues with using ‘await’ or API calls in general?

The app works flawlessly using Mono. The only change I make is changing the dropdown to IL2CPP (so at this point I am not even selecting ARM64). It’s so frustrating when what should have been a simple change before publishing is now preventing me from getting the app onto the store.

Any suggestions, possible fixes or guidance on where to look would be appreciated before I have no hair left to pull out.

Thanks in advance!

There is a known bug using await in il2cpp. Probably related. It’s still being worked on.

1 Like

@BitGamey :

Can you drop us a bug report with a project that reproduces this issue? I’d like to compare it to the bug report we currently have which is similar. This might be a slightly different issue.

More generally, the async/await paradigm in C# generates a ton of extra code and GC allocations, so you may want to consider some other approach, if possible.

1 Like

Thank you. Is there a code-around in the meantime?

We don’t have a work around, and I’m not sure this is the same as the reported problem anyway. I think the best option is to not use async/await at all, but that may not be feasible for your project.

1 Like

Thanks @JoshPeterson and @Aurimas-Cernius , report submitted.