我在生产中有一个不生成任何日志内容的例外。我们在这个catch块中已经记录好的生产错误,但由于某种原因,这个特殊的异常(我不知道它是什么)不记录任何东西。这是catch块:
//catch any exception and add it to the list of exceptions, and process next id
catch (Exception e)
{
if (exceptionMessageBuilder.Length != 0)
{
exceptionMessageBuilder.AppendLine("----------------------------------------");
}
exceptionMessageBuilder.AppendFormat("Error occurred in processing id {0}.\n", currentID);
exceptionMessageBuilder.AppendLine(e.ToString());
}
我得到的唯一输出是“处理id d455e51f-6c86-4591-b75e-a2d29be73f4c时发生错误。”该应用程序完成并将其作为电子邮件发送,因此它不会完全轰炸。
通常我会收到如下消息:
Error occurred in processing id 593abf56-5057-400e-bbfb-da819df59710.
System.ServiceModel.FaultException: The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
我有什么理由不能获得信息吗?是否可以捕获空异常?