Skip to content

Issue when writing the settings file, GvhProjectSettings.xml #359

@SimonAExient

Description

@SimonAExient

Versions:

  • Android resolver v1.2.144, as included in Firebase analytics plugin v6.13.0 (installed using the Unity package manager)
  • Using Unity 2019.3.9f1 on macOS Mojave 10.14.6
  • Targeting Android and iOS
  • Using IL2CPP

Note this bug is a duplicate of #275 However, although that issue is closed, it doesn't appear to have been resolved.
There are some related comments in #345
There are comments on the reflection in #262

I've integrated Firebase analytics in to our project and it is working.
However, whenever Perforce SC is enabled, I see the following error in the console:

Unable to checkout 'ProjectSettings/GvhProjectSettings.xml'. Project settings were not saved!
UnityEngine.Debug:LogError(Object)
Google.Logger:Log(String, LogLevel) (at Z:/tmp/tmp.Hjk5jmHbz3/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/Logger.cs:127)
Google.ProjectSettings:Save() (at Z:/tmp/tmp.Hjk5jmHbz3/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/ProjectSettings.cs:814)
Google.ProjectSettings:SetBool(String, Boolean, SettingsLocation) (at Z:/tmp/tmp.Hjk5jmHbz3/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/ProjectSettings.cs:484)
Google.ProjectSettings:SetBool(String, Boolean) (at Z:/tmp/tmp.Hjk5jmHbz3/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/ProjectSettings.cs:496)
Google.IOSResolver:set_VerboseLoggingEnabled(Boolean) (at Z:/tmp/tmp.AGik6h285B/third_party/unity/unity_jar_resolver/source/IOSResolver/src/IOSResolver.cs:895)
Google.IOSResolver:.cctor() (at Z:/tmp/tmp.AGik6h285B/third_party/unity/unity_jar_resolver/source/IOSResolver/src/IOSResolver.cs:653)
Firebase.Editor.XcodeProjectPatcher:.cctor() (at Z:/tmp/tmp.SHkOPK7iEJ/firebase/app/client/unity/editor/src/XcodeProjectPatcher.cs:74)
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes(Type[]) (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorAssemblies.cs:114)

I originally thought this was something to do with the call being made via reflection (in FileUtil.CheckoutFile() calls through to VersionHandler.InvokeMethod())

However, it seems that the following test code also fails:

Task t = UnityEditor.VersionControl.Provider.Checkout("ProjectSettings/GvhProjectSettings.xml", UnityEditor.VersionControl.CheckoutMode.Exact);
t.Wait();

..with this exception:

Exception during Checkout(): System.ArgumentNullException: Value cannot be null.
Parameter name: assets[0]
  at (wrapper managed-to-native) UnityEditor.VersionControl.Provider.Internal_Checkout(UnityEditor.VersionControl.Asset[],UnityEditor.VersionControl.CheckoutMode,UnityEditor.VersionControl.ChangeSet)
  at UnityEditor.VersionControl.Provider.CheckCallbackAndCheckout (UnityEditor.VersionControl.AssetList assets, UnityEditor.VersionControl.CheckoutMode mode, UnityEditor.VersionControl.ChangeSet changeset) [0x00095] in /Users/builduser/buildslave/unity/build/Editor/Mono/VersionControl/Common/VCProvider.cs:180 
  at UnityEditor.VersionControl.Provider.Checkout (System.String asset, UnityEditor.VersionControl.CheckoutMode mode, UnityEditor.VersionControl.ChangeSet changeset) [0x00014] in /Users/builduser/buildslave/unity/build/Editor/Mono/VersionControl/Common/VCProvider.cs:259   at UnityEditor.VersionControl.Provider.Checkout (System.String asset, UnityEditor.VersionControl.CheckoutMode mode) [0x00001] in /Users/builduser/buildslave/unity/build/Editor/Mono/VersionControl/Common/VCProvider.cs:251 
  at xxx.TestCheckout ()

I also tried taking the source of FileUtil.CheckoutFile(), VersionHandler.InvokeStaticMethod(), VersionHandler.InvokeMethod() and calling CheckoutFile with "ProjectSettings/GvhProjectSettings.xml"
That fails with a similar exception:

Failed to checkout ProjectSettings/GvhProjectSettings.xml (System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: assets[0]
  at (wrapper managed-to-native) UnityEditor.VersionControl.Provider.Internal_Checkout(UnityEditor.VersionControl.Asset[],UnityEditor.VersionControl.CheckoutMode,UnityEditor.VersionControl.ChangeSet)
  at UnityEditor.VersionControl.Provider.CheckCallbackAndCheckout (UnityEditor.VersionControl.AssetList assets, UnityEditor.VersionControl.CheckoutMode mode, UnityEditor.VersionControl.ChangeSet changeset) [0x00095] in /Users/builduser/buildslave/unity/build/Editor/Mono/VersionControl/Common/VCProvider.cs:180 
  at UnityEditor.VersionControl.Provider.Checkout (System.String asset, UnityEditor.VersionControl.CheckoutMode mode, UnityEditor.VersionControl.ChangeSet changeset) [0x00014] in /Users/builduser/buildslave/unity/build/Editor/Mono/VersionControl/Common/VCProvider.cs:259
  at UnityEditor.VersionControl.Provider.Checkout (System.String asset, UnityEditor.VersionControl.CheckoutMode mode) [0x00001] in /Users/builduser/buildslave/unity/build/Editor/Mono/VersionControl/Common/VCProvider.cs:251 
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <437ba245d8404784b9fbab9b439ac908>:0 
   --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <437ba245d8404784b9fbab9b439ac908>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <437ba245d8404784b9fbab9b439ac908>:0 
  at xxx.InvokeMethod (System.Type type, System.Object objectInstance, System.String methodName, System.Object[] args, System.Collections.Generic.Dictionary`2[TKey,TValue] namedArgs) [0x001c0] 
  at xxx.InvokeStaticMethod (System.Type type, System.String methodName, System.Object[] args, System.Collections.Generic.Dictionary`2[TKey,TValue] namedArgs) [0x00001] 
  at xxx.CheckoutFile (System.String path) [0x0002d] 

However, it appears that the following works - so perhaps it provides a possible work-around.

AssetList assets = new AssetList();
assets.Add(new Asset("ProjectSettings/GvhProjectSettings.xml"));
Task t = UnityEditor.VersionControl.Provider.Checkout(assets, UnityEditor.VersionControl.CheckoutMode.Exact);
t.Wait();

If making use of such a workaround isn't practical, would it be possible to add a setting that allows FileUtil.CheckoutFile() to proceed if the checkout fails but ProjectSettings/GvhProjectSettings.xml is writable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions