Ambiguous Match found

Hi, so I’m trying to integrate Firebase into Unity. The official SDK doesn’t work with cloud build. So I’ve resorted to using these libraries:

https://github.com/step-up-labs/firebase-authentication-dotnet

I’m targeting IOS.
Using Unity 2017.1b6

Now the above libraries don’t work directly in 2017.1, I think because of some .NetStandard thing. Anyway… I cloned the repos, dumped the code in Unity, removed unnecessary classes etc.

My test runs fun in the Editor. I can download my DB, all good. However, cloud build complains:

1890: [Unity] AmbiguousMatchException: Ambiguous match found.
1891: [Unity]   at UnityEditor.CloudBuild.UnityReflector.TryLoadMethodInfo (System.Reflection.Assembly assembly, System.String fullName, System.Reflection.BindingFlags flags, System.Reflection.MethodInfo& methodInfo, System.Type[] types) [0x0003d] in <2c89a24bfae14f1f8eba59b377c83874>:0
1892: [Unity]   at UnityEditor.CloudBuild.UnityReflector..cctor () [0x00185] in <2c89a24bfae14f1f8eba59b377c83874>:0
1893: [Unity] Rethrow as TypeInitializationException: The type initializer for 'UnityEditor.CloudBuild.UnityReflector' threw an exception.
1894: [Unity]   at UnityEditor.CloudBuild.Builder.DisableAutoLightbake () [0x00053] in <2c89a24bfae14f1f8eba59b377c83874>:0
1895: [Unity]   at UnityEditor.CloudBuild.Builder.Build () [0x00005] in <2c89a24bfae14f1f8eba59b377c83874>:0
1896: [Unity] executeMethod method UnityEditor.CloudBuild.Builder.Build threw exception.
1897: [Unity] Aborting batchmode due to failure:
1898: [Unity] executeMethod method UnityEditor.CloudBuild.Builder.Build threw exception.
1899:  ! Unity player export failed!

I’m not sure why the exception is happening at “DisableAutoLightbake”, but I’m assuming that’s where it’s coming from. Could there be some kindof conflict here? Because I’m dealing with 3rd party libraries, I can’t exactly nail down where an Ambiguous method might exist.

Even without adding any scenes to the build, I still get the errors. And I have all “Auto Bake Lights” off, even all light settings off

Any ideas what might cause this? Or how I can track down an offending method, if any?

I think I’ve aged 20 years in the last week trying to integrate Firebase into Unity for iOS. It is the single most painful experience as I developer I’ve ever had. Maybe if UCB had cocoapods it would be fine. But it doesn’t and probably never will :frowning:

Appreciate any help I can get.
Thanks.

This is what pain looks like:


20 days ago my life was great. Since then, a deep decline.
With a client build approaching, kinda getting a bit worried.

Sorry, just need to rant a bit.

Are you including anything related to cloud build in your project? for example - some DLL related to cloud build ?

The only dll’s that exist in the project are:

Newtonsoft.Json and System.Net.Http (grabbed from the mono directory in Unity)
Project compiles fine locally.

OK now that i read the error message again:
executeMethod method UnityEditor.CloudBuild.Builder.Build threw exception

Do you have 2 (or more) methods with the same name? which method is marked as pre-execute or post-execute step?
From the stack trace it looks like they’re using reflection to find that method and invoke it, but fail due to ambiguous match (more than one candidate method to run)

I don’t have any PostProcess script or any pre-execute or post-execute methods.
There are indeed overloaded methods in the 3rd party library. Guess I’m gonna have to go through class by class, removing, committing, building until I find what class and what method is causing this.

But I think there’s something else going on here. I’ve built plenty of projects on Cloud Build that contain overloaded methods.

If I had to guess, I think it’s the System.Net.Http.dll or Newtonsoft.Json. There really isn’t much to this test project, the C# is perfectly valid.

Maybe it’s a 2017 beta thing?

I’m seeing this warning too:

[Unity] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

Ok, something is terribly wrong with Cloud build.

I have deleted every file (except my test script) from the project. Set library cache to none. Yet the same warnings occur above.

I’m going to try creating a new repo and new cloud build project tomorrow. Maybe cloud build is holding on to some cached thing.

Or the more likely reason: .Net 4.6 or Unity 2017.1 is currently not supported on Cloud build.

Maybe they’re aware of it. @dannyd is this a known issue at the moment ?

Which version of Xcode are you using?

  • Sophia

Receiving the same problem with Cloud build…
Local Mac Build Output: Local Mac Build - Pastebin.com
Cloud Mac Build Output: Cloud Mac Build - Pastebin.com

The cloud build compile is not getting to the xcode step. It’s an issue with Unity, and I believe .Net 4.6

To answer your question though, I’m targeting the latest supported version, which I think is 8.3.

Sorry for slow followup - ya .NET 4.6 in Unity 2017.1 is not currently supported in UCB. We’re working on addressing that.

:smile:

Selecting .NET 4.6 in in Unity 2017.1 should now be working in UCB (and you should no longer see those “AmbiguousMatchException” errors).