rumtime: aspnet:5.0-alpine
nuget: CZGL.ProcessMetrics.ASPNETCore 1.0.0
进程监控空引用异常, 这里的Process为空
|
.SetValue(processInfo.Process.HandleCount); |
[11:06:20 EROR] An unhandled exception has occurred while executing the request.
System.AggregateException: One or more errors occurred. (Object reference not set to an instance of an object.)
---> System.NullReferenceException: Object reference not set to an instance of an object.
at System.Diagnostics.Process.get_HandleCount()
at CZGL.ProcessMetrics.ProcessMetricsCore.b__15_0()
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
at CZGL.ProcessMetrics.ProcessMetricsCore.ProcessThreadsRecord()
at CZGL.ProcessMetrics.ProcessMetricsCore.GetPrometheus()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at CZGL.ProcessMetrics.Extensions.<>c.<b__0_0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
这个是偶发现象,不容易复现
网卡监控构造函数懒加载空引用异常
|
_Statistics = new Lazy<IPInterfaceStatistics>(() => _instance.GetIPStatistics()); |
System.AggregateException: One or more errors occurred. (Object reference not set to an instance of an object.)
---> System.NullReferenceException: Object reference not set to an instance of an object.
at CZGL.SystemInfo.NetworkInfo.<.ctor>b__3_3()
at System.Lazy
1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy
1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy`1.CreateValue()
at CZGL.ProcessMetrics.ProcessMetricsCore.b__12_0()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__277_0(Object obj)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---