Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>They are <em>almost</em> the same.</p> <p>From the C# Language Specification, section 8.10:</p> <blockquote> <p>Some programming languages may support exceptions that are not representable as an object derived from System.Exception, although such exceptions could never be generated by C# code. A general catch clause may be used to catch such exceptions. Thus, a general catch clause is semantically different from one that specifies the type System.Exception, in that the former may also catch exceptions from other languages.</p> </blockquote> <p>Note that while C# differentiates between the two, they are effectively the same as of .NET 2.0, as noted by <a href="http://blogs.msdn.com/b/jmanning/archive/2005/09/16/469091.aspx" rel="nofollow">this blog</a>:</p> <blockquote> <p>Thanks to a recent change in the 2.0 CLR, if you had code that decided to throw, say, an int (System.Int32) somewhere, the CLR will now wrap it with a RuntimeWrappedException, and the compiler has been updated to give you that warning that the second clause above is now dead code</p> <p><code>warning CS1058: A previous catch clause already catches all exceptions. All non-exceptions thrown will be wrapped in a System.Runtime.CompilerServices.RuntimeWrappedException</code></p> <p>For how the CLR knows to do this action for your assembly, you'll notice the compiler now adds a RuntimeCompatibilityAttribute to your assemblies telling it to:<br> <code>.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = {property bool 'WrapNonExceptionThrows' = bool(true)}</code></p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload