Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

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

Reply
 
Old 06-05-2008   #1 (permalink)
Stefan Pascal


 
 

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
Old 06-05-2008   #2 (permalink)
Stefan Pascal


 
 

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:
Quote:

> 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
Reply

Thread Tools


Similar Threads
Thread Forum
Path too long Vista file management
Path too long exception .NET General
Destination Path To Long Vista music pictures video


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46