Lightweight vs Full Solution Load for Mixed‑Language Solutions: Does Project Count or Language Type Drive Automatic Threshold?
0 reputation · 25 Mar 2022, 22:23 UTC
0 reputation · 25 Mar 2022, 22:23 UTC
Visual Studio automatically switches to Lightweight Solution Load when a solution exceeds a project‑count threshold, defaulting to 25 projects in VS 2022. For solutions that mix C++ and C# projects, it is unclear whether the threshold evaluates only the total number of projects or also the language type, leading to inconsistent activation and on‑demand loading latency during concurrent access such as Live Share.
The key decision involves identifying the exact criteria that trigger Lightweight Load and how language composition influences that behavior, while respecting the undocumented heuristic and its impact on extensions that assume full loading. Does the automatic threshold consider project language type or solely project count? How does the threshold adapt when a solution contains both C++ and C# projects? Is there a documented way to influence this decision beyond manually toggling Lightweight Load per solution?
34775 reputation · 26 Mar 2022, 07:25 UTC
Short answer: the automatic switch to Lightweight Solution Load in Visual Studio 2022 is driven by the total project count only. The default threshold is 25 projects, and the loader does not weight or differentiate C++ versus C# (or any other project type) when evaluating it. A solution of 13 C++ and 12 C# projects behaves identically, for threshold purposes, to 25 C# projects.
The likely explanation is architectural: the threshold check runs against the solution file's project list before any project system is activated. Language-specific project systems (CPS for C#, the C++ project system, etc.) only come into play afterwards, loading projects on demand once lightweight mode is in effect. At the moment the decision is made, Visual Studio simply hasn't loaded the machinery that would let it reason about language composition — so a pure count is all it has. This is a reasonable inference rather than a documented guarantee; Microsoft has not published the full heuristic, so treat the "count only" model as the best-supported working assumption.
If you see Lightweight Load engage inconsistently across mixed-language solutions, the cause is almost certainly not language mix. More plausible culprits:
%LocalAppData%\Microsoft\VisualStudio\<version>\ActivityLog.xml for entries mentioning Lightweight Solution Load to confirm the trigger point.If activation in your environment fires at a different count than expected, the one diagnostic detail worth capturing is the exact project count Visual Studio reports (Solution Explorer counts solution folders differently from projects — folders don't count, but shared projects and some project flavors may).
There is no documented way to bias the threshold by language. Your supported options are:
HKCU\Software\Microsoft\VisualStudio\<version>, e.g. a SolutionLoad threshold value). This is unsupported, version-specific, and may break with updates — test before relying on it, and expect it to affect all solutions on that machine.The on-demand loading latency you see during concurrent access is the real consequence of lightweight mode: extensions that enumerate projects at solution-open time will find some projects not yet activated. The robust fix is on the extension side — subscribe to solution/project load events (e.g., IVsSolution load notifications or CPS project-loaded callbacks) instead of assuming full availability at open. For Live Share scenarios where latency is disruptive, the pragmatic workaround is forcing full load for that specific solution rather than raising the global threshold.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.