Missing performance counters from 64 bits processes when executing from FSI
Description
Some performance counters from 64 bits processes are missing when executing from FSI.
Repro steps
This sample will show only 32 bits process instances:
type Local = WmiProvider<"localhost"> let data = Local.GetDataContext() data.QueryExecuted.Add(printfn "Query executed: %s") let s = [for d in data.Win32_PerfFormattedData_NETFramework_NETCLRMemory-> d.Name, d.Description]
Same issue as described here: http://serverfault.com/questions/779022/wmi-query-ran-in-a-powershell-console-yields-less-results-in-32-bits-mode-than-6
In C#, here's a sample showing both 32 and 64 bits:
string wmiQuery = "select * from Win32_PerfFormattedData_NETFramework_NETCLRMemory";
var context = new ManagementNamedValueCollection();
// The following two lines are what's making it work. Comment these and 64 bits processes won't show up anymore.
context.Add("__ProviderArchitecture", 64);
context.Add("__RequiredArchitecture", true);
var options =
new ConnectionOptions() { Impersonation = ImpersonationLevel.Impersonate, EnablePrivileges = true, Context = context };
ManagementObjectSearcher searcher = new ManagementObjectSearcher(new ManagementScope("root\\CIMV2", options), new ObjectQuery(wmiQuery));
ManagementObjectCollection retObjectCollection = searcher.Get();
Expected behavior
Show all instances from both 32 and 64 bits processes.
Actual behavior
Only 32 bits process instances show up.
Known workarounds
Use 64 bits configuration to launch FSI, 'Tools/Options/F# tools/F# Interactive/64-bit F# Interactive' in Visual Studio 2015.
Related information
- Windows 10 64 bits
- .NET 4.5.2, reproducible from all versions