473,327 Members | 2,094 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

System.IO.DirectoryNotFoundException

I don't know where the "%" sysmbols are coming from, but without them this
is a valid directory. I've pasted both the exception and code that
triggeered it below. The purpose of this code block is to gather a list of
dll's.

Thanks - BH
Here is the Code
/-------------------------------/
private static string[] GetAssemblyPaths() {
var uri = new Uri(Assembly.GetExecutingAssembly().CodeBase);
var directory = uri.IsAbsoluteUri ?
Path.GetDirectoryName(uri.AbsolutePath) : Directory.GetCurrentDirectory();
return Directory.GetFiles(directory, "*.DLL",
SearchOption.AllDirectories);
}

Here is the Exception
/-------------------------------/
System.IO.DirectoryNotFoundException was unhandled
Message="Could not find a part of the path
'C:\\Documents%20and%20Settings\\Eric\\My%20Docume nts\\Visual%20Studio%202008\\Projects\\Learning\\A ctiveRecord\\src\\ActiveRecord.WinTest\\bin\\Debug '."
Source="mscorlib"
StackTrace:
at System.IO.__Error.WinIOError(Int32 errorCode, String
maybeFullPath)
at System.IO.Directory.InternalGetFileDirectoryNames( String path,
String userPathOriginal, String searchPattern, Boolean includeFiles, Boolean
includeDirs, SearchOption searchOption)
at System.IO.Directory.GetFiles(String path, String searchPattern,
SearchOption searchOption)
InnerException:
Sep 26 '08 #1
1 5293
On Sep 26, 7:59*am, "Berryl Hesh" <efing...@yahoo.comwrote:
I don't know where the "%" sysmbols are coming from, but without them this
is a valid directory. I've pasted both the exception and code that
triggeered it below. The purpose of this code block is to gather a list of
dll's.

Thanks - BH

Here is the Code
/-------------------------------/
* * private static string[] GetAssemblyPaths() {
* * * * var uri = new Uri(Assembly.GetExecutingAssembly().CodeBase);
* * * * var directory = uri.IsAbsoluteUri ?
Path.GetDirectoryName(uri.AbsolutePath) : Directory.GetCurrentDirectory();
* * * * return Directory.GetFiles(directory, "*.DLL",
SearchOption.AllDirectories);
* * }

Here is the Exception
/-------------------------------/
System.IO.DirectoryNotFoundException was unhandled
* Message="Could not find a part of the path
'C:\\Documents%20and%20Settings\\Eric\\My%20Docume nts\\Visual%20Studio%2020*08\\Projects\\Learning\\ ActiveRecord\\src\\ActiveRecord.WinTest\\bin\\Debu g*'."
* Source="mscorlib"
* StackTrace:
* * * *at System.IO.__Error.WinIOError(Int32 errorCode, String
maybeFullPath)
* * * *at System.IO.Directory.InternalGetFileDirectoryNames( String path,
String userPathOriginal, String searchPattern, Boolean includeFiles, Boolean
includeDirs, SearchOption searchOption)
* * * *at System.IO.Directory.GetFiles(String path, String searchPattern,
SearchOption searchOption)
* InnerException:
Berryl,

The %20 is just the hex code for a space character.

I wonder if you'd get the same error if you replaced your "directory"
variable in your GetFiles method call with the hard coded value (watch
out for wrap):
@"C:\Documents and Settings\Eric\My Documents\Visual Studio
2008\Projects\Learning\ActiveRecord\src\ActiveReco rd.WinTest\bin
\Debug"

-Jay
Sep 26 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Matthias Ludwig | last post by:
I'm trying to create a directory on the web server with a vb.net code: .... Dim dirName As String = "w:\filepath\images" If Not Directory.Exists(dirName) Then...
4
by: Frederico Caldeira Knabben | last post by:
Hello, I'm having a problem when trying to use the Directory.CreateDirectory() method. It throws a DirectoryNotFoundException exception. I'll try to illustrate it: Suppose you have the...
7
by: Eran Kampf | last post by:
I am trying to dynamically create directories in my ASP.NET application (I am using Server.MapPath("/")+"test" as the folder) and I am getting a DirectoryNotFoundException saying "Could not find a...
1
by: Alex | last post by:
Hello, in my company, we have a diagnostic tool for hardware. Depending on the hardware projcet, a different project configuration is needed. The configuration file is written in XML and...
5
by: Andy Lim | last post by:
Hello all, I just moved one of my ASP.NET application to a new hosting. But the same application that used to work perfectly before now returns this error: System.IO.DirectoryNotFoundException...
4
by: Jacques Wentworth | last post by:
I'm trying to access a Folder on a different Server using ASP.NET, and are getting a DirectoryNotFoundException. It works fine when I access the local drives on the server. I made sure the folder...
1
by: Bruce W. Darby | last post by:
My application, prior to building it into an .exe, was working as it should. As soon as I performed the build and attempted to run the application outside the IDE, I got an error message stating...
0
by: Dan Christensen | last post by:
Hi, I've been using MSBee to build a small program for some time now (since not everyone seems to have the 2.0 CLI installed yet). Recently I decided to add some buttons that used images, so I...
6
by: Zytan | last post by:
I got a System.IO.IOException in my app on another computer, so I couldn't debug it. I don't think it was a HD error. What else could throw this? Could it be from reading a webpage from the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.