You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.Net uses Registry apis to get the list of performance counters and their properties.
We generally retrieve a byte array and then we parse it to get the values of all the desired data.
The windows performance counter belongs to 2 categories i.e V1 and V2 (Generally contain performance counters added after windows vista)
.Net code works perfectly fine with the V1 counterset but is not so reliable with V2 counterset. Windows tried to make these v2 counterset work with registry apis for backwards compatibility.
One such issue is that pcc.GetInstanceNames is not returning the instance names correctly for "SMB Client Shares" Counter set. It is V2 counterset added in windows 8.1
The workaround is to use pdh library provided by the windows to read these counters, However there is no .Net wrapper for it.
How to resolve
In order to find the actual culprit i.e if the problem is in windows registry apis (added for back compat) or .NET parsing the byte array code. we will have to directly call these registry apis and verify the byte array returned.
update
You must have a network share open eg in file explorer to get a repro
cc @danmosemsft
The text was updated successfully, but these errors were encountered:
I talked with Doug(handles all the performance counter stuff) on the windows team. They are happy to help if there is any bug with the windows api but we first need to confirm that we are parsing it correctly and give them a repro with just the windows registry apis (Without the .Net Wrapper)
This is actually a bug in the "SMB Client Shares" counterset. It doesn't handle wildcard queries correctly. The bug has already been addressed in the Windows product and a fix is expected to be available in a future version of Windows.
The .NET API uses the registry access, and the registry access uses the low-level V2 APIs to create a wildcard query, and the wildcard query is handled incorrectly, so you get incomplete results.
The PDH API uses the low-level V2 APIs to make a list of instances and then uses the low-level V2 APIs to create one non-wildcard query for each instance, and the non-wildcard queries are handled correctly, so you get complete results.
.Net uses Registry apis to get the list of performance counters and their properties.
We generally retrieve a byte array and then we parse it to get the values of all the desired data.
The windows performance counter belongs to 2 categories i.e V1 and V2 (Generally contain performance counters added after windows vista)
.Net code works perfectly fine with the V1 counterset but is not so reliable with V2 counterset. Windows tried to make these v2 counterset work with registry apis for backwards compatibility.
One such issue is that pcc.GetInstanceNames is not returning the instance names correctly for "SMB Client Shares" Counter set. It is V2 counterset added in windows 8.1
Steps to repro
Actual output
Expected output
workaround
The workaround is to use pdh library provided by the windows to read these counters, However there is no .Net wrapper for it.
How to resolve
In order to find the actual culprit i.e if the problem is in windows registry apis (added for back compat) or .NET parsing the byte array code. we will have to directly call these registry apis and verify the byte array returned.
update
You must have a network share open eg in file explorer to get a repro
cc @danmosemsft
The text was updated successfully, but these errors were encountered: