Skip to content
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

Add possiblity to launch debugger #876

Closed
bjorkstromm opened this issue May 12, 2016 · 13 comments
Closed

Add possiblity to launch debugger #876

bjorkstromm opened this issue May 12, 2016 · 13 comments
Assignees

Comments

@bjorkstromm
Copy link
Member

Once PR #858 is merged, it might be useful to have the possibility to let Cake.exe launch a debugger using System.Diagnostics.Debugger.Launch() instead of waiting for debugger to be attached.

Maybe waiting for debugger to be attached could be canceled by user, and then on #debug pre-processor directive (as mentioned in issue #869) we could do Debugger.Launch() if debugger isn't attached...

@gep13
Copy link
Member

gep13 commented Jun 5, 2016

@mholo65 is this something that you will be in a position to look at, or would you like one of us to take it? Thanks!

@bjorkstromm
Copy link
Member Author

@gep13 yes, I can look at this. But to make this is as elegant as possible, then at least some bit of Cake.Core (e.g. ICakeEnvironment) needs to know if we are running debug or not. Hence the reference to #902

By doing this we could use same pre-processor directive and the change these BreakDirectiveProcessor.cs lines to:

replacement = null;

if (!line.Trim().Equals("#break", StringComparison.Ordinal))
{
    return false;
}

if(_environment.IsDebug)
{
    replacement = @"if (System.Diagnostics.Debugger.IsAttached) { System.Diagnostics.Debugger.Break(); } else { System.Diagnostics.Debugger.Launch(); }";
}

return true;

Result will be that #break directive will be commented out if --debug flag was not supplied to Cake.exe, otherwise debugger will break or launch depending on if it's attached or not.

What's your opinion on this?

@gep13
Copy link
Member

gep13 commented Jun 6, 2016

@mholo65 I agree, I think we need that before attempting this. @patriksvensson were you planning on attempting #502 in the 0.13.0 release, or should we bump this particular issue onto the next milestone?

@patriksvensson
Copy link
Member

@mholo65 What would the non-elegant solution look like until we've fixed the environment refactoring?

@bjorkstromm
Copy link
Member Author

@patriksvensson well, it's probably by adding a new directive #debug-launch, or similar

All other solutions would require refactoring of the Autofac module registrations, we have an chicken-egg problem because Core module is loaded first, and then arguments are parsed. A not-so-elegant solution would be to just check arguments for --debug|-debug|-d prior to creating the Core module (somewhere about here)

@patriksvensson
Copy link
Member

@mholo65 I have a submitted PR that should solve that. Did some refactoring gor the module support. However, checking if --debug is present should be ok for now. We can always refactor later.

@bjorkstromm
Copy link
Member Author

@patriksvensson @gep13 ok, then I'll try to get something done... What's the schedule for v0.13.0?

@gep13
Copy link
Member

gep13 commented Jun 6, 2016

@mholo65 we are hoping to get something out before Thursday, which is when I am doing a talk at NDC. If that is unrealistic, please don't feel any pressure to try to get this done.

@patriksvensson
Copy link
Member

Maybe we can move this to v0.14.0 so there's no stress.

@bjorkstromm
Copy link
Member Author

yep, move to v0.14.0, even if I start working on it today, Thursday is a bit unrealistic when taking review + testing into account.

@gep13 gep13 modified the milestones: v0.14.0, v0.13.0 Jun 6, 2016
@gep13
Copy link
Member

gep13 commented Jun 6, 2016

@mholo65 done. Thanks again for helping out!

bjorkstromm added a commit to bjorkstromm/cake that referenced this issue Jun 13, 2016
bjorkstromm added a commit to bjorkstromm/cake that referenced this issue Jun 22, 2016
@gep13 gep13 modified the milestones: v0.14.0, v0.15.0 Jun 28, 2016
@gep13
Copy link
Member

gep13 commented Jul 24, 2016

@mholo65 given the work that @patriksvensson has been doing on getting the CoreClr port of Cake to where it is, I am going to defer this work until after that is released. Hope that makes sense.

@gep13 gep13 modified the milestones: v0.17.0, v0.15.0 Jul 24, 2016
@gep13 gep13 removed this from the v0.17.0 milestone Oct 25, 2016
@bjorkstromm
Copy link
Member Author

Not needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants