Nullref while Deserializing enum on IOS phone

Issue #537 invalid
Pascal Sanel created an issue

Hello and thanks for you help,

1. What happened?

We are encountring in our project on IOS devices multiple “MissingMethodException“ on various custom types that lead to 2 nullref and the application stop working.

After investigations we found that the nullrefs are caused by deserializing a dictionary using an enum as key.

We created a basic project using a custom enum and a dictionary<myEnum, string>(), and the nullrefs are here.

2. How can we reproduce it?

You can find in attachment the test code that we used with the logs produced from xCode.

4. What version of Unity are you using?

We are using Unity 2018.10.f1.

5. What version of Odin are you using? (See "Tools > Odin Inspector > About")

Our current project is using Odin 2.0.15 and the test project 2.0.20.

6. Do you have Editor Only mode enabled?

No we don’t.

7. What operating system are you on?

The issue only appeared when the project run on an IOS phone 12.2 built from a Mac 10.14.4 and xCode 10.2.1.

Comments (16)

  1. Tor Esa Vestergaard

    Please read the exception that Odin has thrown (seen in Test-Logs.txt, lines 12-29) - it contains detailed instructions for what the issue is and how to fix it. In short, you need to generate AOT support before Odin will work in an AOT build.

  2. Pascal Sanel reporter

    Sorry I should have mention it before but those logs are with the “Automate Before Builds“ option checked in.

  3. Tor Esa Vestergaard

    Hm. Try generating the AOT support dll and then attach the dll file to the issue. I’ll have a look at it.

  4. Pascal Sanel reporter

    We checked the generation of the AOT dll by unchecking “Delete DLL After Builds“ and they are created at build time.

    An other weird thing is that the “Scan Project” in the “AOT COmpilation“ tab does not seems to found any supported serialized types on Mac.

  5. Tor Esa Vestergaard

    If you try running the scan while targeting another AOT platform such as WebGL or Windows IL2CPP, does the scan then find the types?

  6. Tor Esa Vestergaard

    ( I can confirm that there is no support for any types in the assembly; it is completely empty )

  7. Tor Esa Vestergaard

    Hmm, that is curious. Can you send me a zip of the entire test project at tor@sirenix.net?

  8. Tor Esa Vestergaard

    I’m afraid the error fails to reproduce - the moment I add the scene containing the data to the build settings (indicating the data will be part of the build), the scan picks up the data instantly: http://prntscr.com/nrvfxu

    To clarify, the scan only picks up data that it can tell will become part of the build. The scan looks at:

    • All scenes that are in the build settings
    • All assets in Resources
    • All asset bundles
    • All preloaded assets from the player settings
    • All asset dependencies of all of the above, and any dependencies of those dependenices, recursively, etc

    I’m curious as to how the scan missed your data - how did you get it into the build if it wasn’t in or referenced by a build-included scene, Resources, in an asset bundle or the list of preloaded assets?

  9. Pascal Sanel reporter

    We managed to make the test project work by simply adding the scene to the build settings.

    But we have this setting on our current project and the issue is still here.

    We tried to add the IL2CCP Mac support but no change.

  10. Tor Esa Vestergaard

    In that case, there is some difference in how you’re storing the data that breaks your build, between the test project and your main project. Your data is not reachable from a build scene, resource, asset bundle or preloaded asset, so the scan cannot find it. Try updating Odin to 2.0.20 in your main project, and if that still doesn’t work, then you’ll have to try and figure out why the scan isn’t reaching your data. If you can’t figure it out, you can always manually add the needed types to the support list.

  11. Pascal Sanel reporter

    We updated to 2.0.20 and the types appears in the list but still the same issue.

    We are still looking into it.

  12. Christophe Mézerette

    Hi, I work with Pascal. I figured out our main issue. We use the Unity Package Manager with our project. We’ve created a local package with Odin 2.0.20 and we use this package in our main project. The package is just a unity project with odin inside and a package.json in the folder assets. With this way, it doesn’t work (however, the scan works) but if I import directly odin in our main project, it works. I don’t know if it’s possible to use odin inside a package ?

  13. Log in to comment