加了try的情况下线程中抛出未捕获的异常
生活随笔
收集整理的這篇文章主要介紹了
加了try的情况下线程中抛出未捕获的异常
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
一、問題描述
? 項(xiàng)目中線程中明明加了try catch 捕獲異常,但是一啟動(dòng)就報(bào)未捕獲的異常導(dǎo)致整個(gè)程序崩潰。
下面是windows中的錯(cuò)誤日志。
Application:?崗?fù)な召M(fèi).exeFramework?Version:?v4.0.30319
Description:?The?process?was?terminated?due?to?an?unhandled?exception.
Exception?Info:?System.TypeLoadException
???at?park.Booking.ReceiveEboManager.runForDev()
???at?System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
???at?System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext,?System.Threading.ContextCallback,?System.Object,?Boolean)
???at?System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,?System.Threading.ContextCallback,?System.Object,?Boolean)
???at?System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,?System.Threading.ContextCallback,?System.Object)
???at?System.Threading.ThreadHelper.ThreadStart()?
二、原因
? ?追蹤了一段時(shí)間后,通過反編譯看了源代碼? 發(fā)現(xiàn) 線程中有個(gè)需要用到的實(shí)體類? 不存在,導(dǎo)致啟動(dòng)時(shí)找不到對(duì)應(yīng)類。程序在啟動(dòng)是被還原為舊的版本了。
關(guān)鍵點(diǎn)是錯(cuò)誤日志中報(bào)了此線程中的啟動(dòng)錯(cuò)誤,但是沒有報(bào)線程中缺少實(shí)體的錯(cuò)誤,所以導(dǎo)致追蹤了很久,并且加了異常捕獲也沒有用。
轉(zhuǎn)載于:https://www.cnblogs.com/musexiaoluo/p/8370707.html
總結(jié)
以上是生活随笔為你收集整理的加了try的情况下线程中抛出未捕获的异常的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 用 Python 实现文件查找
- 下一篇: js实现旋转木马轮播图