JetBrains / resharper-unity

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

Rider Unity Editor Crash #2421

Closed DevLaTron closed 9 months ago

DevLaTron commented 9 months ago

On Unity 2022.3.10f1 LTS with the rider plugin 3.0.25 I get the following crash, seemingly because in

Rider/Editor/RiderScriptEditor.cs at 356 the editor tries to get installation paths and is assuming one or a default is returned, but for some reason multiple are returned.

This is running on Xubuntu 23.04, and I'm assuming somehow the snap update of rider caused this. The error prevents the External Tools page in the Preferences from loading, so this gets me stuck.

Trace:

InvalidOperationException: Sequence contains more than one matching element System.Linq.Enumerable.SingleOrDefault[TSource] (System.Collections.Generic.IEnumerable1[T] source, System.Func2[T,TResult] predicate) (at <22d097c9c77e4fb3988dec23d55249ed>:0) Packages.Rider.Editor.RiderScriptEditor.TryGetInstallationForPath (System.String editorPath, Unity.CodeEditor.CodeEditor+Installation& installation) (at ./Library/PackageCache/com.unity.ide.rider@3.0.25/Rider/Editor/RiderScriptEditor.cs:356) Unity.CodeEditor.CodeEditor.GetInstallationForPath (System.String editorPath) (at /home/bokken/build/output/unity/unity/Editor/Mono/CodeEditor/CodeEditor.cs:117) UnityEditor.PreferencesProvider.ReadPreferences () (at /home/bokken/build/output/unity/unity/Editor/Mono/PreferencesWindow/PreferencesSettingsProviders.cs:1148) UnityEditor.PreferencesProvider.OnActivate (System.String searchContext, UnityEngine.UIElements.VisualElement rootElement) (at /home/bokken/build/output/unity/unity/Editor/Mono/PreferencesWindow/PreferencesSettingsProviders.cs:250) UnityEditor.SettingsWindow.ProviderChanged (UnityEditor.SettingsProvider lastSelectedProvider, UnityEditor.SettingsProvider newlySelectedProvider) (at /home/bokken/build/output/unity/unity/Editor/Mono/Settings/SettingsWindow.cs:257) UnityEditor.SettingsTreeView.SelectionChanged (System.Collections.Generic.IList1[T] selectedIds) (at /home/bokken/build/output/unity/unity/Editor/Mono/Settings/SettingsTreeView.cs:66) UnityEditor.IMGUI.Controls.TreeViewController.NotifyListenersThatSelectionChanged () (at /home/bokken/build/output/unity/unity/Editor/Mono/GUI/TreeView/TreeViewController.cs:529) UnityEditor.IMGUI.Controls.TreeViewController.NewSelectionFromUserInteraction (System.Collections.Generic.List1[T] newSelection, System.Int32 itemID) (at /home/bokken/build/output/unity/unity/Editor/Mono/GUI/TreeView/TreeViewController.cs:1306) UnityEditor.IMGUI.Controls.TreeViewController.SelectionClick (UnityEditor.IMGUI.Controls.TreeViewItem itemClicked, System.Boolean keepMultiSelection) (at /home/bokken/build/output/unity/unity/Editor/Mono/GUI/TreeView/TreeViewController.cs:1295) UnityEditor.IMGUI.Controls.TreeViewController.HandleUnusedMouseEventsForItem (UnityEngine.Rect rect, UnityEditor.IMGUI.Controls.TreeViewItem item, System.Int32 row) (at /home/bokken/build/output/unity/unity/Editor/Mono/GUI/TreeView/TreeViewController.cs:435) UnityEditor.IMGUI.Controls.TreeViewController.DoItemGUI (UnityEditor.IMGUI.Controls.TreeViewItem item, System.Int32 row, System.Single rowWidth, System.Boolean hasFocus) (at /home/bokken/build/output/unity/unity/Editor/Mono/GUI/TreeView/TreeViewController.cs:594) UnityEditor.IMGUI.Controls.TreeViewController.IterateVisibleItems (System.Int32 firstRow, System.Int32 numVisibleRows, System.Single rowWidth, System.Boolean hasFocus) (at /home/bokken/build/output/unity/unity/Editor/Mono/GUI/TreeView/TreeViewController.cs:837) UnityEditor.IMGUI.Controls.TreeViewController.OnGUI (UnityEngine.Rect rect, System.Int32 keyboardControlID) (at /home/bokken/build/output/unity/unity/Editor/Mono/GUI/TreeView/TreeViewController.cs:727) UnityEditor.IMGUI.Controls.TreeView.OnGUI (UnityEngine.Rect rect) (at /home/bokken/build/output/unity/unity/Editor/Mono/GUI/TreeView/TreeViewControl/TreeViewControl.cs:448) UnityEditor.SettingsWindow.DrawTreeView () (at /home/bokken/build/output/unity/unity/Editor/Mono/Settings/SettingsWindow.cs:472) UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:376) UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:676) UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:648) UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:641) UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:601) UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:590) UnityEngine.UIElements.IMGUIContainer.ProcessEvent (UnityEngine.UIElements.EventBase evt) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:514) UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/Events/EventHandler.cs:267) UnityEngine.UIElements.CallbackEventHandler.HandleEventAtCurrentTargetAndPhase (UnityEngine.UIElements.EventBase evt) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/Events/EventHandler.cs:189) UnityEngine.UIElements.CallbackEventHandler.UnityEngine.UIElements.IEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/Events/EventHandler.cs:206) UnityEngine.UIElements.EventDispatchUtilities.HandleEventAcrossPropagationPath (UnityEngine.UIElements.EventBase evt) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/Events/IEventDispatchingStrategy.cs:143) UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/Events/IEventDispatchingStrategy.cs:90) UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToRegularTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/Events/MouseEventDispatchingStrategy.cs:36) UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/Events/MouseEventDispatchingStrategy.cs:26) UnityEngine.UIElements.MouseEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel iPanel) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/Events/MouseEventDispatchingStrategy.cs:19) UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/EventDispatcher.cs:422) UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/EventDispatcher.cs:363) UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/EventDispatcher.cs:321) UnityEngine.UIElements.EventDispatcher.OpenGate () (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/EventDispatcher.cs:285) UnityEngine.UIElements.EventDispatcherGate.Dispose () (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/EventDispatcher.cs:77) UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/EventDispatcher.cs:413) UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/EventDispatcher.cs:229) UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/Panel.cs:457) UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/UIElementsUtility.cs:477) UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/UIElementsUtility.cs:205) UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/UIElementsUtility.cs:74) UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at /home/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/UIElementsUtility.cs:28) UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at /home/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:190)

van800 commented 9 months ago

Just to unblock you for the time-being, you may change the package version back to 3.0.24 in the manifest.json.

van800 commented 9 months ago

Please try the update with the fix

To try the unreleased version, you would need to update manifest.json, substitute "com.unity.ide.rider": "3.0.25", with

"com.unity.ide.rider": "https://github.com/van800/com.unity.ide.rider.git?path=/Packages/com.unity.ide.rider#3.0.26",