Fix TreatDiscoveryWarningsAsErrors to throw exception instead of just logging#6202
Closed
Fix TreatDiscoveryWarningsAsErrors to throw exception instead of just logging#6202
Conversation
… in different parts (#6164) Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Evangelink <[email protected]> Co-authored-by: Amaury Levé <[email protected]>
… methods (#6178) Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Evangelink <[email protected]>
Co-authored-by: Evangelink <[email protected]>
…e tests Co-authored-by: Evangelink <[email protected]>
Co-authored-by: Evangelink <[email protected]>
Copilot
AI
changed the title
[WIP]
Fix TreatDiscoveryWarningsAsErrors to throw exception instead of just logging
Jul 28, 2025
TreatDiscoveryWarningsAsErrors should throw instead of sending message
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.
The
TreatDiscoveryWarningsAsErrorssetting was not guaranteeing test run failure when discovery warnings occurred. Previously, it only changed the log level from Warning to Error but didn't actually fail the test run.Problem
When
TreatDiscoveryWarningsAsErrorswas enabled in MSTest settings, discovery warnings would be logged as errors but the test discovery would continue normally. This meant that issues like missing test assemblies or other discovery problems might not cause the test run to fail as expected.Solution
Modified
UnitTestDiscoverer.DiscoverTestsInSource()to throw anAdapterSettingsExceptionwhenTreatDiscoveryWarningsAsErrorsis true and warnings are present. This ensures that:Changes
Example
With these changes, discovery warnings will now cause test runs to fail immediately rather than just being logged as errors.
Fixes #5992.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
37cvsblobprodcus359.vsblob.vsassets.iodotnet build(dns block)4zjvsblobprodcus390.vsblob.vsassets.iodotnet build(dns block)7devsblobprodcus323.vsblob.vsassets.iodotnet build(dns block)l49vsblobprodcus358.vsblob.vsassets.iodotnet build(dns block)ljcvsblobprodcus317.vsblob.vsassets.iodotnet build(dns block)sqdvsblobprodcus333.vsblob.vsassets.iodotnet build(dns block)st8vsblobprodcus339.vsblob.vsassets.iodotnet build(dns block)ytvvsblobprodcus310.vsblob.vsassets.iodotnet build(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.