473,320 Members | 1,910 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,320 software developers and data experts.

I don't understand this error Visual Studio gave me?

110 100+
As some of you may have seen (since I have had to practically live on Bytes.com for help) I am working on a program that reads a given .txt or .csv creating an object of an array (lines[]) per line of text. The program then creates a file and/or folders based off the text lines in the file.

I am running tests on text files to make sure I've killed what bugs I can and I got an error I don't understand.

The text file contained this data:
Expand|Select|Wrap|Line Numbers
  1. first line is safe
  2. 2nd line has ** illegal char
  3. third line is safe
  4.  
What should happen is the file should be read thru and put into the array using this code:
Expand|Select|Wrap|Line Numbers
  1. string[] lines = null; //create lines array
  2.  
  3.             using (StreamReader sr = new StreamReader(@newobject.csvDirectory))
  4.             {
  5.                 string fileContents = sr.ReadToEnd();
  6.                 lines = fileContents.Split(new string[] { ",", Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
  7.             }
  8.  
Then it will test those lines of data from the text file to check for illegal characters:

Expand|Select|Wrap|Line Numbers
  1. char[] illegal = { '/', '*', '\\', '|', 
  2.                            ':', '\"', '?', '<', '>' };
  3.  
  4. bool linesAreClean = true;
  5.  
  6.             for (int i = 0; i < lines.Length; i++)
  7.             {
  8.                 if (lines[i].IndexOfAny(illegal) != -1)
  9.                 {
  10.                     linesAreClean = false;
  11.                     System.IO.Directory.Delete(@newobject.newDirectory);
  12.                     break;
  13.                 }
  14.             }
  15.  
Then later it will check if the bool value "linesAreClean" is true or false. If it is "false" it returns an error I wrote. But if linesAreClean is "true" it should create the files. Yet when the text file has been cleaned (the 2 asterisks are replaced with dashes) it instead causes visual studio to give me this error:

Expand|Select|Wrap|Line Numbers
  1. Could not find a part of the path 'C:\Users\Dahlia\Desktop\Tester\test 15\first line is safe.txt'
  2.  
  3.  
  4.  
  5.  
  6.  
  7. See the end of this message for details on invoking 
  8. just-in-time (JIT) debugging instead of this dialog box.
  9.  
  10. ************** Exception Text **************
  11. System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\Dahlia\Desktop\TESTER\test 15\first line is safe.txt'.
  12.    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
  13.    at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
  14.    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
  15.    at WindowsFormsApplication1.Form1.Runbtn_Click(Object sender, EventArgs e) in C:\Users\Dahlia\Desktop\CSV program\Form1.cs:line 151
  16.    at System.Windows.Forms.Control.OnClick(EventArgs e)
  17.    at System.Windows.Forms.Button.OnClick(EventArgs e)
  18.    at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
  19.    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
  20.    at System.Windows.Forms.Control.WndProc(Message& m)
  21.    at System.Windows.Forms.ButtonBase.WndProc(Message& m)
  22.    at System.Windows.Forms.Button.WndProc(Message& m)
  23.    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
  24.    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
  25.    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  26.  
  27.  
  28. ************** Loaded Assemblies **************
  29. mscorlib
  30.     Assembly Version: 4.0.0.0
  31.     Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
  32.     CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
  33. ----------------------------------------
  34. WindowsFormsApplication1
  35.     Assembly Version: 1.0.0.0
  36.     Win32 Version: 1.0.0.0
  37.     CodeBase: file:///C:/Users/Dahlia/Desktop/CSV%20program/WindowsFormsApplication1/WindowsFormsApplication1/bin/Release/WindowsFormsApplication1.exe
  38. ----------------------------------------
  39. System.Windows.Forms
  40.     Assembly Version: 4.0.0.0
  41.     Win32 Version: 4.0.30319.1 built by: RTMRel
  42.     CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
  43. ----------------------------------------
  44. System.Drawing
  45.     Assembly Version: 4.0.0.0
  46.     Win32 Version: 4.0.30319.1 built by: RTMRel
  47.     CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
  48. ----------------------------------------
  49. System
  50.     Assembly Version: 4.0.0.0
  51.     Win32 Version: 4.0.30319.1 built by: RTMRel
  52.     CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
  53. ----------------------------------------
  54. System.Xml
  55.     Assembly Version: 4.0.0.0
  56.     Win32 Version: 4.0.30319.1 built by: RTMRel
  57.     CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
  58. ----------------------------------------
  59.  
  60. ************** JIT Debugging **************
  61. To enable just-in-time (JIT) debugging, the .config file for this
  62. application or computer (machine.config) must have the
  63. jitDebugging value set in the system.windows.forms section.
  64. The application must also be compiled with debugging
  65. enabled.
  66.  
  67. For example:
  68.  
  69. <configuration>
  70.     <system.windows.forms jitDebugging="true" />
  71. </configuration>
  72.  
  73. When JIT debugging is enabled, any unhandled exception
  74. will be sent to the JIT debugger registered on the computer
  75. rather than be handled by this dialog box.
  76.  
  77.  
  78.  
What the heck does it mean??

Thanks for the help.
Aug 2 '10 #1
2 1310
Fuzz13
110 100+
Additionally, the code is able to use that same file to create folders based off the text file, but not .txt files. Hope that helps.
Aug 2 '10 #2
Fuzz13
110 100+
I found this link that address the issue in older builds of VS but I'm not sure how to apply it to VS C# express 2010.

http://support.microsoft.com/kb/827421
Aug 2 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: m miller | last post by:
..NET 2003, Win XP and Win 2000 Pro, IE 6.0 SP1 I have a webform with a button, an html input a dropdown list and a data grid. Users may use the drop down to choose a part number which then...
4
by: Bryan Dickerson | last post by:
The error is "Statement is not valid in a Namespace" and the code segment that it points to is: ------------------------------------------------------------------ Option Strict Off Option...
2
by: Wayne Wengert | last post by:
I am using a Gridview in an ASP.NET 2.0 (VB) application. In a hyperlink template column I want to build a url wich includes passing a couple of query strings that I need to populate dynamically. ...
2
by: Neil | last post by:
Hi, I'm getting the fololowing error in Mozilla and Netscape, which does not occur in IE. 'form1 is not defined' at line 195 line 195 is the third line below: function UpdateTagValues()
38
by: Jonathan Wood | last post by:
The following code raises the error "Specified cast is not valid." MembershipUser user = Membership.GetUser(userId); DataSet ds = DataLayer.ExecQueryData("SELECT * FROM mc_Clients WHERE...
16
by: OldBirdman | last post by:
This code is in a Module called from an _Click event for my form named fAAA. Variables beginning ix... are Global Long, declared elsewhere. Public Sub QuickShow() On Error GoTo QuickShow_Error...
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.