Track when vstest provides Newtonsoft.Json for extensions in telemetry#15596
Merged
Conversation
nohwnd
commented
Mar 27, 2026
nohwnd
commented
Mar 27, 2026
nohwnd
commented
Mar 27, 2026
nohwnd
commented
Mar 27, 2026
nohwnd
commented
Mar 27, 2026
nohwnd
commented
Mar 27, 2026
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
nohwnd
commented
Mar 30, 2026
nohwnd
commented
Mar 30, 2026
nohwnd
commented
Mar 30, 2026
When an extension depends on Newtonsoft.Json but does not ship its own copy, vstest's AssemblyResolver resolves it from the test platform directory. This silently tracks such resolutions in telemetry so we can monitor how many extensions rely on vstest's bundled copy before we remove it. - Track resolved dependencies for known assemblies (Newtonsoft.Json) in AssemblyResolver.OnResolve via static ConcurrentDictionary - Filter out vstest's own internal assemblies (no false positives) - Report in telemetry as VS.TestPlatform.ProvidedAssemblyDependency.* - Add VSTEST_WARN_MISSING_EXTENSIONS_DEPENDENCIES feature flag for opt-in user-visible warnings before enforcement - Add NewtonSoftDependencyMissing test asset (ExcludeAssets=runtime) - Pass RequestingAssembly through AssemblyResolveEventArgs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ning - Track ALL resolved assemblies (not just Newtonsoft.Json) - Check against search directories (not just one dir) - Separate user vs Microsoft/System deps for telemetry privacy: user assemblies get count only (no names), Microsoft/System get names - Defer warning to run summary via LoggerManager (not inline) - Rename feature flag to VSTEST_OPTIN_WARN_MISSING_EXTENSIONS_DEPENDENCIES - Telemetry: 4 properties (User/Microsoft × assemblies/count) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add VSTEST_DISABLE_WARN_MISSING_EXTENSIONS_DEPENDENCIES flag - Disable overrides opt-in: if disable is set, no warning even with opt-in - Localize warning message via Resources.resx (ProvidedDependenciesWarning) - Update Designer.cs and xlf files Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2d42371 to
35a9399
Compare
Evangelink
approved these changes
Apr 1, 2026
This was referenced Apr 1, 2026
nohwnd
added a commit
to nohwnd/vstest
that referenced
this pull request
Apr 10, 2026
Reverts the assembly resolution tracking and warning mechanism for Newtonsoft.Json that was added in microsoft#15596. Investigation showed that: - vstest's AssemblyResolver.OnResolve never fires for Newtonsoft.Json because it is loaded via normal CLR probing before the event triggers - On .NET Framework, MSTest has its own AssemblyResolver in a separate AppDomain that resolves NJ independently from vstest's resolver - The ProvidedDependencies telemetry was always empty in practice - No feasible proactive warning mechanism exists for this scenario The [DoNotParallelize] test fixes from the same PR are preserved. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
nohwnd
added a commit
that referenced
this pull request
Apr 10, 2026
Reverts the assembly resolution tracking and warning mechanism for Newtonsoft.Json that was added in #15596. Investigation showed that: - vstest's AssemblyResolver.OnResolve never fires for Newtonsoft.Json because it is loaded via normal CLR probing before the event triggers - On .NET Framework, MSTest has its own AssemblyResolver in a separate AppDomain that resolves NJ independently from vstest's resolver - The ProvidedDependencies telemetry was always empty in practice - No feasible proactive warning mechanism exists for this scenario The [DoNotParallelize] test fixes from the same PR are preserved. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
nohwnd
added a commit
that referenced
this pull request
May 14, 2026
Cherry-pick of a74013a from main. The assembly resolution tracking and warning mechanism was proven useless — OnResolve never fires for Newtonsoft.Json because it loads via normal CLR probing. This also removes the RequestingAssembly property from PlatformAbstractions which causes MissingMethodException when older xunit adapters call into the resolver (#15765). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Extensions that depend on Newtonsoft.Json but don't ship their own copy silently use vstest's bundled copy. Before we can remove Newtonsoft.Json from vstest, we need to know how many extensions rely on this.
Solution
Silent telemetry tracking — when \AssemblyResolver\ resolves a tracked assembly (e.g. Newtonsoft.Json) from vstest's own directory for an external requester:
Test asset
\NewtonSoftDependencyMissing\ — references Newtonsoft.Json with <ExcludeAssets>runtime. The DLL is NOT in output, so vstest's copy is used at runtime.
Changes
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com