unity-jar-resolver icon indicating copy to clipboard operation
unity-jar-resolver copied to clipboard

[Bug] GvhProjectSettings.xml changes/resets itself

Open ManuelRauber opened this issue 3 years ago • 110 comments

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2021.3.4f1
  • External Dependency Manager version: 1.2.171
  • Source you installed EDM4U: .unitypackage
  • Features in External Dependency Manager in use: Android Resolver
  • Platform you are using the Unity editor on: Mac

[REQUIRED] Please describe the issue here:

Sometimes, not really reproducible, the file GvhProjectSettings.xml changes/resets itself. This is super annoying, because the file pops up in the git stage:

image

As well as this dialogs pops up all the time

image

And as you can see from the diff file above, the settings get reset, e.g. I've disabled both auto-resolution on build and in editor and it will reset back to true, because that's the default.

I currently can not reproduce it exactly, when it happens. Sometimes it does not happen all day, sometimes it happens multiple times day.

ManuelRauber avatar Jun 12 '22 08:06 ManuelRauber

This issue does not seem to follow the issue template. Make sure you provide all the required information.

google-oss-bot avatar Jun 12 '22 08:06 google-oss-bot

Hi @ManuelRauber,

Could you provide the steps you've performed before facing this issue so that we can identify what's causing this behavior?

paulinon avatar Jun 14 '22 19:06 paulinon

I have the same issue. I've just installed External Dependency Manager with one of SDKs and these things start to happen. Looks like it happens after recompilation but not after each one. Also sometimes after exiting playmode.

Unity editor version: 2021.3.3f1 External Dependency Manager version: 1.2.169 Source you installed EDM4U: .unitypackage Features in External Dependency Manager in use: Android Resolver Platform you are using the Unity editor on: Mac

faveris avatar Jun 18 '22 14:06 faveris

We are facing same issue on Unity: 2021.3.4f1 Editor: Mac (Silicon)

ghost avatar Jun 20 '22 06:06 ghost

Hi @ManuelRauber,

Could you provide the steps you've performed before facing this issue so that we can identify what's causing this behavior?

Unfortunately, I can not answer this, because I simply use the Unity Editor. Sometimes I just open it and then I see a change in git and the file has been written as shown in the first post.

Sometimes that does not happen, I have no clear way to reproduce this behavior.

Currently, I'm carefully looking whenever this change happens, but I've not found a clear way yet.

ManuelRauber avatar Jun 20 '22 06:06 ManuelRauber

Having the exact same issue. Reset happens every few minutes. Makes it very, very difficult to not accidentally commit the changed file (which breaks the build).

Unity: 2021.3.4f1 Editor: Mac (Silicon) External Dependency Manager version: 1.2.170 Source you installed EDM4U: .unitypackage Features in External Dependency Manager in use: iOS Resolver Platform you are using the Unity editor on: Mac

belike81 avatar Jun 21 '22 11:06 belike81

Hi folks,

Does disabling auto-resolution prevent this issue from happening? The Android Resolver automatically keeps track of the differentdependencies you have specified in your Unity project. The resolution process runs when the specified dependencies are not present in your project.

paulinon avatar Jun 21 '22 15:06 paulinon

Does disabling auto-resolution prevent this issue from happening?

For me issue is happening with auto-resolution turned off

faveris avatar Jun 21 '22 18:06 faveris

Does disabling auto-resolution prevent this issue from happening?

Same as above - it's turned off, but the issue is still occurring. Judging by all the reports seems to be mac specific.

belike81 avatar Jun 22 '22 07:06 belike81

Hey @ManuelRauber. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot avatar Jun 29 '22 01:06 google-oss-bot

Hey @ManuelRauber. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

Well, Google Bot, we can not add more information, because we don't have more information.

I still have no way that I do to reproduce it.

It just popped up after updating a Unity Package via Package Manager. To test, I reverted the changes in git and updated the unity package again. This time, the GvhProjectSettings.xml did not change. No clue, sorry.

I'd love to help to investigate the issue, but since I can not cleary reproduce it, it's hard to track.

ManuelRauber avatar Jun 29 '22 19:06 ManuelRauber

Thanks for the update, folks. I'll bring this up with the team so that we can analyze this behavior. In the meantime, could you try our latest version of the resolver (1.2.172) to make sure the issue persists?

paulinon avatar Jun 30 '22 17:06 paulinon

Hey @ManuelRauber. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot avatar Jul 07 '22 01:07 google-oss-bot

Since there haven't been any recent updates here, I am going to close this issue.

@ManuelRauber if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

google-oss-bot avatar Jul 14 '22 01:07 google-oss-bot

Hey, this is still present in EDM4U v1.2.172. GvhProjectSettings file is getting reset from time to time like @ManuelRauber described.

OS: Mac M1 (Silicon) Unity Editor: 2021.3.4f1 EDM4U: 1.2.172 (installed via Package Manager)

marek-jelo-jelinek avatar Jul 18 '22 12:07 marek-jelo-jelinek

Thanks for the update, folks. I'll bring this up with the team so that we can analyze this behavior. In the meantime, could you try our latest version of the resolver (1.2.172) to make sure the issue persists?

Any news? Also, could you reopen the issue? It's still present. :) @paulinon

ManuelRauber avatar Jul 18 '22 13:07 ManuelRauber

Since there haven't been any recent updates here, I am going to close this issue.

@ManuelRauber if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

google-oss-bot avatar Jul 20 '22 01:07 google-oss-bot

Since there haven't been any recent updates here, I am going to close this issue.

@ManuelRauber if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

I just did exactly that...

ManuelRauber avatar Jul 20 '22 04:07 ManuelRauber

I also have this issue on macos. I managed to work around this issue by setting the file non-writeable, but now I get three exceptions on every recompile as the plugin is trying to write to the file. To me it seems odd that anything is trying to write to the file on recompile, so these exceptions should proably not be occurring? Maybe one of these stack traces can help you figure out why the file is being reset occasionally?

Unable to write to 'ProjectSettings/GvhProjectSettings.xml' (System.UnauthorizedAccessException: Access to the path "/x/ProjectSettings/GvhProjectSettings.xml" is denied. at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0 at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options) [0x00000] in <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0 at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean useAsync) [0x00000] in <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0 at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,bool) at System.Xml.XmlWriterSettings.CreateWriter (System.String outputFileName) [0x00051] in <38dbe8c56cdd4466b240eacd29d4a366>:0 at System.Xml.XmlWriter.Create (System.String outputFileName, System.Xml.XmlWriterSettings settings) [0x0000a] in <38dbe8c56cdd4466b240eacd29d4a366>:0 at Google.ProjectSettings.Save () [0x000a1] in Z:\tmp\tmp.CJxVZ8zZsI\third_party\unity\unity_jar_resolver\source\VersionHandlerImpl\src\ProjectSettings.cs:828 , Project settings were not saved! UnityEngine.Debug:LogError (object) Google.Logger:Log (string,Google.LogLevel) (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/Logger.cs:136) Google.ProjectSettings:Save () (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/ProjectSettings.cs:844) Google.ProjectSettings:SetBool (string,bool,Google.SettingsLocation) (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/ProjectSettings.cs:485) Google.ProjectSettings:SetBool (string,bool) (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/ProjectSettings.cs:497) Google.IOSResolver:set_VerboseLoggingEnabled (bool) (at Z:/tmp/tmp.cmxLSGC2UL/third_party/unity/unity_jar_resolver/source/IOSResolver/src/IOSResolver.cs:998) Google.IOSResolver:.cctor () (at Z:/tmp/tmp.cmxLSGC2UL/third_party/unity/unity_jar_resolver/source/IOSResolver/src/IOSResolver.cs:692) UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes (System.Type[]) (at /Users/bokken/buildslave/unity/build/Editor/Mono/EditorAssemblies.cs:126)

Unable to write to 'ProjectSettings/GvhProjectSettings.xml' (System.UnauthorizedAccessException: Access to the path "/x/ProjectSettings/GvhProjectSettings.xml" is denied. at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0 at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options) [0x00000] in <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0 at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean useAsync) [0x00000] in <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0 at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,bool) at System.Xml.XmlWriterSettings.CreateWriter (System.String outputFileName) [0x00051] in <38dbe8c56cdd4466b240eacd29d4a366>:0 at System.Xml.XmlWriter.Create (System.String outputFileName, System.Xml.XmlWriterSettings settings) [0x0000a] in <38dbe8c56cdd4466b240eacd29d4a366>:0 at Google.ProjectSettings.Save () [0x000a1] in Z:\tmp\tmp.CJxVZ8zZsI\third_party\unity\unity_jar_resolver\source\VersionHandlerImpl\src\ProjectSettings.cs:828 , Project settings were not saved! UnityEngine.Debug:LogError (object) Google.Logger:Log (string,Google.LogLevel) (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/Logger.cs:136) Google.ProjectSettings:Save () (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/ProjectSettings.cs:844) Google.ProjectSettings:SetBool (string,bool,Google.SettingsLocation) (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/ProjectSettings.cs:485) Google.ProjectSettings:SetBool (string,bool) (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/ProjectSettings.cs:497) Google.VersionHandlerImpl:set_VerboseLoggingEnabled (bool) (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/VersionHandlerImpl.cs:2514) Google.VersionHandlerImpl:LoadLogPreferences () (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/VersionHandlerImpl.cs:2293) Google.VersionHandlerImpl:<VersionHandlerImpl>m__0 () (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/VersionHandlerImpl.cs:2304) Google.RunOnMainThread:ExecuteNext () (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:486) Google.RunOnMainThread:<ExecuteAllUnnested>m__1 () (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:536) Google.RunOnMainThread:RunAction (System.Action) (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:343) Google.RunOnMainThread:ExecuteAllUnnested (bool) (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:530) Google.RunOnMainThread:ExecuteAll () (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:512) UnityEditor.EditorApplication:Internal_CallUpdateFunctions () (at /Users/bokken/buildslave/unity/build/Editor/Mono/EditorApplication.cs:356)

Unable to write to 'ProjectSettings/GvhProjectSettings.xml' (System.UnauthorizedAccessException: Access to the path "/x/ProjectSettings/GvhProjectSettings.xml" is denied. at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0 at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options) [0x00000] in <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0 at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean useAsync) [0x00000] in <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0 at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,bool) at System.Xml.XmlWriterSettings.CreateWriter (System.String outputFileName) [0x00051] in <38dbe8c56cdd4466b240eacd29d4a366>:0 at System.Xml.XmlWriter.Create (System.String outputFileName, System.Xml.XmlWriterSettings settings) [0x0000a] in <38dbe8c56cdd4466b240eacd29d4a366>:0 at Google.ProjectSettings.Save () [0x000a1] in Z:\tmp\tmp.CJxVZ8zZsI\third_party\unity\unity_jar_resolver\source\VersionHandlerImpl\src\ProjectSettings.cs:828 , Project settings were not saved! UnityEngine.Debug:LogError (object) Google.Logger:Log (string,Google.LogLevel) (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/Logger.cs:136) Google.ProjectSettings:Save () (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/ProjectSettings.cs:844) Google.ProjectSettings:SetBool (string,bool,Google.SettingsLocation) (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/ProjectSettings.cs:485) Google.ProjectSettings:SetBool (string,bool) (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/ProjectSettings.cs:497) Google.PackageManagerResolver:set_VerboseLoggingEnabled (bool) (at Z:/tmp/tmp.NQek55Y74t/third_party/unity/unity_jar_resolver/source/PackageManagerResolver/src/PackageManagerResolver.cs:647) Google.PackageManagerResolver:<PackageManagerResolver>m__0 () (at Z:/tmp/tmp.NQek55Y74t/third_party/unity/unity_jar_resolver/source/PackageManagerResolver/src/PackageManagerResolver.cs:97) Google.RunOnMainThread:ExecuteNext () (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:486) Google.RunOnMainThread:<ExecuteAllUnnested>m__1 () (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:536) Google.RunOnMainThread:RunAction (System.Action) (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:343) Google.RunOnMainThread:ExecuteAllUnnested (bool) (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:530) Google.RunOnMainThread:ExecuteAll () (at Z:/tmp/tmp.CJxVZ8zZsI/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:512) UnityEditor.EditorApplication:Internal_CallUpdateFunctions () (at /Users/bokken/buildslave/unity/build/Editor/Mono/EditorApplication.cs:356)

tikotus avatar Jul 20 '22 12:07 tikotus

Also experiencing this issue on multiple macs, all apple silicon.

uniquecorn avatar Jul 27 '22 09:07 uniquecorn

Thanks to @tikotus call stack we now can find part of the problem:

    /// <summary>
    /// Initialize the module.
    /// </summary>
    static IOSResolver() {
        // Load log preferences.
        VerboseLoggingEnabled = VerboseLoggingEnabled;

It's a convoluted way to set the logging level from the stored value from static constructor. The setter for VerboseLoggingEnabled however changes the settings as well as changing the log level. So that causes settings file to be overwritten.

Would be nice for Google to clean up their mess by setting the logging level explicitly, not as a side effect of the property setter.

viktorcode avatar Jul 27 '22 10:07 viktorcode

Thanks to @tikotus call stack we now can find part of the problem:

    /// <summary>
    /// Initialize the module.
    /// </summary>
    static IOSResolver() {
        // Load log preferences.
        VerboseLoggingEnabled = VerboseLoggingEnabled;

It's a convoluted way to set the logging level from the stored value from static constructor. The setter for VerboseLoggingEnabled however changes the settings as well as changing the log level. So that causes settings file to be overwritten.

Would be nice for Google to clean up their mess by setting the logging level explicitly, not as a side effect of the property setter. Screenshot 2022-08-01 at 4 58 46 PM

Happens for other resolvers as well.

uniquecorn avatar Aug 01 '22 08:08 uniquecorn

Just to keep this thread alive. Still happening all the time... get your things together Google or/and Unity

firstIssue avatar Sep 27 '22 14:09 firstIssue

bumping again

uniquecorn avatar Oct 27 '22 14:10 uniquecorn

This is happening all the time to my team and me. It seems to randomly change the values in that file while developing

JonLandmark avatar Oct 31 '22 15:10 JonLandmark

Screenshot 2022-11-28 at 5 34 39 PM Screenshot 2022-11-28 at 5 40 31 PM

The GvhProjectSettings.xml file is initialized whenever the source code is modified. with annoying pop-ups

ikitae avatar Nov 28 '22 08:11 ikitae

So I was creating a script that resets the resolve before building. Tested it only a little, but this might give some help to some people here. You basically need a template XML, you gonna use with the settings you like.

So set your settings as you like in the resolver settings, then copy that XML as template and use this script:

` public class PreprocessBuild : IPreprocessBuildWithReport { public int callbackOrder { get { return 0; } } public static ProcessStartInfo processStartInfo = new ProcessStartInfo();

public void OnPreprocessBuild(BuildReport report)
{
    switch (report.summary.platform)
    {
        case BuildTarget.Android:
            ProcessAndroid("../");
            break;
    }
}

protected static void ProcessAndroid(string pathToProject)
{
    //Reset the project settings first for the resolver
    string template = "../YourProject/Assets/Scripts/Build/Editor/GvhProjectSettingsTemplate.xml";
    string file = "../YourProject/ProjectSettings/GvhProjectSettings.xml";
    string templateContent = File.ReadAllText(template);

    File.WriteAllText(file, templateContent);

    UnityEngine.Debug.Log("<color=#00ff00>Preprocess Android Resolver on path: " + file + "</color>");

    //Now get all plugins that may have be made and remove them
    string androidPluginPath = Path.Combine(Application.dataPath, "Plugins/Android");

    UnityEngine.Debug.Log("<color=#00ff00>Delete plugins from " + androidPluginPath + "</color>");

    List<string> aarFiles = System.IO.Directory.GetFiles(androidPluginPath, "*.aar", SearchOption.AllDirectories).ToList();
    List<string> jarFiles = System.IO.Directory.GetFiles(androidPluginPath, "*.jar", SearchOption.AllDirectories).ToList();
    int filesTotal = aarFiles.Count + jarFiles.Count;

    UnityEngine.Debug.Log("<color=#00ff00>Deleted " + filesTotal.ToString() + " plugins.</color>");

    foreach (string filepath in aarFiles)
        System.IO.File.Delete(filepath);

    foreach (string filepath in jarFiles)
        System.IO.File.Delete(filepath);
}

}`

firstIssue avatar Nov 28 '22 08:11 firstIssue

Haha, I make GvhProjectSettings.xml readonly. shot It wont change now!!! regardless red error text in console, everything else stay normal. Shuang!

CodeMasterYi avatar Jan 13 '23 05:01 CodeMasterYi

after android force resolve it show resolution success and print this error image

Why write this file.=.= why write error content into it!

CodeMasterYi avatar Jan 13 '23 05:01 CodeMasterYi

ATTENTION: I intend to modify the permission of GvhProjectSettings.xml 'cause I dont want it changed any more! @paulinon

CodeMasterYi avatar Jan 13 '23 05:01 CodeMasterYi