-2

This is my code

static void Main()
        {
            /*
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[] 
            { 
                new OpenTableImporter() 
            };
            ServiceBase.Run(ServicesToRun);*/
            XMLReader x = new XMLReader(new LogCustome());
            Console.ReadLine();
        }

I got:

Not enough storage is available to process this command. on Console.ReadLine()

could you help please?

Update 1

the class LogCustome is almost empty as you see:

class LogCustome
    {
        public void logStartService() { }

        public void logStopService() { }
    }

Update2

Even when the code is as simple as this:

static void Main()
        {
            /*
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[] 
            { 
                new OpenTableImporter() 
            };
            ServiceBase.Run(ServicesToRun);*/
            //XMLReader x = new XMLReader(new LogCustome());
            Console.ReadLine();
        }

I still have the exception

Marco Dinatsoli
  • 10,322
  • 37
  • 139
  • 253
  • 1
    What does the constructor for `LogCustome` do? there isn't really enough information here to help. At least a stack trace is needed – Sayse Nov 19 '14 at 13:22
  • @Sayse I have update my question adding the `LogCustome` class, very simple class – Marco Dinatsoli Nov 19 '14 at 13:23
  • 1
    And what's the code for the constructor of `XMLReader`? Not to be confused with `System.Xml.XmlReader`, I suppose? – Jeroen Mostert Nov 19 '14 at 13:25
  • @JeroenMostert that is my custom class, not the .net class, anyway, I updated the question and stated that when my `main` is just `Console.ReadLine()`, I still have that exception – Marco Dinatsoli Nov 19 '14 at 13:26
  • Is the problem in Console.RadLine()? fi you comment out the XMLReader line, does it happen? – ShayD Nov 19 '14 at 13:26
  • @ShayD as you see in my `Update2`, I have already tried your suggestion and still have the problem – Marco Dinatsoli Nov 19 '14 at 13:27
  • See http://stackoverflow.com/q/995906/67392 this is likely to be a memory issue. – Richard Nov 19 '14 at 13:28
  • Guys, I am sorry if the question is not good, but I would appreciate if you tell me why you are down voting. Plus, Now, I guess, the question is clear. – Marco Dinatsoli Nov 19 '14 at 13:28
  • The question isn't clear at all, is the exception actually in your program or is your OS reporting it? if its in your program then you would have a stack trace, if it isn't then you need to look at your memory usage of your computer – Sayse Nov 19 '14 at 13:29
  • @MarcoDinatsoli: now it's getting interesting. Does it persist if you remove any `app.config` you have? Does it appear or disappear if you run it in the debugger? Do you get an exception with a stack trace and if so, what does it say? – Jeroen Mostert Nov 19 '14 at 13:30
  • @Sayse I don't know where the problem could have happened, that is why I am asking here. If I had knew that the problem in my OS, I would have stated that. Anyway, I am ready to provide you with any information, I don't know what to check – Marco Dinatsoli Nov 19 '14 at 13:33
  • @JeroenMostert I don't get a `stack trace` exception. and I don't know what do you mean buy `run it in the debugger` – Marco Dinatsoli Nov 19 '14 at 13:34
  • I will try to restart my computer and come back to you after 4-5 minutes – Marco Dinatsoli Nov 19 '14 at 13:34
  • MSDN: http://msdn.microsoft.com/en-us/library/ms837395.aspx Do one of the following, then retry the command: (1) reduce the number of running programs; (2) remove unwanted files from the disk the paging file is on and restart the system; (3) check the paging file disk for an I/O error; or (4) install additional memory in your system. – Bram Van Strydonck Nov 19 '14 at 13:34
  • @BramVanStrydonck I am working on computer 16GB ram, and after restart the computer, just 2GB are being used, I have more than 200GB free in my driver. help please – Marco Dinatsoli Nov 19 '14 at 13:51
  • You are almost certainly not having any memory trouble -- the error code is a red herring. The trouble is, finding out the root cause is difficult and Stack Overflow isn't really intended for such bug hunts. For example, you may have a piece of software injecting a rogue DLL that hooks system functions, causing `Console.ReadLine()` to fail with a spurious error. Diagnosing this is not simple. A reinstall of Windows will almost certainly work... but may be a bit too drastic. – Jeroen Mostert Nov 19 '14 at 14:31

2 Answers2

2

Likely on the project properties (since you created it as a service), Output Type is a Windows Application, change that to Console Application and it'll work as you expect.

Allan Elder
  • 4,052
  • 17
  • 19
0

Is the amount of data you're trying to read over 254 characters?

Refer to:
How to read very long input from console in C#?
Console.ReadLine() max length?

Community
  • 1
  • 1
TSmith
  • 27
  • 5