New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance Counters - Multi-instance or average based counters are not created properly with heat #5457

Closed
sjswoboda opened this Issue Dec 17, 2016 · 0 comments

Comments

Projects
None yet
3 participants
@sjswoboda

sjswoboda commented Dec 17, 2016

  • Which version of WiX are you building with?

3.10

  • Which version of Visual Studio are you building with (if any)?

Visual Studio 2015 Update 3

  • Which version of .NET are you building with?

4.5.2

  • Describe the problem and the steps to reproduce it.
    Heat fails to generate wxs files for multiple-instance performance counters.

heat.exe : error HEAT0001 : Category 'My Test Counters' is marked as multi-instance. Performance counters in this category can only be created with instance names.

Exception Type: System.InvalidOperationException

Stack Trace:
   at System.Diagnostics.PerformanceCounter.InitializeImpl()
   at System.Diagnostics.PerformanceCounter..ctor(String categoryName, String counterName, String instanceName, Boolean readOnly)
   at System.Diagnostics.PerformanceCounter..ctor(String categoryName, String counterName)
   at Microsoft.Tools.WindowsInstallerXml.Extensions.PerformanceCategoryHarvester.HarvestPerformanceCategory(String category)
   at Microsoft.Tools.WindowsInstallerXml.Extensions.PerformanceCategoryHarvester.Harvest(String argument)
   at Microsoft.Tools.WindowsInstallerXml.Harvester.Harvest(String argument)
   at Microsoft.Tools.WindowsInstallerXml.Tools.Heat.Run(String[] args)
  • Describe the behavior you expected and how it differed from the actual behavior.

The issue seems to be in wix3/src/ext/UtilExtension/wixext/PerformanceCategoryHarvester.cs:
PerformanceCounter pc = new PerformanceCounter(pcc.CategoryName, counter.CounterName);

That constructor is not valid for multiple-instance counters; an instance must be specified when creating it.

Additionally, because the current code loops over pcc.ReadCategory().Values, Averages-based counters will not work. Average counters require two counters to be setup, for example AverageTimer32 AND AverageBase. AverageBase. AverageBase is not returned in ReadCategory (because it's not to be used stand-alone...it doesn't even show up in perfmon), however it still must be registered.

Submitted pull request:
wixtoolset/wix3#388

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment