Skip to content

Commit ab31260

Browse files
author
Kapil Borle
committed
Add switch to lauch debugger in DEBUG configuration
1 parent 950e5f2 commit ab31260

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Engine/Commands/InvokeScriptAnalyzerCommand.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,16 @@ public SwitchParameter SaveDscDependency
206206
}
207207
private bool saveDscDependency;
208208
#endif // !PSV3
209+
210+
#if DEBUG
211+
[Parameter(Mandatory = false)]
212+
public SwitchParameter AttachAndDebug
213+
{
214+
get { return attachAndDebug; }
215+
set { attachAndDebug = value; }
216+
}
217+
private bool attachAndDebug = false;
218+
#endif
209219
#endregion Parameters
210220

211221
#region Overrides
@@ -216,6 +226,19 @@ public SwitchParameter SaveDscDependency
216226
protected override void BeginProcessing()
217227
{
218228
// Initialize helper
229+
#if DEBUG
230+
if (attachAndDebug)
231+
{
232+
if (System.Diagnostics.Debugger.IsAttached)
233+
{
234+
System.Diagnostics.Debugger.Break();
235+
}
236+
else
237+
{
238+
System.Diagnostics.Debugger.Launch();
239+
}
240+
}
241+
#endif
219242
Helper.Instance = new Helper(
220243
SessionState.InvokeCommand,
221244
this);

0 commit comments

Comments
 (0)