Content Manager error when searching only one character

Bug #1944070 reported by Jonas Bewig
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Open Rails
Fix Committed
Undecided
Roger Fischer

Bug Description

When I tap only one single character in the search bar of the Content Manager, I get this error message:

System.ArgumentOutOfRangeException: Die Länge darf nicht kleiner als 0 (null) sein.
Parametername: length
   bei System.String.Substring(Int32 startIndex, Int32 length)
   bei ORTS.ContentManager.ContentManagerGUI.SearchResult..ctor(Content content, String path) in C:\Jenkins\jobs\Open Rails Testing\workspace\Source\Contrib\ContentManager\ContentManagerGUI.cs:Zeile 55.
   bei ORTS.ContentManager.ContentManagerGUI.<>c__DisplayClass19_0.<searchBox_TextChanged>b__0(Object sender1, DoWorkEventArgs e1) in C:\Jenkins\jobs\Open Rails Testing\workspace\Source\Contrib\ContentManager\ContentManagerGUI.cs:Zeile 274.
   bei System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
   bei System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

************** Geladene Assemblys **************
mscorlib
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.8.4400.0 built by: NET48REL1LAST_C.
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll.
----------------------------------------
Contrib.ContentManager
    Assembly-Version: 0.0.7930.33217.
    Win32-Version: 0.0.7930.33217.
    CodeBase: file:///E:/Program%20Files/Open%20Rails/Contrib.ContentManager.exe.
----------------------------------------
System.Windows.Forms
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.8.4400.0 built by: NET48REL1LAST_C.
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll.
----------------------------------------
System
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.8.4360.0 built by: NET48REL1LAST_C.
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll.
----------------------------------------
System.Drawing
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.8.4390.0 built by: NET48REL1LAST_C.
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll.
----------------------------------------
ORTS.Settings
    Assembly-Version: 0.0.7930.33207.
    Win32-Version: 0.0.7930.33207.
    CodeBase: file:///E:/Program%20Files/Open%20Rails/ORTS.Settings.DLL.
----------------------------------------
ORTS.Common
    Assembly-Version: 0.0.7930.33205.
    Win32-Version: 0.0.7930.33205.
    CodeBase: file:///E:/Program%20Files/Open%20Rails/ORTS.Common.DLL.
----------------------------------------
System.Configuration
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.8.4190.0 built by: NET48REL1LAST_B.
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll.
----------------------------------------
System.Core
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.8.4390.0 built by: NET48REL1LAST_C.
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll.
----------------------------------------
System.Xml
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.8.4084.0 built by: NET48REL1.
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll.
----------------------------------------
Accessibility
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.8.4084.0 built by: NET48REL1.
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll.
----------------------------------------
GNU.Gettext
    Assembly-Version: 1.1.7017.24626.
    Win32-Version: 1.0.0.0.
    CodeBase: file:///E:/Program%20Files/Open%20Rails/GNU.Gettext.DLL.
----------------------------------------
MonoGame.Framework
    Assembly-Version: 3.7.1.189.
    Win32-Version: 3.7.1.189.
    CodeBase: file:///E:/Program%20Files/Open%20Rails/MonoGame.Framework.DLL.
----------------------------------------
Orts.Formats.Msts
    Assembly-Version: 0.0.7930.33206.
    Win32-Version: 0.0.7930.33206.
    CodeBase: file:///E:/Program%20Files/Open%20Rails/Orts.Formats.Msts.DLL.
----------------------------------------
Orts.Parsers.Msts
    Assembly-Version: 0.0.7930.33205.
    Win32-Version: 0.0.7930.33205.
    CodeBase: file:///E:/Program%20Files/Open%20Rails/Orts.Parsers.Msts.DLL.
----------------------------------------
Orts.Parsers.OR
    Assembly-Version: 0.0.7930.33207.
    Win32-Version: 0.0.7930.33207.
    CodeBase: file:///E:/Program%20Files/Open%20Rails/Orts.Parsers.OR.DLL.
----------------------------------------
mscorlib.resources
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.8.4084.0 built by: NET48REL1.
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/mscorlib.resources/v4.0_4.0.0.0_de_b77a5c561934e089/mscorlib.resources.dll.
----------------------------------------
System.resources
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.8.4084.0 built by: NET48REL1.
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.resources/v4.0_4.0.0.0_de_b77a5c561934e089/System.resources.dll.
----------------------------------------
System.Windows.Forms.resources
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.8.4084.0 built by: NET48REL1.
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.resources/v4.0_4.0.0.0_de_b77a5c561934e089/System.Windows.Forms.resources.dll.
----------------------------------------

Revision history for this message
Roger Fischer (rwf09) wrote (last edit ):

This bug only happens for the letters A,C,E,G,M,N,O,R,T. Those are the letters in "ContentManager", the name of the first (root) element in the content tree.

The root element does not have a directory separator (/), but the search results expect one.

I am working on a fix.

Revision history for this message
Roger Fischer (rwf09) wrote :

Pull Request for the fix: https://github.com/openrails/openrails/pull/934

Fix:
- if (content.Name.ToLowerInvariant().Contains(search))
+ // do not add root element to search results, see bug 1944070
+ if (content.Type != ContentType.Root && content.Name.ToLowerInvariant().Contains(search))
                         finds.Add(new SearchResult(content, path));

Changed in or:
status: New → In Progress
assignee: nobody → Roger Fischer (rwf09)
Revision history for this message
Roger Fischer (rwf09) wrote :

Fix merged into master, Apr 25.

Changed in or:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.