Unity Android Build in Mac: TypeLoadException: Could not load type 'UnityEditor.iOS.Xcode.PlistDocument'

1,101 views
Skip to first unread message

Richard Fu

unread,
May 29, 2017, 11:56:33 PM5/29/17
to Firebase Google Group
I have similar errors similar to this topic, few errors popup every time I put Unity into foreground or changing any file. (It is NOT happened when build.) It seems that Unity want to verify file and Firebase.Editor.XcodeProjectPatcher.ReadConfig get called, then it tries to run some code about iOS, but I actually on Android build settings so no UnityEditor.iOS.Xcode.PlistDocument class is found!

Errors:
TypeLoadException: Could not load type 'UnityEditor.iOS.Xcode.PlistDocument' from assembly 'Unity.iOS.Extensions.Xcode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Firebase.Editor.XcodeProjectPatcher.ReadConfig (Boolean errorOnNoConfig, System.String filename)
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for Firebase.Editor.XcodeProjectPatcher
System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:513)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:519)
System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:528)
System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/ConstructorInfo.cs:77)
System.Activator.CreateInstance (System.Type type, Boolean nonPublic) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Activator.cs:372)
System.Activator.CreateInstance (System.Type type) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Activator.cs:254)
UnityEditor.AssetPostprocessingInternal.GetMeshProcessorVersions () (at /Users/builduser/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:158)
UnityEditor.AssetPostprocessingInternal:GetMeshProcessorVersions()

I am in:
Unity 5.5.3p2 Android build
macOS 10.12.5

iOS Resolver setting is attached and it said Cocoapods installation detected.

Screen Shot 2017-05-30 at 11.54.45 am.png

Richard Fu

unread,
Jun 2, 2017, 4:08:46 AM6/2/17
to Firebase Google Group
The errors are gone in fresh project so spent half day debugging this by removing files one by one.

Finally found the problem is Firebase is clashing a localization Unity plugin I2 Localization, which having a modified UnityEngine.iOS.Xcode package for added localization functions

It's PlistDocument:
namespace UnityEditor.iOS_I2Loc.Xcode
{
    public class PlistDocument
    {
        public PlistDocument();



I think this causes the problem, Firebase is trying to use PlistDocument, regardless the namespace, and getting I2's PlistDocument which not matching the UnityEditor.iOS.Xcode namespace?

I will let I2's creator know but it will be great if Firebase can fix this.

Richard Fu

unread,
Jun 2, 2017, 4:09:16 AM6/2/17
to Firebase Google Group
I can confirm that iOS has the same errors too!

TypeLoadException: Could not load type 'UnityEditor.iOS.Xcode.PlistDocument' from assembly 'Unity.iOS.Extensions.Xcode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Firebase.Editor.XcodeProjectPatcher.ReadConfig (Boolean errorOnNoConfig, System.String filename)
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for Firebase.Editor.XcodeProjectPatcher
System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor (RuntimeTypeHandle type) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Runtime.CompilerServices/RuntimeHelpers.cs:101)
UnityEditor.EditorAssemblies.ProcessEditorInitializeOnLoad (System.Type type) (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorAssemblies.cs:136)

Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:262)
UnityEditor.HostView.Invoke (System.String methodName) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:255)
UnityEditor.HostView.OnFocus () (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:99)


Stewart Miles

unread,
Jun 2, 2017, 1:46:24 PM6/2/17
to Firebase Google Group
Thanks for digging into this Richard.

We're using UnityEditor.iOS.Xcode.PlistDocument throughout our code.  Unity shipped the UnityEditor Xcode extensions DLL with conflicting assembly vs. namespace names so we have a workaround in place here https://github.com/googlesamples/unity-jar-resolver/blob/master/source/IOSResolver/src/IOSResolver.cs#L295 .  After the Xcode extension is loaded we can then call methods that resolve to the UnityEditor.iOS.Xcode extension.

Are you sure that disabling / removing I2 Localization solves the problem?

Cheers,
Stewart


--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/9c0c09da-e76c-4a34-a3c6-bc3c1ad97504%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Stewart Miles

unread,
Jun 9, 2017, 7:16:36 PM6/9/17
to Firebase Google Group
Hi Richard, any update on this?

Cheers,
Stewart

Richard Fu

unread,
Jun 11, 2017, 7:48:06 PM6/11/17
to Firebase Google Group
Hi Stewart,

Thank for the reply, I asked plugin creator and he has updated his dll using another signature. The problem has been fixed.
Reply all
Reply to author
Forward
0 new messages