Closed
Description
环境
FreeSql, Version=2.0.105.0
.net5(Microsoft.NET.Sdk.Web)
说明
测试场景:关闭数据库服务器或使用错误的连接字符串。
按照以前( framework 下)的经验,在 web 进程的后台线程中访问 Console 大概率会出现异常。如果后台线程未处理这些异常,进程就崩了。
建议 ObjectPool 中使用 Debug 而不是 Console 输出「检查」日志。
异常信息
System.IO.IOException: 句柄无效。
at System.ConsolePal.WindowsConsoleStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
at System.IO.StreamWriter.Write(String value)
at System.IO.TextWriter.SyncTextWriter.Write(String value)
at System.Console.Write(String value)
at FreeSql.Internal.ObjectPool.ObjectPool`1.<>c__DisplayClass23_0.<CheckAvailable>b__0()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Metadata
Metadata
Assignees
Labels
No labels