3

I want to use JobObjectWrapper in my application to limit process memory. I'm trying to instatiate a JobObject with the following code:

        JobObject job = new JobObject("Hello");

        ProcessStartInfo ps = new ProcessStartInfo("notepad.exe");
        job.CreateProcessSecured(ps);

but I'm getting the following exception:

Unhandled Exception: JobManagement.JobException: The management process is runni ng inside a Job, it will not be able to assign child processes to a new Job.

I'm also getting such exception when I try to run examples in the solution from codeplex(f.e. EndOfProcessMemory).

What am I doing wrong? Thanks in advance :)

Andrey
  • 5,906
  • 4
  • 24
  • 30
  • Are you using the Visual Studio hosting process? – Sasha Goldshtein Feb 01 '11 at 13:47
  • By default that option is enabled.. I've also tried disabling it but I have the same result – Andrey Feb 01 '11 at 14:09
  • Did you try running the sample outside of Visual Studio? (please use the @ tag or I won't see your comments...) – Sasha Goldshtein Feb 01 '11 at 16:20
  • @Sasha Goldshtein: When I try to run application from windows explorer (i.m. just opening the .exe file) I'm getting the same error. But when I open the application using cmd - it works fine.. – Andrey Feb 02 '11 at 07:39
  • You can use Process Explorer to see whether your Windows Explorer process and Visual Studio process are running inside a job. Right-click them in Process Explorer and if they are inside a job there should be a "Job" tab. – Sasha Goldshtein Feb 02 '11 at 13:19

0 Answers0