-
-
Notifications
You must be signed in to change notification settings - Fork 732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debug support #858
Debug support #858
Conversation
@mholo65 Great job! 👍 Would it be possible to Rename the public sealed class DefaultRoslynSessionFactory : RoslynSessionFactory { }
public sealed class DebugRoslynSessionFactory : RoslynSessionFactory { }
public sealed class DefaultRoslynSession : RoslynSession { }
public sealed class DebugRoslynSession : RoslynSession { } Not sure that |
Thanx! Default/Debug sounds better than current naming. Will wait and see what the others have to say about naming. Another thing that cane to mind. What about adding #break pre-processor directive that would inject System.Diagnostics.Debugger.Break();? That could be a separate PR though. |
@mholo65 +1 on naming 👍 Any thoughts @gep13? New preprocessors should as you suggest be part of separate PR, so we keep this one as focused as possible. |
Would you also like to have debug support for experimental (nightly) version of Roslyn as separate PR? It is not yet implemented in this PR. |
@mholo65 I think debug support for experimental Roslyn could be a part of this PR. |
I agree with @patriksvensson, would be great with support for experimental in this pr too. |
@patriksvensson @devlead Thanks. I'll fix the naming, add experimental roslyn support and add some unit tests. I'll probably have it by the end of this week. |
Sorry for not replying sooner, had a couple things on... Yes, I agree with the suggested naming. I really like the idea of the #debug pre processor as well, I think that will help during debugging sessions, but I agree that this should be a separate PR. This really is great work @mholo65! This is going to make a lot of people very happy! 👍 |
private readonly RoslynScriptSessionFactory _stableFactory; | ||
private readonly RoslynNightlyScriptSessionFactory _nightlyFactory; | ||
private readonly RoslynSessionFactory _stableFactory; | ||
private readonly RoslynNightlySessionFactory _nightlyFactory; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@patriksvensson hmm, maybe I should keep Script in the new name. RoslynNightlySession sounds ratherh kinky 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mholo65 Lol 😄 Keep the Script 😉
@mholo65 quick random question... will the debugger within say VSCode also be able to attach to this, in the same way as you can with Visual Studio? |
{ | ||
var strategy = new DefaultExecutionStrategy(_log); | ||
var message = "Attach debugger to process {0} to continue"; | ||
var pid = System.Diagnostics.Process.GetCurrentProcess().Id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@patriksvensson any wishes for abstracting this in order to unit test?
@patriksvensson I think I'm confident enough to remove the [WIP] tag now 😄 |
Damn! Really looking forward to taking a look at this, and having a play! @mholo65 on a side note, did you take a look at using VSCode as the debugger? Is that going to work, or is additional work required? Cheers! |
@gep13 I checked up on VSCode debugging and unfortunately it won't work until Cake is ported to .NET Core as the Omnisharp VSCode Debugger uses CLRDBG which is designed for .NET Core. However, the .NET Framework Command-Line Debugger, MDbg works like a charm. But this debugger is unfortunately not available as an extension for VSCode. A third alternative is the Mono debugger, which may work. I'm currently not in a position to test that as I'm lacking an environment atm. (read not supported on Windows) |
@gep13 and forget the third alternative as we don't do the Roslyn dance on Linux/Mac and this PR doesn't implement debugging support for Mono... |
@mholo65 Awesome work! Really impressed. Will take a closer look at it tonight when I'm off work. @gep13 Have you seen the Mono debug adapter? https://github.com/Microsoft/vscode-mono-debug |
|
||
namespace Cake.Scripting.Roslyn.Nightly | ||
{ | ||
using Core.IO; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any special reason this isn't by the other using statements above? If not move up so all in one place.
659c665
to
f75166c
Compare
ping @devlead @patriksvensson @gep13 fixed, rebased and squashed! |
@mholo65 Looks good to me! 😄 @devlead Will you take lead on this? |
@patriksvensson agree 👍 Just waiting for CI to complete. |
@devlead seems like Travis osx build is stalled.. :( |
@mholo65 I've restarted the Travis build. |
@mholo65 This is now merged 👍 Big thanks for your contribution! @cake-build/team FYI 1/2 travis builds didn't complete(the Mac build - restarted 4 times), all other CI success and tested locally, so took decision to merge anyway. |
@devlead Thank You! It was a pleasure doing this PR 😄 |
Is there any plans on producing a write-up on using this feature. At this point debug support and intellisense are the only things blocking me from adopting cake as my go to build tool. |
@DamianReeves yes, there's an issue here cake-build/website#83 to track this. |
@mholo65 @DamianReeves there will likely be an intro blog post too shortly. |
@DamianReeves A blog post have been posted about this: http://cakebuild.net/blog/2016/05/debug-cake-file |
As a point of curiosity, what are you currently using as your build tool? |
@gep13 I go back and forth between psake and FAKE |
Solves #114
WIP Debug support. Currently only supports Stable version of Roslyn, the Nightly should be a no brainer, but I wanted to discuss this more in detail before implementing.
Done:
I'm not sure about the Roslyn Session and SessionFactory implementations. Refactored out the common bits, but still feels kind of wierd? Any suggestions on this before proceeding with the Nightly version of Roslyn.
ALSO Still lacks Unit Tests, some bits should be refactored to allow testing, e.g. DebugScriptHost..
HOWTO:
cake.exe cakefile.cake -debug
Attach debugger to process XYZ to continue