Windows Vista Forums

Running C# (.NET Framework 2.0) Application from long path (>127)crashes!
  1. #1


    Stefan Pascal Guest

    Running C# (.NET Framework 2.0) Application from long path (>127)crashes!

    Hello.

    I have a very strange problem on my system with running C#
    applications from a longer than usual (>127 chars) path. I was able to
    reproduce the following 2 cases:
    1. Socket s = new Socket(AddressFamily.InterNetwork,
    SocketType.Stream, ProtocolType.Tcp); // <-- crashes here #1

    2. SqlConnection con = new SqlConnection("Persist Security
    Info=False;server=MyServer\\MyInstance;database=MyDataBase;Connect
    Timeout=30;Trusted_Connection=True;");
    con.Open(); // <-- crashes here #2

    #1 crash shows the message: "WSAStartup cannot function at this time
    because the underlying system it uses to provide network services is
    currently unavailable."
    #2 crash shows the message: "An error has occurred while establishing
    a connection to the server. When connecting to SQL Server 2005, this
    failure may be caused by the fact that under the default settings SQL
    Server does not allow remote connections. (provider: SQL Network
    Interfaces, error: 26 - Error Locating Server/Instance Specified)"



    My workstation settings:
    Operating System: Windows XP SP2
    Programming Environment: Microsoft Visual Studio 2005 Team Edition for
    Software Developers (8.0.50727.42 RTM.050727-4200)
    ..NET Framework: .NET Framework 1.1, .NET Framework 2.0 Service Pack 1

    If i run *any C# application* from a path that exeeds 127 characters
    (including the file name) - it crashes. For example: C:\Documents and
    Settings\user123.xCOMPANY\Local Settings\Apps\2.0\HMTCX95T.RXV
    \9CKLQ85R.AXB
    \appl..tion_6e98555c88572fe0_0001.0002_47eaa25a8a47e226\TestSPExecTestSPExecTestSPExecTestSPExec.exe
    If i change the file name and/or the path to make it less or equal to
    127 characters, everything works fine! For example: C:\Documents and
    Settings\user123.xCOMPANY\Local Settings\Apps\2.0\HMTCX95T.RXV
    \9CKLQ85R.AXB\TestSPExecTestSPExecTestSPExec.exe

    Does anyone have any clue about what the problem might be? I wouldn't
    like to reinstall my workstation since i have a lot of SDKs installed
    and configured, and it would take a lot of time to reconfigure
    everything from scratch.

    Thank you!

      My System SpecsSystem Spec

  2. #2


    Stefan Pascal Guest

    Re: Running C# (.NET Framework 2.0) Application from long path (>127)crashes!

    On Jun 5, 5:31*pm, Stefan Pascal <stefan.pas...@xxxxxx> wrote:

    > Hello.
    >
    > I have a very strange problem on my system with running C#
    > applications from a longer than usual (>127 chars) path. I was able to
    > reproduce the following 2 cases:
    > 1. Socket s = new Socket(AddressFamily.InterNetwork,
    > SocketType.Stream, ProtocolType.Tcp); // <-- crashes here #1
    >
    > 2. SqlConnection con = new SqlConnection("Persist Security
    > Info=False;server=MyServer\\MyInstance;database=MyDataBase;Connect
    > Timeout=30;Trusted_Connection=True;");
    > con.Open(); // <-- crashes here #2
    >
    > #1 crash shows the message: "WSAStartup cannot function at this time
    > because the underlying system it uses to provide network services is
    > currently unavailable."
    > #2 crash shows the message: "An error has occurred while establishing
    > a connection to the server. *When connecting to SQL Server 2005, this
    > failure may be caused by the fact that under the default settings SQL
    > Server does not allow remote connections. (provider: SQL Network
    > Interfaces, error: 26 - Error Locating Server/Instance Specified)"
    >
    > My workstation settings:
    > Operating System: Windows XP SP2
    > Programming Environment: Microsoft Visual Studio 2005 Team Edition for
    > Software Developers (8.0.50727.42 RTM.050727-4200)
    > .NET Framework: .NET Framework 1.1, .NET Framework 2.0 Service Pack 1
    >
    > If i run *any C# application* from a path that exeeds 127 characters
    > (including the file name) - it crashes. For example: C:\Documents and
    > Settings\user123.xCOMPANY\Local Settings\Apps\2.0\HMTCX95T.RXV
    > \9CKLQ85R.AXB
    > \appl..tion_6e98555c88572fe0_0001.0002_47eaa25a8a47e226\TestSPExecTestSPExe*cTestSPExecTestSPExec.exe
    > If i change the file name and/or the path to make it less or equal to
    > 127 characters, everything works fine! For example: C:\Documents and
    > Settings\user123.xCOMPANY\Local Settings\Apps\2.0\HMTCX95T.RXV
    > \9CKLQ85R.AXB\TestSPExecTestSPExecTestSPExec.exe
    >
    > Does anyone have any clue about what the problem might be? I wouldn't
    > like to reinstall my workstation since i have a lot of SDKs installed
    > and configured, and it would take a lot of time to reconfigure
    > everything from scratch.
    >
    > Thank you!
    I forgot to mention that for the second case (SQLConnection exception)
    the connection string is perfectly ok. As i said, the same EXE moved
    (copied) to another (shorter) directory (path) or renamed in the same
    directory runs without any problem! So it is a problem related to the
    executable full path lenght.

    Any ideas? Thank you.

      My System SpecsSystem Spec

Running C# (.NET Framework 2.0) Application from long path (>127)crashes! problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Path too long Thomas Vista file management 5 17 Jan 2009
Path too long Fabrice Live Folder Share 1 06 May 2008
Finding files with long path lengths vts Live Folder Share 2 02 May 2008
Path too long exception Peter .NET General 4 15 Mar 2008
Destination Path To Long Garrick Vista music pictures video 4 27 Jun 2007