Skip to content

Commit 941a651

Browse files
authored
remove [debug] directive (#1585)
* remove [debug] directive * update XLFs
1 parent 7e5307c commit 941a651

19 files changed

+0
-365
lines changed

src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_api_is_not_changed.approved.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,6 @@
143143
public System.String ArgumentConversionCannotParse(System.String value, System.Type expectedType)
144144
public System.String ArgumentConversionCannotParseForCommand(System.String value, System.String commandAlias, System.Type expectedType)
145145
public System.String ArgumentConversionCannotParseForOption(System.String value, System.String optionAlias, System.Type expectedType)
146-
public System.String DebugDirectiveAttachToProcess(System.Int32 processId, System.String processName)
147-
public System.String DebugDirectiveExecutableNotSpecified(System.String environmentVariableName, System.String processName)
148-
public System.String DebugDirectiveProcessNotIncludedInEnvironmentVariable(System.String processName, System.String environmentVariableName, System.String processNames)
149146
public System.String DirectoryDoesNotExist(System.String path)
150147
public System.String ErrorReadingResponseFile(System.String filePath, System.IO.IOException e)
151148
public System.String ExceptionHandlerHeader()
@@ -265,7 +262,6 @@ System.CommandLine.Builder
265262
public static CommandLineBuilder EnablePosixBundling(this CommandLineBuilder builder, System.Boolean value = True)
266263
public static CommandLineBuilder ParseResponseFileAs(this CommandLineBuilder builder, System.CommandLine.Parsing.ResponseFileHandling responseFileHandling)
267264
public static CommandLineBuilder RegisterWithDotnetSuggest(this CommandLineBuilder builder)
268-
public static CommandLineBuilder UseDebugDirective(this CommandLineBuilder builder)
269265
public static CommandLineBuilder UseDefaults(this CommandLineBuilder builder)
270266
public static CommandLineBuilder UseEnvironmentVariableDirective(this CommandLineBuilder builder)
271267
public static CommandLineBuilder UseExceptionHandler(this CommandLineBuilder builder, System.Action<System.Exception,System.CommandLine.Invocation.InvocationContext> onException = null, System.Nullable<System.Int32> errorExitCode = null)

src/System.CommandLine.Suggest/SuggestionDispatcher.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ public SuggestionDispatcher(ISuggestionRegistration suggestionRegistration, ISug
8282
.UseVersionOption()
8383
.UseHelp()
8484
.UseParseDirective()
85-
.UseDebugDirective()
8685
.UseSuggestDirective()
8786
.UseParseErrorReporting()
8887
.UseExceptionHandler()

src/System.CommandLine/Builder/CommandLineBuilderExtensions.cs

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@
77
using System.CommandLine.Invocation;
88
using System.CommandLine.IO;
99
using System.CommandLine.Parsing;
10-
using System.Diagnostics;
1110
using System.IO;
1211
using System.Linq;
1312
using System.Reflection;
1413
using System.Threading;
15-
using System.Threading.Tasks;
1614
using static System.Environment;
1715
using Process = System.CommandLine.Invocation.Process;
1816

@@ -220,55 +218,6 @@ await feature.EnsureRegistered(async () =>
220218
return builder;
221219
}
222220

223-
/// <summary>
224-
/// Enables the use of the <c>[debug]</c> directive, which will pause invocation prior to invoking any command handler so that developers can attach a debugger.
225-
/// </summary>
226-
/// <param name="builder">A command line builder.</param>
227-
/// <returns>The same instance of <see cref="CommandLineBuilder"/>.</returns>
228-
public static CommandLineBuilder UseDebugDirective(
229-
this CommandLineBuilder builder)
230-
{
231-
builder.AddMiddleware(async (context, next) =>
232-
{
233-
if (context.ParseResult.Directives.Contains("debug"))
234-
{
235-
const string environmentVariableName = "DOTNET_COMMANDLINE_DEBUG_PROCESSES";
236-
237-
var process = Diagnostics.Process.GetCurrentProcess();
238-
var debuggableProcessNames = GetEnvironmentVariable(environmentVariableName);
239-
if (string.IsNullOrWhiteSpace(debuggableProcessNames))
240-
{
241-
context.Console.Error.WriteLine(context.LocalizationResources.DebugDirectiveExecutableNotSpecified(environmentVariableName, process.ProcessName));
242-
context.ExitCode = 1;
243-
return;
244-
}
245-
else
246-
{
247-
string[] processNames = debuggableProcessNames.Split(';');
248-
if (processNames.Contains(process.ProcessName, StringComparer.Ordinal))
249-
{
250-
var processId = process.Id;
251-
context.Console.Out.WriteLine(context.LocalizationResources.DebugDirectiveAttachToProcess(processId, process.ProcessName));
252-
while (!Debugger.IsAttached)
253-
{
254-
await Task.Delay(500);
255-
}
256-
}
257-
else
258-
{
259-
context.Console.Error.WriteLine(context.LocalizationResources.DebugDirectiveProcessNotIncludedInEnvironmentVariable(process.ProcessName, environmentVariableName, debuggableProcessNames));
260-
context.ExitCode = 1;
261-
return;
262-
}
263-
}
264-
}
265-
266-
await next(context);
267-
}, MiddlewareOrderInternal.DebugDirective);
268-
269-
return builder;
270-
}
271-
272221
/// <summary>
273222
/// Enables the use of the <c>[env:key=value]</c> directive, allowing environment variables to be set from the command line during invocation.
274223
/// </summary>
@@ -312,7 +261,6 @@ public static CommandLineBuilder UseEnvironmentVariableDirective(
312261
/// .UseHelp()
313262
/// .UseEnvironmentVariableDirective()
314263
/// .UseParseDirective()
315-
/// .UseDebugDirective()
316264
/// .UseSuggestDirective()
317265
/// .RegisterWithDotnetSuggest()
318266
/// .UseTypoCorrections()
@@ -330,7 +278,6 @@ public static CommandLineBuilder UseDefaults(this CommandLineBuilder builder)
330278
.UseHelp()
331279
.UseEnvironmentVariableDirective()
332280
.UseParseDirective()
333-
.UseDebugDirective()
334281
.UseSuggestDirective()
335282
.RegisterWithDotnetSuggest()
336283
.UseTypoCorrections()

src/System.CommandLine/LocalizationResources.cs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -224,26 +224,6 @@ public virtual string VersionOptionCannotBeCombinedWithOtherArguments(string opt
224224
public virtual string ExceptionHandlerHeader()
225225
=> GetResourceString(Properties.Resources.ExceptionHandlerHeader);
226226

227-
/// <summary>
228-
/// Interpolates values into a localized string similar to Debug directive specified, but no process names are listed as allowed for debug.
229-
///Add your process name to the &apos;{0}&apos; environment variable.
230-
///The value of the variable should be the name of the processes, separated by a semi-colon &apos;;&apos;, for example &apos;{0}={1}&apos;.
231-
/// </summary>
232-
public virtual string DebugDirectiveExecutableNotSpecified(string environmentVariableName, string processName)
233-
=> GetResourceString(Properties.Resources.DebugDirectiveExecutableNotSpecified, environmentVariableName, processName);
234-
235-
/// <summary>
236-
/// Interpolates values into a localized string similar to Attach your debugger to process {0} ({1})..
237-
/// </summary>
238-
public virtual string DebugDirectiveAttachToProcess(int processId, string processName)
239-
=> GetResourceString(Properties.Resources.DebugDirectiveAttachToProcess, processId, processName);
240-
241-
/// <summary>
242-
/// Interpolates values into a localized string similar to Process name &apos;{0}&apos; is not included in the list of debuggable process names in the {1} environment variable (&apos;{2}&apos;).
243-
/// </summary>
244-
public virtual string DebugDirectiveProcessNotIncludedInEnvironmentVariable(string processName, string environmentVariableName, string processNames)
245-
=> GetResourceString(Properties.Resources.DebugDirectiveProcessNotIncludedInEnvironmentVariable, processName, environmentVariableName, processNames);
246-
247227
/// <summary>
248228
/// Interpolates values into a localized string similar to Cannot parse argument &apos;{0}&apos; as expected type {1}..
249229
/// </summary>

src/System.CommandLine/Properties/Resources.Designer.cs

Lines changed: 0 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/System.CommandLine/Properties/Resources.resx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -210,17 +210,6 @@
210210
<data name="HelpCommandsTitle" xml:space="preserve">
211211
<value>Commands:</value>
212212
</data>
213-
<data name="DebugDirectiveAttachToProcess" xml:space="preserve">
214-
<value>Attach your debugger to process {0} ({1}).</value>
215-
</data>
216-
<data name="DebugDirectiveExecutableNotSpecified" xml:space="preserve">
217-
<value>Debug directive specified, but no process names are listed as allowed for debug.
218-
Add your process name to the '{0}' environment variable.
219-
The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}'</value>
220-
</data>
221-
<data name="DebugDirectiveProcessNotIncludedInEnvironmentVariable" xml:space="preserve">
222-
<value>Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}')</value>
223-
</data>
224213
<data name="ExceptionHandlerHeader" xml:space="preserve">
225214
<value>Unhandled exception: </value>
226215
</data>

src/System.CommandLine/Properties/xlf/Resources.cs.xlf

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,6 @@
3737
<target state="new">Required argument missing for command: '{0}'.</target>
3838
<note />
3939
</trans-unit>
40-
<trans-unit id="DebugDirectiveAttachToProcess">
41-
<source>Attach your debugger to process {0} ({1}).</source>
42-
<target state="new">Attach your debugger to process {0} ({1}).</target>
43-
<note />
44-
</trans-unit>
45-
<trans-unit id="DebugDirectiveExecutableNotSpecified">
46-
<source>Debug directive specified, but no process names are listed as allowed for debug.
47-
Add your process name to the '{0}' environment variable.
48-
The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}'</source>
49-
<target state="new">Debug directive specified, but no process names are listed as allowed for debug.
50-
Add your process name to the '{0}' environment variable.
51-
The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}'</target>
52-
<note />
53-
</trans-unit>
54-
<trans-unit id="DebugDirectiveProcessNotIncludedInEnvironmentVariable">
55-
<source>Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}')</source>
56-
<target state="new">Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}')</target>
57-
<note />
58-
</trans-unit>
5940
<trans-unit id="DirectoryDoesNotExist">
6041
<source>Directory does not exist: '{0}'.</source>
6142
<target state="new">Directory does not exist: '{0}'.</target>

src/System.CommandLine/Properties/xlf/Resources.de.xlf

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,6 @@
3737
<target state="new">Required argument missing for command: '{0}'.</target>
3838
<note />
3939
</trans-unit>
40-
<trans-unit id="DebugDirectiveAttachToProcess">
41-
<source>Attach your debugger to process {0} ({1}).</source>
42-
<target state="new">Attach your debugger to process {0} ({1}).</target>
43-
<note />
44-
</trans-unit>
45-
<trans-unit id="DebugDirectiveExecutableNotSpecified">
46-
<source>Debug directive specified, but no process names are listed as allowed for debug.
47-
Add your process name to the '{0}' environment variable.
48-
The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}'</source>
49-
<target state="new">Debug directive specified, but no process names are listed as allowed for debug.
50-
Add your process name to the '{0}' environment variable.
51-
The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}'</target>
52-
<note />
53-
</trans-unit>
54-
<trans-unit id="DebugDirectiveProcessNotIncludedInEnvironmentVariable">
55-
<source>Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}')</source>
56-
<target state="new">Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}')</target>
57-
<note />
58-
</trans-unit>
5940
<trans-unit id="DirectoryDoesNotExist">
6041
<source>Directory does not exist: '{0}'.</source>
6142
<target state="new">Directory does not exist: '{0}'.</target>

src/System.CommandLine/Properties/xlf/Resources.es.xlf

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,6 @@
3737
<target state="new">Required argument missing for command: '{0}'.</target>
3838
<note />
3939
</trans-unit>
40-
<trans-unit id="DebugDirectiveAttachToProcess">
41-
<source>Attach your debugger to process {0} ({1}).</source>
42-
<target state="new">Attach your debugger to process {0} ({1}).</target>
43-
<note />
44-
</trans-unit>
45-
<trans-unit id="DebugDirectiveExecutableNotSpecified">
46-
<source>Debug directive specified, but no process names are listed as allowed for debug.
47-
Add your process name to the '{0}' environment variable.
48-
The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}'</source>
49-
<target state="new">Debug directive specified, but no process names are listed as allowed for debug.
50-
Add your process name to the '{0}' environment variable.
51-
The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}'</target>
52-
<note />
53-
</trans-unit>
54-
<trans-unit id="DebugDirectiveProcessNotIncludedInEnvironmentVariable">
55-
<source>Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}')</source>
56-
<target state="new">Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}')</target>
57-
<note />
58-
</trans-unit>
5940
<trans-unit id="DirectoryDoesNotExist">
6041
<source>Directory does not exist: '{0}'.</source>
6142
<target state="new">Directory does not exist: '{0}'.</target>

src/System.CommandLine/Properties/xlf/Resources.fr.xlf

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,6 @@
3737
<target state="new">Required argument missing for command: '{0}'.</target>
3838
<note />
3939
</trans-unit>
40-
<trans-unit id="DebugDirectiveAttachToProcess">
41-
<source>Attach your debugger to process {0} ({1}).</source>
42-
<target state="new">Attach your debugger to process {0} ({1}).</target>
43-
<note />
44-
</trans-unit>
45-
<trans-unit id="DebugDirectiveExecutableNotSpecified">
46-
<source>Debug directive specified, but no process names are listed as allowed for debug.
47-
Add your process name to the '{0}' environment variable.
48-
The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}'</source>
49-
<target state="new">Debug directive specified, but no process names are listed as allowed for debug.
50-
Add your process name to the '{0}' environment variable.
51-
The value of the variable should be the name of the processes, separated by a semi-colon ';', for example '{0}={1}'</target>
52-
<note />
53-
</trans-unit>
54-
<trans-unit id="DebugDirectiveProcessNotIncludedInEnvironmentVariable">
55-
<source>Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}')</source>
56-
<target state="new">Process name '{0}' is not included in the list of debuggable process names in the {1} environment variable ('{2}')</target>
57-
<note />
58-
</trans-unit>
5940
<trans-unit id="DirectoryDoesNotExist">
6041
<source>Directory does not exist: '{0}'.</source>
6142
<target state="new">Directory does not exist: '{0}'.</target>

0 commit comments

Comments
 (0)