0

I used follow code:

static void Main(string[] args)
    {
        ProcessStartInfo perlStartInfo = new ProcessStartInfo(@"C:\strawberry\perl\bin\perl.exe");
        perlStartInfo.Arguments = "c:\\ebm\\parse_ebm_log.pl";
        perlStartInfo.UseShellExecute = false;
        perlStartInfo.RedirectStandardOutput = true;
        perlStartInfo.RedirectStandardError = true;
        perlStartInfo.CreateNoWindow = false;

        Process perl = new Process();
        perl.StartInfo = perlStartInfo;
        perl.Start();
        perl.WaitForExit();
        string output = perl.StandardOutput.ReadToEnd();
    }

Now I have this exception when I look in perl.MainModule: MainModule = 'perl.MainModule' threw an exception of type

'System.ComponentModel.Win32Exception' base {System.SystemException} = {"Only part of a ReadProcessMemory or WriteProcessMemory request was completed"}

Target build is x64 due to previous exception in same perl.MainModule when it said cannot run x64 on x32 process (something like that)

2
  • Does Perl work by itself (not called from .Net)? Commented Feb 27, 2013 at 15:27
  • What's C:\strawberry\perl\bin\perl.exe -V:archname (capital V) Commented Feb 27, 2013 at 16:44

1 Answer 1

1

try adding perl in PATH Enviroment (open a new windows shell after that) along with below changes

ProcessStartInfo perlStartInfo = new ProcessStartInfo()
perlStartInfo.FileName= "perl.exe"
perlStartInfo.UseShellExecute = true
Sign up to request clarification or add additional context in comments.

2 Comments

Hi, PATH is already there. I changed code but I have same problem. Thing is that I need to have 'perlStartInfo.UseShellExecute = true' because I'm redirecting script output to string in C#. I also tried variations on you code.
I wrote another simple script with just print function and now it's working, so memory problem is probably about perl script. Waiting for new script and if same problem happen again will post about it. Thx.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.