Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Reflection causing errors since version 2018.3.7f1

Discussion in 'Scripting' started by Numa, Mar 9, 2019.

  1. Numa

    Numa

    Joined:
    Oct 7, 2014
    Posts:
    100
    Hi there,

    in .7f and now .8f, a ReflectionTypeLoadException is thrown by every call to GetTypes().
    this is the error:

    Could not set up field 'u' due to: Missing field layout info for hInproc assembly:/Applications/Unity/Hub/Editor/2018.3.8f1/Unity.app/Contents/MonoBleedingEdge/lib/mono/unityjit/Accessibility.dll type:__MIDL_IWinTypes_0009 member:(null) signature:<none>

    at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes(System.Reflection.Assembly,bool)
    at System.Reflection.Assembly.GetTypes () [0x00000] in <d7ac571ca2d04b2f981d0d886fa067cf>:0


    I could get around it by specifying which types to look at and avoiding that one, but some 3rd party libraries I can't access use reflection too and are throwing this error.

    Thanks
     
    mirasrael likes this.
  2. mirasrael

    mirasrael

    Joined:
    Jul 9, 2018
    Posts:
    4
    Also have same problem
     
    redwyre likes this.
  3. Binary42

    Binary42

    Joined:
    Aug 15, 2013
    Posts:
    207
    dito

    not nice but a workaround:
    Code (CSharp):
    1. try {
    2.     // try get types
    3. } catch(ReflectionTypeLoadException ex) {
    4.     types = ex.Types.Where(t => t != null);
    5. }
     
    Last edited: Mar 19, 2019
  4. mrzappit

    mrzappit

    Joined:
    Jan 10, 2019
    Posts:
    5
    I'm seeing the same problem in 2018.3.10f1.
    For me, it's always caused by the Accessibility assembly.

    @dito, Thanks for the suggestion. That hack at least got me past the problem and doesn't seem to have any noticeable negative side effects.
     
  5. Numa

    Numa

    Joined:
    Oct 7, 2014
    Posts:
    100
    That doesn't work for me as the call happens in a 3rd party library so I can't get around it. Do you have a simple project reproducing the issue? I've tried making sample projects but can't get the error to show up hehe
     
    Last edited: Apr 1, 2019
  6. Numa

    Numa

    Joined:
    Oct 7, 2014
    Posts:
    100
    It's fixed in 2018.3.12f1

    Thanks everyone
     
    jdcampbe likes this.