{"id":250731,"date":"2024-09-24T03:00:02","date_gmt":"2024-09-24T10:00:02","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/visualstudio\/?p=250731"},"modified":"2024-09-27T09:44:53","modified_gmt":"2024-09-27T16:44:53","slug":"next-gen-code-coverage-in-visual-studio-enhanced-c-support-and-security","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/next-gen-code-coverage-in-visual-studio-enhanced-c-support-and-security\/","title":{"rendered":"Next-Gen Code Coverage in Visual Studio: Enhanced C++ Support and Security"},"content":{"rendered":"<p>We\u2019re excited to share the latest changes in Visual Studio\u2019s code coverage components. If you haven\u2019t already, be sure to check out our previous blog posts: <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/whats-new-in-our-code-coverage-tooling\/\">What\u2019s New in Our Code Coverage Tooling?<\/a> and <a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/code-coverage-features-in-visual-studio-enterprise\/\">Code coverage features in Visual Studio Enterprise<\/a>.<\/p>\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\"><div  class=\"d-flex justify-content-center\"><a class=\"cta_button_link btn-primary mb-24\" href=\" https:\/\/visualstudio.microsoft.com\/downloads\/\" target=\"_blank\">Download Visual Studio 17.11<\/a><\/div><\/p>\n<h2>C++ Code Coverage<\/h2>\n<p>Tired of instable native code coverage that doesn\u2019t support ARM64? Now, you can collect native code coverage for all your methods, including those on ARM64. We have completely overhauled the C++ code coverage support to improve reliability, performance, and security. The new implementation, powered by MSVC compiler tooling, now supports x86, x64, and ARM64 architectures. To enable the new experience, you need to enable the <a href=\"https:\/\/learn.microsoft.com\/cpp\/build\/reference\/profile-performance-tools-profiler?view=msvc-170\">\/PROFILE<\/a> linker option for all C++ projects, including both testing and production.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2024\/09\/word-image-250731-1.png\"><img decoding=\"async\" class=\"alignnone wp-image-250732 size-full\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2024\/09\/word-image-250731-1.png\" alt=\"Image showing Configuration Properties, Linker, Advanced and set Profile to Yes (\/Profile)\" width=\"1359\" height=\"955\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2024\/09\/word-image-250731-1.png 1359w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2024\/09\/word-image-250731-1-300x211.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2024\/09\/word-image-250731-1-1024x720.png 1024w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2024\/09\/word-image-250731-1-768x540.png 768w\" sizes=\"(max-width: 1359px) 100vw, 1359px\" \/><\/a><\/p>\n<p>For detailed examples, visit:<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/microsoft\/codecoverage\/blob\/main\/samples\/VisualStudio\/scenarios\/scenario06\/README.md\">Scenario 06: C++ Code Coverage in Visual Studio<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/microsoft\/codecoverage\/blob\/main\/samples\/VisualStudio\/scenarios\/scenario07\/README.md\">Scenario 07: C++ Code Coverage in Visual Studio ARM64<\/a><\/li>\n<\/ul>\n<p>This feature is available only for the MSVC compiler.<\/p>\n<h2>Introducing Microsoft.CodeCoverage.Console<\/h2>\n<p>You can use the new <strong>Microsoft.CodeCoverage.Console<\/strong> tool to collect code coverage for console applications, merge coverage reports, and instrument binaries. It can also capture code coverage for each test separately, making it an ideal choice for use in CI pipelines.<\/p>\n<p>Available in Visual Studio Enterprise through Developer PowerShell, this command-line tool extends the capabilities of the well-known <a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/additional-tools\/dotnet-coverage\">dotnet-coverage<\/a> tool, adding support for C++ code coverage and enhanced security features.<\/p>\n<p>For an example of how to use the Microsoft.CodeCoverage.Console tool, visit <a href=\"https:\/\/github.com\/microsoft\/codecoverage\/blob\/main\/samples\/VisualStudio\/scenarios\/scenario09\/README.md\">Scenario 09: C++ Code Coverage for Console Apps in Developer PowerShell for Visual Studio Enterprise.<\/a> Visit <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/whats-new-in-our-code-coverage-tooling\/#meet-dotnet-coverage2\">What\u2019s New in Our Code Coverage Tooling?<\/a> to find even more examples.<\/p>\n<p>To learn more, check out the <a href=\"https:\/\/learn.microsoft.com\/visualstudio\/test\/microsoft-code-coverage-console-tool\">Microsoft.CodeCoverage.Console documentation<\/a>.<\/p>\n<h2>Enhanced Security Features<\/h2>\n<p>You can collect code coverage for web applications running in IIS for both .NET and C++ using <strong>Microsoft.CodeCoverage.Console<\/strong>, which allows for the instrumentation of both C++ and .NET binaries. Additionally, Visual Studio code coverage components now include enhanced security features, such as controlling access to data passed through named pipes and shared memory. This security improvement also supports running web applications in IIS under different user accounts, allowing you to specify which users can access the coverage data.<\/p>\n<p>For a full example, visit <a href=\"https:\/\/github.com\/microsoft\/codecoverage\/blob\/main\/samples\/VisualStudio\/scenarios\/scenario08\/README.md\">Scenario 08: Static Code Coverage for ASP.NET Core Web Apps (Razor Pages) in IIS<\/a>.<\/p>\n<h2>Summary<\/h2>\n<p>In this update, we\u2019ve enhanced the code coverage experience in Visual Studio with a complete rewrite of C++ code coverage support, introduced the new Microsoft.CodeCoverage.Console tool, and added new security measures for managing access to shared data. These changes provide a faster, more reliable, and secure way to measure code coverage in your applications, especially when working with C++ projects.<\/p>\n<p>We appreciate the time you\u2019ve spent reporting issues\/suggestions and hope you continue to give us feedback when using Visual Studio on what you like and what we can improve. Your feedback is critical to help us make Visual Studio the best tool it can be! You can share feedback with us via\u202f<a href=\"https:\/\/developercommunity.visualstudio.com\/home%22%20\/t%20%22_blank\" target=\"_blank\" rel=\"noopener\">Developer Community<\/a>: report any bugs or issues via\u202f<a href=\"https:\/\/learn.microsoft.com\/visualstudio\/ide\/how-to-report-a-problem-with-visual-studio?view=vs-2022\" target=\"_blank\" rel=\"noopener\">report a problem<\/a>\u202fand\u202f<a href=\"https:\/\/developercommunity.microsoft.com\/VisualStudio\/suggest\" target=\"_blank\" rel=\"noopener\">share your suggestions<\/a>\u202ffor new features or improvements to existing ones.<\/p>\n<p>Stay connected with the Visual Studio team by following us on <a href=\"https:\/\/www.youtube.com\/@visualstudio\" target=\"_blank\" rel=\"noopener\">YouTube<\/a>, <a href=\"https:\/\/twitter.com\/VisualStudio\" target=\"_blank\" rel=\"noopener\">Twitter<\/a>, <a href=\"https:\/\/www.linkedin.com\/showcase\/microsoft-visual-studio\/\" target=\"_blank\" rel=\"noopener\">LinkedIn<\/a>, <a href=\"https:\/\/www.twitch.tv\/visualstudio\" target=\"_blank\" rel=\"noopener\">Twitch<\/a> and on <a href=\"https:\/\/learn.microsoft.com\/en-us\/visualstudio\/?view=vs-2022\" target=\"_blank\" rel=\"noopener\">Microsoft Learn<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We\u2019re excited to share the latest changes in Visual Studio\u2019s code coverage components. If you haven\u2019t already, be sure to check out our previous blog posts: What\u2019s New in Our Code Coverage Tooling? and Code coverage features in Visual Studio Enterprise. C++ Code Coverage Tired of instable native code coverage that doesn\u2019t support ARM64? Now, [&hellip;]<\/p>\n","protected":false},"author":137380,"featured_media":250733,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[155],"tags":[6852,6828,6815],"class_list":["post-250731","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visual-studio","tag-arm64","tag-security","tag-visual-studio-2022"],"acf":[],"blog_post_summary":"<p>We\u2019re excited to share the latest changes in Visual Studio\u2019s code coverage components. If you haven\u2019t already, be sure to check out our previous blog posts: What\u2019s New in Our Code Coverage Tooling? and Code coverage features in Visual Studio Enterprise. C++ Code Coverage Tired of instable native code coverage that doesn\u2019t support ARM64? Now, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/250731","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/users\/137380"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=250731"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/250731\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/250733"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=250731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=250731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=250731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}