Link for code samples used in the demo
http://csharp-video-tutorials.blogspo...
Link for all dot net and sql server video tutorial playlists
http://www.youtube.com/user/kudvenkat...
This question can also be asked in a slightly different way
How to handle exceptions that occur in finally block
The exception propagates up, and should be handled at a higher level. If the exception is not handled at the higher level, the application crashes. The "finally" block execution stops at the point where the exception is thrown.
In the example below, notice that the "finally" block in "Hello()" method throws an exception. Hello() method is being called in the Main() method and we don't have any exception handling mechanism in place in the Main() method. So, the application crashes with the exception.
public class Program
{ public static void Main() { Hello(); } public static void Hello() { try { // Some code } catch { // Some code } finally { Console.WriteLine("This line will be executed"); int result = Convert.ToInt32("TEN"); Console.WriteLine("This line will NOT be executed"); } }
}
On the other hand, if you include exception handling mechanism(try/catch) in the Main() method, then you will have the opportunity to handle the exception.
public static void Main()
{ try { Hello(); } catch (Exception ex) { // Process and log the exception Console.WriteLine(ex.Message); }
}
Irrespective of whether there is an exception or not "finally" block is guaranteed to execute.
1. If the "finally" block is being executed after an exception has occurred in the try block,
2. and if that exception is not handled
3. and if the finally block throws an exception
Then the original exception that occurred in the try block is lost.
Here is an example:
public class Program
{ public static void Main() { try { Hello(); } catch (Exception ex) { Console.WriteLine(ex.Message); } } public static void Hello() { try { // This exception will be lost throw new Exception("Exception in TRY block"); } finally { throw new Exception("Exception in FINALLY block"); } }
}
asp.net core docker Part 10 What happens if finally block throws an exception | |
| 274 Likes | 274 Dislikes |
| 118,197 views views | 524K followers |
| Education | Upload TimePublished on 13 Oct 2013 |
Related keywords
wcf vs web api,ado.net core,sql server management studio,webkinz,webadvisor,craigslist nj,wcf one piece,asp.net core 3,ajax players,weber grill parts,exceptions meaning,webtoon,tutorials by hugo,csharp corner,mvc design pattern,asp.net machine account,exceptions to free speech,servers for minecraft,asp.net core dependency injection,ado.net tutorial,services angular,tryp,ajax ontario,asp.net mvc tutorial,trysten hill,asp.net cos'è,csharp assembly,tutorialspoint python,sql join,throw exception c#,tryndamere build,services briefcase,asp.net core web api,ajax jquery,wccftech,exceptions in java,craigslist ny,asp.net zero,csharp foreach,server memes,sql date format,services online,chase,serverless architecture,server resume,wcf c#,server books,tutorialspoint javascript,mvcc connect,ado.net mysql,services technologies gps,ajax deadpool,server jobs,cvs,website,mvc tutorial,try not to laugh,costco hours,trycaviar,wcf service application,throwable,tutorialspoint spring,serverless,wcf soap,exceptions to the exclusionary rule,try everything,wcf cat,wcf test client,cool math games,services & training hse colombia sas,servicestack,citibank,asp.net core identity,sql union,throw up,ajax parking,sql database,throwback time,asp.net core logging,mvconnect,asp.net guida,cunyfirst,wcf nba,csharp download,wcfi foundation,csharp online,wcf authentication,tutorials near me,http://asp.net,server 2019,ado.net descargar,web of dreams,chernobyl,serverminer,ajax cleaner,ado.net visual studio 2019,webassign,ado.net vs entity framework,exceptions definition,ado.net visual studio 2017,csharp list,sql like,asp.net mvc,exceptions c++,asp.net core tutorial,sqlite,wcfm,ajax roster,mvc architecture,http://ado.net,exceptions to attorney client privilege,try not to sing,asp.net core mvc,ajax soccer,server hosting,wcfi,ajax dish soap,capital one,server rack,tutorialspoint html,csharp interface,craigslist,webroot,tutorialspoint reactjs,ajax request,wcf dragon ball,asp.net core 2.2,tutorialspoint python 3,sql developer,webster,services transmission company sas,sql group by,asp.net core signalr,services manager,mvc framework,ajax paving,mvc near me,tutorialspoint spring boot,try not to laugh clean,mvc map,csharp online compiler,exceptions to i before e,asp.net download,sql between,ado.net c# pdf,wcf 2019 nba,services tag dell,throw exception java,try guys tour,csharp switch,exceptions to freedom of speech,ado.net ventajas y desventajas,csharpstar,wcf tutorial,throw en español,throw away significado,tutorialspoint,ajax meaning,csharp-video-tutorials.blogspot,exceptions to the hearsay rule,tutorials dojo,csharp string format,central park 5,ado.net c#,asp.net core github,server status,ajax fc,server jobs nyc,asp.net core swagger,sql formatter,credit karma,services group,server error in '/' application,services windows,asp.net core 3.0,sql injection,wcf ria services,tutorialspoint c#,calculator,ado.net entity data model,sql insert,tutorialspoint tableau,services google play apk,trysilk,sqlyog,asp.net core 3 release date,sql server,throwback traducción,throw java,server job description,try guys,try a little tenderness,tutorials by a,servicenow,webcam,mvc hours,webmd symptom,csharp array,csharp enum,ajax call,asp.net core 2. guida completa per lo sviluppatore,asp.net core,server pro,server status ffxiv,exceptions to hearsay,webcrims,cheap flights,asp.net core hosting,services sas,throw new exception java,throwing,throwback significado,tutorialspoint java,tutorialspoint java compiler,webmd,csharp to json,college football,try not to laugh videos,ado.net dataset,csharp dictionary,throwing en español,tryptophan,cnn,try except python,website builder,tutorialspoint sql,asp.net web api,server side rendering,weber grills,sql server 2017,mvc nj,tutorialspoint spark,ado.net oracle,exceptions must derive from baseexception,try guys merch,asp.net core download,csharp to vb.net,exceptions to the rule,webster bank,exceptions to search warrant,webstaurant,tutorialsystems,ajax post,services fms publish announcement,services.msc no abre,ajax jersey,csharp operator,asp.net core razor pages,trypophobia,server duties,asp.net core environment variables,csharp random,century 21,services consultores,services consulting,mvcsd,mvcsc,services.msc,ado.net pdf,asp.net core configuration,ajax marvel,sql update,asp.net tutorial,mvc medical,exceptions to warrant requirement,ado.net entity data model visual studio 2019,tryspree,wcfs international curriculum,thrown,mvc2,ado.net entity data model visual studio 2017,throwing power,chase online,wcf api,costco,server jobs near me,webex,sql meaning,exceptions to the octet rule,sql tutorial,tryst,sql commands,throws ioexception,throw away,ado.net entity framework,ajax tavern,tutorialsteacher,exceptions to statute of limitations,ajax javascript,services desk,ajax greek,csharp tutorial,mvc pattern,ado.net sql server,ado.net connection,asp.net identity,throwback thursday,mvcu,throwback,tryon nc,asp.net core middleware,exceptions synonym,throw en pasado,wcf web service,exceptions python,mvc webadvisor,web store,mvcc,exceptions to the cell theory,webmail,mvci,mvctc,
Không có nhận xét nào:
Đăng nhận xét