SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Change how Run (F5 and Ctrl+F5) works

Last post 06-26-2007 12:35 PM by Finnsson. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 06-19-2007 5:56 PM

    Change how Run (F5 and Ctrl+F5) works

    Hi,

     

    I got my own language binding and all for SharpDevelop. When I run the programs I write in my language (a Matlab/Octave-like language) the screen just pops up and then close again before you have the time to see the result. I'm wondering if it's possible to add a System.Console.ReadKey() or something similar to the Run-command (F5 and Ctrl+F5).

    I have also tried to add "Console.ReadKey()" to Start(bool) in my derived class from CompilableProject but then it just compains that I got no console to read from. If I add Console.Read() or Console.ReadLine() the window just pops up and close again.

    I can add Console.ReadKey() to the compiled output (using my compiler) but I don't think that's a good solution, since the user probably don't want a Console.ReadKey() in the final product (not even if the final product is in debug mode).

    I would prefere if this could be solved by overriding CompilabeProject.Start(bool) or something similar but any ideas are welcome.

     

    Take care,

    Finnsson 

  • 06-23-2007 2:53 PM In reply to

    Re: Change how Run (F5 and Ctrl+F5) works

    I don't think you can get the pause when you use the debugger. Visual Studio only seems to pause when you run it without the debugger. Ideally SharpDevelop would support the pause itself, but you should be able to do it yourself by overriding the CompilableProject.Start method. SharpDevelop 1.1 used to pause a console app by using the following code:

                    ProcessStartInfo psi = new ProcessStartInfo(Environment.GetEnvironmentVariable("ComSpec"), "/c " + "\"" + exe + "\"" + " & pause");
                    psi.WorkingDirectory = Path.GetDirectoryName(exe);
                    psi.UseShellExecute = true;
                    debuggerService.StartWithoutDebugging(psi);

  • 06-23-2007 9:44 PM In reply to

    Re: Change how Run (F5 and Ctrl+F5) works

    MattWard:

    I don't think you can get the pause when you use the debugger. Visual Studio only seems to pause when you run it without the debugger. Ideally SharpDevelop would support the pause itself, but you should be able to do it yourself by overriding the CompilableProject.Start method. SharpDevelop 1.1 used to pause a console app by using the following code:

                    ProcessStartInfo psi = new ProcessStartInfo(Environment.GetEnvironmentVariable("ComSpec"), "/c " + "\"" + exe + "\"" + " & pause");
                    psi.WorkingDirectory = Path.GetDirectoryName(exe);
                    psi.UseShellExecute = true;
                    debuggerService.StartWithoutDebugging(psi);

     

    Why did we take this out of SD? If someone wants to put this back in, let me know to change the console project templates. Is the DebuggerService just no longer in SD in a similar form? 

  • 06-23-2007 11:29 PM In reply to

    Re: Change how Run (F5 and Ctrl+F5) works

    This works only when running without debugger.

    If you would use this ProcessStartInfo with the debugger, it would attach to cmd.exe (and fail because cmd.exe isn't managed), and not the user's exe.

    Daniel Grunwald
  • 06-24-2007 12:43 AM In reply to

    • DavidSrbecky
    • Top 10 Contributor
    • Joined on 08-22-2005
    • Usti nad Labem, Czech Republic
    • Posts 442
    • Team Members

    Re: Change how Run (F5 and Ctrl+F5) works

    I was trying to make this work with the debugger in the past, but I have not found an easy way of doing it.
  • 06-26-2007 12:35 PM In reply to

    Re: Change how Run (F5 and Ctrl+F5) works

    Hi,

     

    I implemented my own CompilableProject.Start(bool) and got it working in non-debug-mode. Thanks for the help.

     

    Take care,

    Finnsson 

Page 1 of 1 (6 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.