Skip to content

DevServer workspace resolution becomes Ambiguous in mono-repo with submodules (multiple global.json roots) #139

Open

Description

@xperiandri

Current behavior

uno-devserver disco --json returns:

  • resolutionKind: "Ambiguous"
  • selectedSolutionPath: null
  • error: "Workspace could not be resolved."

in repositories that contain nested git submodules with their own global.json + solution files.

This is common in mono-repos where submodules are intentionally buildable on their own.

Expected behavior

When started from repo root (or from IDE workspace root), DevServer should prefer the solution for that root workspace and not compete with nested submodule workspaces.

At minimum, resolver should provide deterministic preference order, e.g.:

  1. solution under requested working directory root
  2. direct root candidate before nested submodule candidates

Also acceptable: explicit config to pin preferred solution (for example uno.devserver.json).

Which tool(s) are affected?

Visual Studio Extension

Minimal repro

Structure:

/MySolution
├── global.json
├── MySolution.slnx                   <- intended solution
├── SubmoduleA/                       <- git submodule
│   ├── global.json
│   └── SubmoduleA.slnx
├── SubmoduleB/                       <- git submodule
│   ├── global.json
│   ├── SubmoduleB.sln
│   └── Samples.sln
└── SubmoduleC/                       <- git submodule
    ├── global.json
    └── SubmoduleC.sln

Run from root:

uno-devserver disco --json

Result: Ambiguous, no selected solution.

Why this happens

Resolver scores solution candidates by nearest global.json distance.
In submodule layouts, root solution and nested submodule solutions can all get equal best score (or otherwise tie), so resolver cannot choose and returns Ambiguous.

Real-world impact

DevServer startup fails in valid mono-repo/submodule setups unless users apply destructive local hacks (e.g. deleting nested global.json).
WebAssembly target cannot be selected and run correctly.

Requested fix

Please make workspace resolution submodule-aware and root-aware:

  • prioritize requested workspace root solution over nested submodule solutions
  • keep nested submodules as independent workspaces only when explicitly targeted
  • optionally add config-based pinning of preferred solution path

Environment

  • Uno CLI: 6.6.176
  • Uno.Sdk: 6.6.33
  • IDE: Visual Studio Enterprise 2026 (18.9.0-insiders)
  • OS: Windows 11

Activity

  1. added
    triage/untriaged
    on Jul 26, 2026
  2. changed the title [-]DevServer workspace resolution returns Ambiguous when repo contains multiple .slnx files at same GlobalJsonDistance[/-] [+]DevServer workspace resolution becomes Ambiguous in mono-repo with submodules (multiple `global.json` roots)[/+] on Jul 28, 2026
  3. xperiandri commented on Jul 28, 2026

    @xperiandri
    Author

    @agneszitte could you classify the issue and route to the right person?

  4. xperiandri commented on Sep 23, 2026

    @xperiandri
    Author

    Proposed fix: deterministic tie-break for workspace resolution

    Root cause

    The resolver scores candidates purely by distance to the nearest global.json. In a mono-repo with submodules, a root solution and a nested submodule solution can land on equal scores, so the resolver has no way to break the tie and returns Ambiguous.

    Suggested resolution order

    1. Explicit override (checked first, short-circuits everything else)
      If uno.devserver.json exists with a solutionPath, use it directly and skip scoring entirely.

      {
        "solutionPath": "./MySolution.slnx"
      }
    2. Distance to global.json (existing behavior, unchanged)

    3. Tie-break 1 – repo root vs. submodule
      Read .gitmodules at the resolved repo root (or run git submodule status) to get the set of known submodule paths. Any candidate located inside a submodule path is deprioritized relative to a candidate at the root. This directly resolves the reported repro (root + SubmoduleA/B/C).

    4. Tie-break 2 – naming convention
      If still tied (e.g., multiple non-submodule siblings), prefer a solution file whose name matches its containing directory (MySolution.slnx inside MySolution/).

    5. Tie-break 3 – deterministic fallback
      If still tied, pick alphabetically by relative path instead of throwing Ambiguous. A stable, reproducible choice is strictly better than a hard failure – it can always be overridden via step 1.

    Why this fixes the reported case

    The repro tree has one root global.json + three submodules each with their own global.json/.sln. Today they tie on distance. Detecting submodule membership via .gitmodules is cheap (no extra I/O beyond a file read already needed for git operations) and gives a correct, non-destructive signal – no need to delete nested global.json files as a workaround.

    Compatibility

    • Non-submodule mono-repos are unaffected (tie-break 1 only fires when submodules exist).
    • uno.devserver.json is purely additive and opt-in.
    • Removes a hard failure mode (Ambiguous / selectedSolutionPath: null) in favor of a deterministic pick, with an explicit override always available for edge cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty/tbdtool/Hot Design®triage/untriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions