I have an application with similar code (not written by me)
try { EnumerateSomeCoolHardwareDevice(); } catch (Exception ex) { }
The UPDATE . Is this .NET C # and EnumerateSomeCoolHardwareDevice () using SerialPort?
I know how bad this code is, but it works like that for a reason!
My question is you: I see that it crashes somewhere in EnumerateSomeCoolHardwareDevice (); but it doesnβt fall into Catch (...) - it just crashes with the send dialog! It also currently only happens in release builds ... Is ANY reason for them why my exception will NOT be caught by catch (...)?
, /, EnumerateSomeCoolHardwareDevice() , . , , Java .NET, , - , , , ... , , , .
EnumerateSomeCoolHardwareDevice()
, EnumerateSomeCoolHardwareDevice() . , . , :
public static void testThread() { throw new Exception("oh god it broken"); } static void Main(string[] args) { try { Thread thread = new Thread(testThread); thread.Start(); Console.ReadKey(); //Just to make sure we don't get out of the try-catch too soon } catch (Exception ex) { Console.WriteLine(ex.Message); } }
, , , .
.NET catch (Exception ex) .NET, .
catch (Exception ex)
(catching native exceptions in #) .
, .NET, EnumerateSomeCoolHardwareDevice Win32 PInvoke ( ) , Native . , (, ), (, - ) , .
assembly: RuntimeCompatibility (WrapNonExceptionThrows = true)
non.Net System.Exception, .
, dev, DLL. . DLL - .
-, EnumerateSomeCoolHardwareDevice(), , ( /) .
, Microsoft , MS, , , ( , ).
.Net 1.1, catch ,
catch{ ... }
.Net 2.0 , System.Exception.
appdomain unhandled exception , .
try..catch EnumerateSomeCoolHardwareDevice().
, , .
( Java) , Throwable. EnumerateSomeCoolHardwareDevice() , , .
, ..NET VM , , CLR. , try/catch, StackOverflowException, Debug, .
, , - , , , - ( Visual Studio, Debug/Exceptions "Thrown" "Common Language" Exuntions Runtime Exceptions ", , , catchbg.exe" catch ")
SerialPort, , , , - , . IIRC .DataReceived , , , . , .
.
? ?
, catch, ThreadAbortException.
ThreadAbortException
, StackOverflowException ExecutionEngineException.
StackOverflowException
ExecutionEngineException
( , , , ), , , , . , .
Source: https://habr.com/ru/post/1725263/More articles:LINQ puts unnecessary trailing spaces on lines - sql-serverChange FocusVisualStyle throughout the application - stylesComplex flat files in SSIS - importIs anyone developing in the cloud? (Mostly using rdp to access your devenv) - visual-studioSuggest a tool for prototyping the site structure - user-interfaceHow to block characters in EditText in Android? - androidHow to get the source url / uri of a page after sending a query manager - javahttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1725266/using-htaccess-to-redirect-domaincoukindexhtml-to-wwwdomaincouk&usg=ALkJrhj31VnCD-xFcS7-2qhxlx1vO8SwlAhow to draw a line with animation? - iphoneReplace table columns with DIV and CSS using float? - cssAll Articles