Hello @Haowen Liu ,
Welcome to Microsoft Q&A forum.
The .runsettings file doesn’t support excluding one specific line in code coverage. This document: Include or exclude assemblies and members lists what you can exclude in a .runsettings file, by using XML elements and regular expressions.
But the functions/methods can be excluded in code coverage. There are two ways: one is using <Exclude> and <Function> elements, the other is using ExcludeFromCodeCoverage
attribute. Perhaps you can consider writing the specific lines to one function and exclude this function.
Besides, I recommend submitting a suggestion ticket on our Developer Community for this feature.
Happy coding.
Best Regards,
Tianyu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.