BCUninstaller/Bulk-Crap-Uninstaller · error · ArgumentException
File name can't be empty.
Error message
File name can't be empty.
What it means
Thrown by ProcessTools.SeparateArgsFromCommand(string fullCommand). After a null check and Trim(), if the command string is empty the method throws ArgumentException(Localisation.Error_SeparateArgsFromCommand_Empty, nameof(fullCommand)) — the localised value is "File name can't be empty.". Whitespace-only strings are trimmed to empty and also trigger this.
Source
Thrown at source/KlocTools/Tools/ProcessTools.cs:144
//static readonly char[] pathFilterChars = StringTools.InvalidPathChars.Except(new char[] { '"' }).ToArray();
/// <summary>
/// Attempts to separate filename (or filename with path) from the supplied arguments.
/// </summary>
/// <param name="fullCommand"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException">The value of 'fullCommand' cannot be null. </exception>
/// <exception cref="ArgumentException">fullCommand can't be empty</exception>
/// <exception cref="FormatException">Filename is in invalid format</exception>
public static ProcessStartCommand SeparateArgsFromCommand(string fullCommand)
{
if (fullCommand == null)
throw new ArgumentNullException(nameof(fullCommand));
// Get rid of whitespaces
fullCommand = fullCommand.Trim();
if (string.IsNullOrEmpty(fullCommand))
throw new ArgumentException(Localisation.Error_SeparateArgsFromCommand_Empty, nameof(fullCommand));
var firstDot = fullCommand.IndexOf('.');
if (firstDot < 0)
return SeparateNonDottedCommand(fullCommand);
// Check if the path is in format: ExecutableName C:\Argname.exe
{
var pathRoot = fullCommand.IndexOf(":\\", StringComparison.InvariantCulture);
var firstSpace = fullCommand.IndexOf(' ');
if (firstSpace >= 0 && firstSpace < pathRoot)
{
var filenameBreaker = fullCommand.IndexOfAny(SeparateArgsFromCommandInvalidChars, 0, pathRoot - 1);
if (filenameBreaker < 0)
{
var slashIndex = fullCommand.IndexOf('\\');
if (slashIndex >= 0 && slashIndex > pathRoot)
{
var rootSpace = fullCommand.LastIndexOf(' ', pathRoot);View on GitHub (pinned to 608321de98)
Solutions
- Guard with string.IsNullOrWhiteSpace(fullCommand) at the call site and treat blank as 'no command'.
- Trim earlier in the pipeline and skip processing if empty.
- Provide a meaningful default command when the configured one is blank.
Example fix
// before var cmd = ProcessTools.SeparateArgsFromCommand(raw); // raw may be " " // after if (string.IsNullOrWhiteSpace(raw)) return null; var cmd = ProcessTools.SeparateArgsFromCommand(raw);
Defensive patterns
Strategy: validation
Validate before calling
if (string.IsNullOrWhiteSpace(fullCommand)) return null; var cmd = ProcessTools.SeparateArgsFromCommand(fullCommand);
Type guard
static bool IsNonEmptyCommand(string s) => !string.IsNullOrWhiteSpace(s);
Prevention
- Treat blank command strings as 'no command' at the source.
- Trim persisted settings on load and reject empty ones.
- Provide a default command rather than passing blanks downstream.
When it happens
Trigger: Calling SeparateArgsFromCommand with an all-whitespace string (e.g. " ", "\t") after the explicit null check has already handled null.
Common situations: Persisted command-line settings that were saved blank, UI fields the user cleared, or strings read from a file/registry whose value is just spaces.
Related errors
- File name must contain an extension separated by a dot. {ful
- Failed to parse the input
- Ending quotation mark is missing.
- Minimum value must be lower than or equal to the maximum val
- Font size must be higher than 0
AI-assisted analysis of BCUninstaller/Bulk-Crap-Uninstaller@608321de98 (2026-08-13).
Data as JSON: /api/errors/2a18ae292d8ed171.
Report an issue: GitHub.