microsoft / winget-create

The Windows Package Manager Manifest Creator command-line tool (aka wingetcreate)
MIT License
489 stars 84 forks source link

Program Crash while adding a Dependency #386

Closed erikiorai closed 1 year ago

erikiorai commented 1 year ago

Brief description of your issue

when trying to create a new manifest and then add a dependency an error shows up

 ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.ArgumentException: Object of type 'System.Linq.Enumerable+SelectListIterator`2[System.String,System.String]' cannot be converted to type 'System.Collections.Generic.List`1[System.String]'.
   at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)
   at System.Reflection.MethodBase.CheckArguments(StackAllocedArguments& stackArgs, ReadOnlySpan`1 parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
   at System.Reflection.RuntimeMethodInfo.InvokeOneParameter(Object obj, BindingFlags invokeAttr, Binder binder, Object parameter, CultureInfo culture)
   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)
   at Microsoft.WingetCreateCLI.PromptHelper.PromptList[T](String message, Object model, String memberName, IEnumerable`1 instance, Int32 minimum, Object validationModel, String validationName)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Microsoft.WingetCreateCLI.PromptHelper.PromptPropertyAndSetValue[T](Object model, String memberName, T instance, Int32 minimum, Object validationModel, String validationName)
   at Microsoft.WingetCreateCLI.PromptHelper.PromptPropertiesWithMenu[T](T model, String exitMenuWord, String modelName)
   at Microsoft.WingetCreateCLI.PromptHelper.PromptSubfieldProperties[T](T field, PropertyInfo property, Object model)
   at Microsoft.WingetCreateCLI.PromptHelper.PromptValue[T](String message, Object model, String memberName, T instance)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Microsoft.WingetCreateCLI.PromptHelper.PromptPropertyAndSetValue[T](Object model, String memberName, T instance, Int32 minimum, Object validationModel, String validationName)
   at Microsoft.WingetCreateCLI.PromptHelper.PromptPropertiesWithMenu[T](T model, String exitMenuWord, String modelName)
   at Microsoft.WingetCreateCLI.PromptHelper.DisplayInstallersAsMenuSelection(InstallerManifest installerManifest)
   at Microsoft.WingetCreateCLI.Commands.NewCommand.PromptPropertiesAndDisplayManifests(Manifests manifests)
   at Microsoft.WingetCreateCLI.Commands.NewCommand.Execute()
   at Microsoft.WingetCreateCLI.Program.Main(String[] args)```

### Steps to reproduce

In "Would you like to modify the optional default locale fields?" press Y and then go to dependency add a windows feature type NetFx3

### Expected behavior

The manifest file should be created

### Actual behavior

Program Crashes

### Environment

```shell
Windows Package Manager Manifest Creator v1.2.6.0
ryfu-msft commented 1 year ago

Fixed by #390