SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Crash on save when opening a project from cmdline

Last post 05-09-2008 3:52 PM by DanielGrunwald. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 04-29-2008 9:05 PM

    • axl
    • Not Ranked
    • Joined on 04-29-2008
    • Posts 1

    Crash on save when opening a project from cmdline

    1. From a PowerShell prompt, I opened a previously saved solution by running "C:\Program Files\SharpDevelop\3.0\bin\SharpDevelop.exe" MyProject.sln
    2. I got a message that it couldn't resolve \test\bin\debug\xunit.dll, which I ignored. (It usually shows up)
    3. I edited one of the source files and pressed ctrl+s to save it
    4. The program refused to save the file, claiming the path cannot be null or empty
    5. The exception is shown below
    6. I did the same again with the same result
    7. I then opened SD without the solution parameter and opened the solution from the recent projects list
    8. Save worked normally again

    SharpDevelop Version : 3.0.0.3043
    .NET Version         : 2.0.50727.1433
    OS Version           : Microsoft Windows NT 5.1.2600 Service Pack 2
    Current culture      : Swedish (Sweden) (sv-SE)
    Current UI language  : en-US
    Working Set Memory   : 62488kb
    GC Heap Memory       : 15496kb

    Exception thrown:
    System.ArgumentException: String cannot be of zero length.
    Parameter name: oldValue
       at System.String.Replace(String oldValue, String newValue)
       at ICSharpCode.SharpDevelop.Project.ProjectBrowserControl.FindDeepestOpenNodeForPath(String fileName)
       at ICSharpCode.SharpDevelop.Project.ProjectBrowserControl.TreeViewAfterExpand(Object sender, TreeViewEventArgs e)
       at System.Windows.Forms.TreeView.OnAfterExpand(TreeViewEventArgs e)
       at ICSharpCode.SharpDevelop.Gui.ExtTreeView.OnAfterExpand(TreeViewEventArgs e)
       at System.Windows.Forms.TreeView.TvnExpanded(NMTREEVIEW* nmtv)
       at System.Windows.Forms.TreeView.WmNotify(Message& m)
       at System.Windows.Forms.TreeView.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

  • 05-06-2008 10:20 PM In reply to

    Re: Crash on save when opening a project from cmdline

    I couldn't recreate the problem using the steps you outlined (although I don't use Powershell) - but looking at the function in question (ICSharpCode.SharpDevelop.Project.ProjectBrowserControl.FindDeepestOpenNodeForPath) I think I can see the problem... 

                        if (fileName.StartsWith(solution.Directory)) {
                            relativePath = fileName.Replace(solution.Directory, "");
                        }

    There's no test around here to check that solution.Directory is not an empty string. An empty string would get past the StartsWith test (I've checked this), and would cause the exception described in the post.

     

    Perhaps this should be:

                        if (fileName.StartsWith(solution.Directory) && (solution.Directory != "")) {
                            relativePath = fileName.Replace(solution.Directory, "");
                        }

     

    There are a couple of examples like this in that particular function.

     

    mjmilan 

  • 05-09-2008 3:52 PM In reply to

    Re: Crash on save when opening a project from cmdline

    Fixed in revision 3048. 

    Daniel Grunwald
Page 1 of 1 (3 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.