babalae/better-genshin-impact · critical · InvalidOperationException

BvFlow 第 {i + 1} 步执行失败:{step.Description}

Error message

BvFlow 第 {i + 1} 步执行失败:{step.Description}

What it means

Thrown when the MsRdpClient10 ActiveX control's AdvancedSettings7 property returns null. AdvancedSettings7 is the IMsRdpClientAdvancedSettings8 interface that exposes RDPPort, CredSSP support, Windows-key passthrough, and SmartSizing. A null return means the control instantiated but the advanced-settings interface at version 7 is not available — indicating either an incompatible/older RDP client version or the COM object being in an invalid state.

Source

Thrown at BetterGenshinImpact/Core/BgiVision/BvFlow.cs:249

            for (var i = 0; i < steps.Length; i++)
            {
                var step = steps[i];
                try
                {
                    _services.ThrowIfCancellationRequested();
                    await step.Action(context);
                }
                catch (OperationCanceledException)
                {
                    throw;
                }
                catch (NormalEndException)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    throw new InvalidOperationException($"BvFlow 第 {i + 1} 步执行失败:{step.Description}", ex);
                }
            }

            return _page;
        }
        finally
        {
            Volatile.Write(ref _isRunning, 0);
        }
    }

    internal BvFlow AddActionStep(BvFlowActionSnapshot snapshot)
    {
        return AddStep(snapshot.Description, context => ExecuteActionStep(snapshot, context));
    }

    internal BvFlow AddOnceActionStep(string description, Func<BvFlowExecutionContext, Task> action)
    {

View on GitHub (pinned to a7cb36712d)

Solutions

  1. Check the Windows / RDP client version; AdvancedSettings7 requires RDP client 8.0+ on Windows 10.
  2. Register the latest mstscax.dll or install the latest RDP client update (KB).
  3. Gracefully degrade: try AdvancedSettings6, then AdvancedSettings5, setting only the properties each version supports.
  4. Inspect earlier RunComStep calls for silent failures that may have corrupted control state.

Example fix

// before
var advancedSettings = GetComProperty(client, "AdvancedSettings7")
    ?? throw new COMException("RDP ActiveX 未返回 AdvancedSettings7。");

// after — cascade through available versions
var advancedSettings = GetComProperty(client, "AdvancedSettings7")
    ?? GetComProperty(client, "AdvancedSettings6")
    ?? GetComProperty(client, "AdvancedSettings5");
if (advancedSettings is null)
    throw new COMException("RDP ActiveX 未返回任何 AdvancedSettings 接口。");
Defensive patterns

Strategy: type-guard

Validate before calling

// Probe the highest available AdvancedSettings version before use
var advancedSettings = GetComProperty(client, "AdvancedSettings7")
    ?? GetComProperty(client, "AdvancedSettings6")
    ?? GetComProperty(client, "AdvancedSettings5");
if (advancedSettings is null) { /* disable advanced features */ }

Type guard

static bool SupportsAdvancedSettings7(object client) =>
    GetComProperty(client, "AdvancedSettings7") is not null;

Try / catch

try { /* connect with AdvancedSettings7 */ }
catch (COMException ex) when (ex.Message.Contains("AdvancedSettings7"))
{
    // fall back to AdvancedSettings5, skip unsupported properties
}

Prevention

When it happens

Trigger: Called in ConnectToChildSession after configuring SecuredSettings2, when GetComProperty(client, "AdvancedSettings7") returns null. Happens when the registered mstscax.dll is too old to expose the AdvancedSettings7 dispatch ID, or when the ActiveX object entered an error state during earlier property sets.

Common situations: Down-level Windows (7/8/Server 2008 R2) with only AdvancedSettings through AdvancedSettings5, partially failed earlier SetComProperty calls leaving the control in a bad state, or a sandboxed/locked-down environment where COM registration is incomplete.

Related errors


AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13). Data as JSON: /api/errors/cd883ac8a5fcc5f0. Report an issue: GitHub.