microsoft/playwright · error · Error

Unknown C# language mode: ${mode}

Error message

Unknown C# language mode: ${mode}

What it means

Error "Unknown C# language mode: ${mode}" thrown in microsoft/playwright.

Source

Thrown at packages/isomorphic/codegen/csharp.ts:50

  highlighter = 'csharp' as Language;
  _mode: CSharpLanguageMode;
  private _pageAliases = new Map<string, string>();

  constructor(mode: CSharpLanguageMode) {
    if (mode === 'library') {
      this.name = 'Library';
      this.id = 'csharp';
    } else if (mode === 'mstest') {
      this.name = 'MSTest';
      this.id = 'csharp-mstest';
    } else if (mode === 'nunit') {
      this.name = 'NUnit';
      this.id = 'csharp-nunit';
    } else if (mode === 'xunit') {
      this.name = 'xUnit';
      this.id = 'csharp-xunit';
    } else {
      throw new Error(`Unknown C# language mode: ${mode}`);
    }
    this._mode = mode;
  }

  reset() {
    this._pageAliases.clear();
  }

  private _pageAlias(pageGuid: string): string {
    let alias = this._pageAliases.get(pageGuid);
    if (!alias) {
      alias = 'page' + (this._pageAliases.size || '');
      // Outside of the library mode, the first page is a class member, the rest are local variables.
      if (this._mode !== 'library' && alias === 'page')
        alias = 'Page';
      this._pageAliases.set(pageGuid, alias);
    }
    return alias;

View on GitHub (pinned to c8fc3bf8d3)

When it happens

Trigger: Thrown at packages/isomorphic/codegen/csharp.ts:50 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of microsoft/playwright@c8fc3bf8d3 (2026-08-12). Data as JSON: /api/errors/3e25e7b1ae3f0b67. Report an issue: GitHub.