Debugging a C# program that launches a Cygwin application
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Debugging a C# program that launches a Cygwin application

Threaded View

  1. #1
    Join Date
    May 2007
    Posts
    8

    Debugging a C# program that launches a Cygwin application

    Dear all,

    I have a program whose output depends on launching tleap, a non-Windows program that I have compiled for/with Cygwin. The relevant code is as follows:

    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Diagnostics;
    using System.IO;
    using System.Threading;
    
    namespace cyg_test
    {
        class Program
        {
            static void Main(string[] args)
            {
               string teLeap = "E:\\Cygwin\\home\\Danja\\Science\\amber11_surface\\bin\\teLeap.exe";
               List<string> argus = new List<string>();
    
                ProcessStartInfo run = new ProcessStartInfo();
                run.FileName = teLeap;
                argus.Add("-f");
                argus.Add("/home/blah.sh");
                Process MyProc = new Process();
                run.Arguments = string.Join(" ", argus.ToArray());
                using (Process process = Process.Start(run))
                {} // will put code in brackets
                Console.ReadLine();
            }
    When I execute this code by running my compiled program outside of the debugger, it works just fine. I get a "leap.log" file indicating that the program executed my blah.sh script. However, when I run the same program via the debugger, I get a popup window with the title "teLeap.exe - System Error" and contents "The program can't start because cygwin1.dll is missing from your computer."

    I googled the problem and found the solution of setting the "PATH" environment variable to the Cygwin bin directory. After I did this I was able to run the program as described above, but it didn't fix the problem of running it through the debugger. I would really like to be able to do this because I have a lot of code downstream of this function that I'd like to debug.

    Thanks a lot for any help,

    Dan

    Edit: I'm using Visual Studio 2012, .NET4.5
    Last edited by Danja; June 30th, 2013 at 12:23 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center