vrchat-community / creator-companion

The Entry Point for Making Things in VRChat
https://vrchat.com/home/download
53 stars 356 forks source link

[BUG] vpm cannot install packages depends on same package three times or more with dependencies #29

Open anatawa12 opened 1 year ago

anatawa12 commented 1 year ago

Original title: [BUG] vpm-resolver cannot upgrade packages depends on both SDK Base and VRCSDK Avatars due to 3.1.x

Describe the bug vpm-resolver cannot upgrade packages depends on both SDK Base and VRCSDK Avatars with the following exception.

PS: Not only the update, downgrate and resolve will also not working.

ArgumentException: Invalid version string: 3.1.x
SemanticVersioning.Version..ctor (System.String input, System.Boolean loose) (at <538c6085386f4b4d990c9eb6c0e6e03d>:0)
SemanticVersioning.Version.Parse (System.String input, System.Boolean loose) (at <538c6085386f4b4d990c9eb6c0e6e03d>:0)
VRC.PackageManagement.Core.Repos.GetAllDependencies (VRC.PackageManagement.Core.Types.Packages.IVRCPackage package, System.Collections.Generic.Dictionary`2[System.String,System.String]& dependencies, System.Collections.Generic.Dictionary`2[TKey,TValue] existingDependencyList, System.Collections.Generic.IEnumerable`1[T] providers) (at <8a4f24c081a2471480786374f86e90a0>:0)
VRC.PackageManagement.Core.Repos.GetAllDependencies (VRC.PackageManagement.Core.Types.Packages.IVRCPackage package, System.Collections.Generic.Dictionary`2[System.String,System.String]& dependencies, System.Collections.Generic.Dictionary`2[TKey,TValue] existingDependencyList, System.Collections.Generic.IEnumerable`1[T] providers) (at <8a4f24c081a2471480786374f86e90a0>:0)
VRC.PackageManagement.Resolver.Resolver.GetAffectedPackageList (VRC.PackageManagement.Core.Types.Packages.IVRCPackage package) (at Packages/com.vrchat.core.vpm-resolver/Editor/Resolver/Resolver.cs:168)
VRC.PackageManagement.Resolver.ResolverWindow+<>c__DisplayClass12_0.<CreateDependencyRow>b__0 () (at Packages/com.vrchat.core.vpm-resolver/Editor/Resolver/ResolverWindow.cs:204)
UnityEngine.UIElements.Clickable.Invoke (UnityEngine.UIElements.EventBase evt) (at /Users/bokken/buildslave/unity/build/Modules/UIElements/Clickable.cs:81)
UnityEngine.UIElements.Clickable.OnMouseUp (UnityEngine.UIElements.MouseUpEvent evt) (at /Users/bokken/buildslave/unity/build/Modules/UIElements/Clickable.cs:158)
UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt) (at /Users/bokken/buildslave/unity/build/Modules/UIElements/Events/EventCallback.cs:64)
UnityEngine.UIElements.EventCallbackRegistry.InvokeCallbacks (UnityEngine.UIElements.EventBase evt) (at /Users/bokken/buildslave/unity/build/Modules/UIElements/Events/EventCallbackRegistry.cs:332)
UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at /Users/bokken/buildslave/unity/build/Modules/UIElements/Events/EventHandler.cs:95)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at /Users/bokken/buildslave/unity/build/Modules/UIElements/Events/EventHandler.cs:77)
UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /Users/bokken/buildslave/unity/build/Modules/UIElements/Events/MouseCaptureDispatchingStrategy.cs:92)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at /Users/bokken/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:310)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /Users/bokken/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:275)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at /Users/bokken/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:238)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at /Users/bokken/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:203)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at /Users/bokken/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:44)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /Users/bokken/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:301)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at /Users/bokken/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:159)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at /Users/bokken/buildslave/unity/build/Modules/UIElements/Panel.cs:257)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at /Users/bokken/buildslave/unity/build/Modules/UIElements/UIElementsUtility.bindings.cs:404)
UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at /Users/bokken/buildslave/unity/build/Modules/UIElements/UIElementsUtility.bindings.cs:194)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:197)

To Reproduce Steps to reproduce the behavior:

UPDATE: This steps no longer works to reproduce. see this comment for new steps

  1. Create Avatars Project.
  2. Add https://vpm.nadena.dev/vpm.json as vpm repository.
  3. Add nadena.dev.modular-avatar version 1.0.0 to the project (via VCC).
  4. Open Package Resolver in the project.
  5. Click Update to upgrade nadena.dev.modular-avatar to 1.1.1
  6. Exception happens

Expected behavior nadena.dev.modular-avatar upgraded to 1.1.1

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information): First Environment

Second Environment

Additional context It looks this happens if the package depends on both VRCSDK base and Avatars/Worlds because upgrading packages depends only on VRCSDK Worlds (such as UdonSharp) does not cause this problem.

anatawa12 commented 1 year ago

It looks this has been fixed.

anatawa12 commented 10 months ago

@Faxmashine

Sorry I found this issue can be reproduced in latest VCC.

Add https://vpm.narazaka.net/ to repos and try to add net.narazaka.vrchat.avatar-parameters-saver to project in VCC or VPM CLI, Invalid version string: >=3.2.0 error occurs

PS > vpm add package 'net.narazaka.vrchat.avatar-parameters-saver'
[14:26:09 INF] Adding net.narazaka.vrchat.avatar-parameters-saver to D:\UnityProjects\New TEst Projexct
[14:26:09 INF] Dependency list upgrading com.vrchat.avatars from >=3.2.0 to >=3.2.0
Unhandled exception: System.ArgumentException: Invalid version string: >=3.2.0
   at SemanticVersioning.Version..ctor(String input, Boolean loose)
   at VRC.PackageManagement.Core.Repos.GetAllDependencies(IVRCPackage package, Dictionary`2& dependencies, Dictionary`2 existingDependencyList, IEnumerable`1 providers) in /home/runner/work/vrc-package-manager/vrc-package-manager/core/vpm-core-lib/Repos.cs:line 509
   at VRC.PackageManagement.Core.Repos.GetAllDependencies(IVRCPackage package, Dictionary`2& dependencies, Dictionary`2 existingDependencyList, IEnumerable`1 providers) in /home/runner/work/vrc-package-manager/vrc-package-manager/core/vpm-core-lib/Repos.cs:line 556
   at VRC.PackageManagement.Core.Types.Packages.VRCPackageManifest.ContainsWorldDependencies() in /home/runner/work/vrc-package-manager/vrc-package-manager/core/vpm-core-lib/Types/PackageTypes/VRCPackageManifest.cs:line 151
   at VRC.PackageManagement.Core.Types.Packages.VRCPackageManifest.CanBeAddedTo(UnityProject project) in /home/runner/work/vrc-package-manager/vrc-package-manager/core/vpm-core-lib/Types/PackageTypes/VRCPackageManifest.cs:line 138
   at VRC.PackageManagement.Core.Types.UnityProject.AddVPMPackage(IVRCPackage iPackage, IEnumerable`1 providers) in /home/runner/work/vrc-package-manager/vrc-package-manager/core/vpm-core-lib/Types/UnityProject.cs:line 793
   at VRC.PackageManagement.CLI.Program.AddPackage(String packageName, String project) in /home/runner/work/vrc-package-manager/vrc-package-manager/core/vpm-cli/Packages.cs:line 93
   at VRC.PackageManagement.CLI.Program.<>c.<CreateAddCommands>b__13_0(String packageName, String project) in /home/runner/work/vrc-package-manager/vrc-package-manager/core/vpm-cli/Program.cs:line 289
   at System.CommandLine.Handler.<>c__DisplayClass3_0`2.<SetHandler>b__0(InvocationContext context)
   at System.CommandLine.Invocation.AnonymousCommandHandler.Invoke(InvocationContext context)
   at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()
anatawa12 commented 10 months ago

net.narazaka.vrchat.avatar-parameters-saver workarounded this issue by removing com.vrchat.avatars from direct dependencies (which is horribly bad for package management, see below) so the command above is no longer work as way to reproduce this problem.

So, I made set of packages to reproduce this problem: https://anatawa12.github.io/vpm-repo-for-vcc-bug-testing/

I made the following packages.

In my environment, when I'm installing the following packages, Unhandled exception: System.ArgumentException: Invalid version string: exception occurs

In my environment, when I'm installing the following packages, Unhandled exception: System.ArgumentException: Invalid version string: exception does not occurs

So, I think this issue will happens if there are same package as dependency three or more times for now.

PS > vpm add package 'version-resolve.depends-on-two-packages-and-avatars-at-end'
[00:46:06 INF] Adding version-resolve.depends-on-two-packages-and-avatars-at-end to D:\UnityProjects\New TEst Projexct
[00:46:06 INF] Dependency list upgrading com.vrchat.avatars from >= 3.2.0 < 4.0.0 to >= 3.2.0 < 4.0.0
Unhandled exception: System.ArgumentException: Invalid version string: >= 3.2.0 < 4.0.0
   at SemanticVersioning.Version..ctor(String input, Boolean loose)
   at VRC.PackageManagement.Core.Repos.GetAllDependencies(IVRCPackage package, Dictionary`2& dependencies, Dictionary`2 existingDependencyList, IEnumerable`1 providers) in /home/runner/work/vrc-package-manager/vrc-package-manager/core/vpm-core-lib/Repos.cs:line 509
   at VRC.PackageManagement.Core.Types.Packages.VRCPackageManifest.ContainsWorldDependencies() in /home/runner/work/vrc-package-manager/vrc-package-manager/core/vpm-core-lib/Types/PackageTypes/VRCPackageManifest.cs:line 151
   at VRC.PackageManagement.Core.Types.Packages.VRCPackageManifest.CanBeAddedTo(UnityProject project) in /home/runner/work/vrc-package-manager/vrc-package-manager/core/vpm-core-lib/Types/PackageTypes/VRCPackageManifest.cs:line 138
   at VRC.PackageManagement.Core.Types.UnityProject.AddVPMPackage(IVRCPackage iPackage, IEnumerable`1 providers) in /home/runner/work/vrc-package-manager/vrc-package-manager/core/vpm-core-lib/Types/UnityProject.cs:line 793
   at VRC.PackageManagement.CLI.Program.AddPackage(String packageName, String project) in /home/runner/work/vrc-package-manager/vrc-package-manager/core/vpm-cli/Packages.cs:line 93
   at VRC.PackageManagement.CLI.Program.<>c.<CreateAddCommands>b__13_0(String packageName, String project) in /home/runner/work/vrc-package-manager/vrc-package-manager/core/vpm-cli/Program.cs:line 289
   at System.CommandLine.Handler.<>c__DisplayClass3_0`2.<SetHandler>b__0(InvocationContext context)
   at System.CommandLine.Invocation.AnonymousCommandHandler.Invoke(InvocationContext context)
   at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()

Why I think removing com.vrchat.avatars from direct dependencies is horribly bad for package management manifest.

It removes ability to restrict com.vrchat.avatars version which can cause (compilation) error in the future.

Versions of non-direct dependencies can be changed in the future as non-breaking changes so depending on non-direct dependencies can cause compatibility issue in the future.

Sayamame-beans commented 2 weeks ago

Are there any update for this?