BeyondDimension/SteamTools · warning · ArgumentNullException
PIN CODE cannot be empty
Error message
PIN CODE cannot be empty
What it means
Thrown (as ArgumentNullException) when the Steam badge fetch returns a parental-lock status and the user dismisses/leaves empty the PIN dialog. The code prompts for a PIN via ShowDialogAsync; if the result is null/empty it throws ArgumentNullException with the localized 'PIN must not be null' message instead of attempting UnlockParental with a blank PIN.
Source
Thrown at src/BD.WTTS.Client.Plugins.SteamIdleCard/UI/ViewModels/IdleCardPageViewModel.cs:408
HttpStatusCode status;
GetBadges:
var steam_id = SteamLoginState.SteamId.ToString();
(UserIdleInfo, badges, status) = await IdleCard.GetBadgesAsync(steam_id, true);
if (status == HttpStatusCode.Forbidden)
{
var result = await TextBoxWindowViewModel.ShowDialogAsync(new TextBoxWindowViewModel
{
Title = Strings.Idle_NeedParentalPIN,
Placeholder = "PIN CODE",
InputType = TextBoxWindowViewModel.TextBoxInputType.Password,
});
if (!string.IsNullOrEmpty(result))
{
await steamSession.UnlockParental(steam_id, result);
goto GetBadges;
}
throw new ArgumentNullException(Strings.Idle_PIN_NotBeNull);
}
else if (status != HttpStatusCode.OK)
throw new HttpRequestException($"{Strings.Idle_GetBadgesError} status code: {status}");
goto HandleBadges;
HandleBadges:
Badges.Clear();
Badges.Add(badges!);
//await RefreshPrivateGameAppIds(steam_id);
TotalCardsRemaining = 0;
TotalCardsAvgPrice = 0;
badges = badges!.Where(w => w.CardsRemaining != 0);
foreach (var badge in badges)
{
if (IsExcludedApp(badge.AppId))
continue;View on GitHub (pinned to c16ffa08e0)
Solutions
- Re-enter a valid parental PIN when prompted instead of dismissing the dialog.
- Disable parental controls on the Steam account (or have the parent remove the PIN) then retry.
- Catch the exception and re-prompt the user rather than aborting the whole badge fetch.
- Throw a domain-specific exception (not ArgumentNullException) so callers can distinguish user-cancel from a real null bug.
Example fix
// before
if (!string.IsNullOrEmpty(result))
{
await steamSession.UnlockParental(steam_id, result);
goto GetBadges;
}
throw new ArgumentNullException(Strings.Idle_PIN_NotBeNull);
// after: re-prompt or throw a user-facing exception
if (!string.IsNullOrEmpty(result))
{
await steamSession.UnlockParental(steam_id, result);
goto GetBadges;
}
throw new OperationCanceledException(Strings.Idle_PIN_NotBeNull); Defensive patterns
Strategy: validation
Validate before calling
// Treat an empty PIN as user-cancel and handle gracefully instead of throwing.
if (string.IsNullOrEmpty(result))
{
// Re-prompt or abort the badge fetch with a clear, non-exception flow.
StatusMessage = Strings.Idle_PIN_NotBeNull;
return; // or loop the dialog a bounded number of times
}
await steamSession.UnlockParental(steam_id, result); Type guard
bool IsValidPin(string? pin) => !string.IsNullOrWhiteSpace(pin) && pin.All(char.IsDigit);
Try / catch
// Catch the misplaced ArgumentNullException so the app does not crash on cancel.
try { await FetchBadgesAsync(); }
catch (ArgumentNullException ex) when (ex.Message == Strings.Idle_PIN_NotBeNull)
{
Log.Information("User cancelled the parental PIN prompt.");
StatusMessage = Strings.Idle_PIN_NotBeNull;
} Prevention
- Distinguish 'user cancelled' (empty result) from a real error; do not throw ArgumentNullException for user input.
- Bound the number of PIN re-prompts to avoid an infinite loop.
- Throw a domain exception (e.g. OperationCanceledException) for cancel, not ArgumentNullException.
- Disable the idle feature gracefully when parental controls are active and unsatisfied.
When it happens
Trigger: Fetching badges for a Steam account with parental controls enabled; the returned status indicates parental lock; the user closes the PIN dialog or submits an empty string, so result is null/empty.
Common situations: User clicked Cancel/Close on the PIN prompt; user typed nothing and pressed OK; dialog returned null due to a UI issue; account has parental lock the user cannot satisfy.
Related errors
- no shared_secret
- no serial_number
- Failed to obtain badge information status code: {status}
- Import only supports otpauth://
- Import only supports otpauth://totp/ or otpauth://hotp/
AI-assisted analysis of BeyondDimension/SteamTools@c16ffa08e0 (2026-08-13).
Data as JSON: /api/errors/005353e0a5b9eb2e.
Report an issue: GitHub.