JetBrains / resharper-unity

Unity support for both ReSharper and Rider
Apache License 2.0
1.21k stars 134 forks source link

JetBrains.Rider.Unity.Editor.UIElementsSupport.GenerateSchema fails with TargetParameterCountException #2386

Closed mikz closed 1 year ago

mikz commented 1 year ago

This is happening for about a year. From Unity 2022.x and Rider 2022. Right now I'm on Unity 2022.2.1 and Rider 2022.3.2.

Generating schema from the yellow bar suggestion when editing UXML results in:

TargetParameterCountException: Number of parameters specified does not match the expected number.
System.Reflection.RuntimeMethodInfo.ConvertValues (System.Reflection.Binder binder, System.Object[] args, System.Reflection.ParameterInfo[] pinfo, System.Globalization.CultureInfo culture, System.Reflection.BindingFlags invokeAttr) (at <1b72fc97b7c245a483150421232eb6a9>:0)
System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <1b72fc97b7c245a483150421232eb6a9>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <1b72fc97b7c245a483150421232eb6a9>:0)
JetBrains.Rider.Unity.Editor.UIElementsSupport.GenerateSchema () (at <a26e6ba76929460aadbd68434abe4966>:0)
UnityEngine.Debug:LogException(Exception)
JetBrains.Rider.Unity.Editor.UIElementsSupport:GenerateSchema()
JetBrains.Rider.Unity.Editor.<>c:<AdviseGenerateUISchema>b__30_0(Unit)
JetBrains.Rd.Tasks.<>c__DisplayClass8_0`2:<Set>b__0(Lifetime, Unit)
JetBrains.Rd.Tasks.RdCall`2:OnWireReceived(UnsafeReader)
JetBrains.Rd.Impl.MessageBroker:Execute(IRdWireable, Byte[])
JetBrains.Rd.Impl.<>c__DisplayClass10_0:<Invoke>b__0()
JetBrains.Rider.Unity.Editor.MainThreadDispatcher:DispatchTasks()
UnityEditor.EditorApplication:Internal_CallUpdateFunctions() (at /Users/bokken/build/output/unity/unity/Editor/Mono/EditorApplication.cs:361)

Doing it from unity Assets > Update UXML schema works just fine.

https://github.com/JetBrains/resharper-unity/blob/ef0756878565ac3a87466fa9eaaac8ece683ae55/unity/EditorPlugin/UIElementsSupport.cs#L42

vs

https://github.com/Unity-Technologies/UnityCsReference/blob/f9f7224dcb49951ed9eeb3b087aecf1e39bb0b4d/ModuleOverrides/com.unity.ui/Editor/UXMLSchemaGenerator.cs#L62

van800 commented 1 year ago

image I will fix that, thanks.

van800 commented 1 year ago

Fix would appear in 2023.1 ~ EAP4.