Tx icon indicating copy to clipboard operation
Tx copied to clipboard

Unhandled exception. System.Exception: PDH_CSTATUS_NO_OBJECT

Open swasheck opened this issue 3 years ago • 0 comments

Getting PDH_CSTATUS_NO_OBJECT error when attempting to parse blg files

Unhandled exception. System.Exception: PDH_CSTATUS_NO_OBJECT
   at Tx.Windows.PdhUtils.CheckStatus(PdhStatus actualStatus, PdhStatus[] expectedStatus)
   at Tx.Windows.PdhUtils.GetCounterAndInstanceList(String logFilename, String machineName, String objectName, List`1& counterList, List`1& instanceList)
   at Tx.Windows.PdhUtils.GetCounterPaths(String dataSource)
   at Tx.Windows.PerfCounterFileReader..ctor(IObserver`1 observer, String file)
   at Tx.Windows.PerfCounterObservable.<>c__DisplayClass0_0.<FromFile>b__0(IObserver`1 o)
   at System.Reactive.AnonymousObservable`1.SubscribeCore(IObserver`1 observer) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\AnonymousObservable.cs:line 37
   at System.Reactive.ObservableBase`1.ScheduledSubscribe(IScheduler _, AutoDetachObserver`1 autoDetachObserver) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\ObservableBase.cs:line 82
--- End of stack trace from previous location ---
   at System.Reactive.PlatformServices.ExceptionServicesImpl.Rethrow(Exception exception) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\ExceptionServicesImpl.cs:line 16
   at System.Reactive.ExceptionHelpers.ThrowIfNotNull(Exception exception) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\ExceptionServices.cs:line 20
   at System.Reactive.Linq.ObservableImpl.GetEnumerator`1.MoveNext() in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\GetEnumerator.cs:line 70

Code that causes the error:

var rawcounters = PerfCounterObservable.FromFile(filename);
int count = rawcounters.Count().Wait();

swasheck avatar Jan 26 '22 03:01 swasheck