Tek bir try ile sardık.
Stack Trace:
at caException.Program.f_Bol(Int32 a, Int32 b) in D:\Projeler\caException\caException\Program.cs:line 23
at caException.Program.Main(String[] args) in D:\Projeler\caException\caException\Program.cs:line 17
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Stack Trace:
at caException.Program.f_Bol(Int32 a, Int32 b) in D:\Projeler\caException\caException\Program.cs:line 29
at caException.Program.Main(String[] args) in D:\Projeler\caException\caException\Program.cs:line 17
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Oysa birincisinde hata satırını cuk diye alıyorduk. Demek ki yapmamız gereken şey, kritik eylem satırlarını kendi içinde bir try catch bloğuna sarmalıyız.