vrchat-community / creator-companion

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

[BUG] Non-present User Packages cause error in Package Resolver in Unity #10

Open Nidonocu opened 1 year ago

Nidonocu commented 1 year ago

Describe the bug If loading a project without the CC and just using the Resolver in Unity and a User Package that is not present on the target (customer) machine is present within the project, the Resolver Window will fail to load and every start-up will warn of missing packages.

To Reproduce Steps to reproduce the behavior:

  1. On the 'creator' machine, create or install a User Package in to the CC.
  2. Create any kind of project and add the User Package to the project.
  3. Commit the project to a git repo, follow correct process so only the Resolver package is in the repo, not the User Package or other VRC packages.
  4. On the 'customer' machine, make sure the User Package is not present in the CC if it is installed.
  5. Download the project files from the git repo, use Unity Hub rather than the CC to Add the project and open it.
  6. During Project startup, the warning will appear about missing packages. Click OK to install the various VRC Packages.
  7. Go to the VRChat SDK Menu > Utilities > Package Resolver.
  8. Check the console.
  9. Close and reopen the project to see the startup warning.

Expected behavior On start-up and only once, the resolver warns it couldn't install missing User Packages and displays the resolver window to list them. When accessing the resolver window, it displays missing User Package names and an alert that it can't find these automatically.

Console Error

ArgumentException: Default Index  is beyond the scope of possible value
UnityEditor.UIElements.PopupField`1[T]..ctor (System.String label, System.Collections.Generic.List`1[T] choices, System.Int32 defaultIndex, System.Func`2[T,TResult] formatSelectedValueCallback, System.Func`2[T,TResult] formatListItemCallback) (at <a259d3c004024353a2c217da97495055>:0)
UnityEditor.UIElements.PopupField`1[T]..ctor (System.Collections.Generic.List`1[T] choices, System.Int32 defaultIndex, System.Func`2[T,TResult] formatSelectedValueCallback, System.Func`2[T,TResult] formatListItemCallback) (at <a259d3c004024353a2c217da97495055>:0)
VRC.PackageManagement.Resolver.ResolverWindow.CreateDependencyRow (System.String id, System.String version, VRC.PackageManagement.Core.Types.UnityProject project, System.Boolean havePackage) (at Packages/com.vrchat.core.vpm-resolver/Editor/Resolver/ResolverWindow.cs:180)
VRC.PackageManagement.Resolver.ResolverWindow.Refresh () (at Packages/com.vrchat.core.vpm-resolver/Editor/Resolver/ResolverWindow.cs:72)
VRC.PackageManagement.Resolver.ResolverWindow.CreateGUI () (at Packages/com.vrchat.core.vpm-resolver/Editor/Resolver/ResolverWindow.cs:135)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at <a259d3c004024353a2c217da97495055>:0)
UnityEditor.HostView.Invoke (System.String methodName) (at <a259d3c004024353a2c217da97495055>:0)
UnityEditor.HostView.SendCreateGUIIfNecessary () (at <a259d3c004024353a2c217da97495055>:0)
UnityEditor.EditorApplication.Internal_CallDelayFunctions () (at <a259d3c004024353a2c217da97495055>:0)

Desktop (please complete the following information):

rhaamo commented 1 year ago

just hit that bug and it's super annoying when you only have the unity package resolver and not the full VCC client available (linux) :/

rhaamo commented 1 year ago

FWIW, the issue triggers when a package has been installed from an "user repository" but said repository isn't listed anymore in the VCC (like opening project on another machine where the repo hasn't been added). The resolver fetch the versions and puts them in a list, and a popup is then opened with first element selected, but the list is empty so index 0 doesn't exists. Fixing that with a if and popup shouldn't be that hard...

BocuD commented 1 year ago

This seems to still not have been fixed and is becoming quite a problem for us. Fixing the issue would be a single line code change, is there any reason this hasn't been looked at yet? Any user using community packages working on a project with more than one person will run into problems right now unless they include all packages in version control, eg git.

KitKat4191 commented 8 months ago

This is still an issue.