<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Menlo;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"\@Menlo";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:"Calibri",sans-serif;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoPlainText">I know you don't usually want to catch & throw, because you're not adding new information. If you want to add new information, generally you should throw a new exception and include an InnerException. Here are some examples of situations
 you would want to catch and rethrow:<o:p></o:p></p>
<p class="MsoPlainText"><a href="https://msdn.microsoft.com/en-us/library/0yd65esw.aspx">https://msdn.microsoft.com/en-us/library/0yd65esw.aspx</a><o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">I also know you destroy the stack trace if you explicitly name the exception you're rethrowing. In order to preserve the stack, you should throw without any arguments.<o:p></o:p></p>
<p class="MsoPlainText"><a href="https://msdn.microsoft.com/en-us/library/ms182363.aspx">https://msdn.microsoft.com/en-us/library/ms182363.aspx</a><o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">I know the difference between a debug build and release build, particularly with regards to optimizations and inlining.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoNormal">In a debug build, the following code behaves as expected (prints out the full stack trace) on .NET, but doesn't print out the full stack on mono 4.2.3. I'm pretty sure it's not an expected behavior.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Menlo;color:#009695">using</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333"> System;<br>
<br>
</span><span style="font-size:12.0pt;font-family:Menlo;color:#009695">namespace</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333"> FunWithRethrow<br>
{<br>
      </span><span style="font-size:12.0pt;font-family:Menlo;color:#009695">class</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333">
</span><span style="font-size:12.0pt;font-family:Menlo;color:#3364A4">MainClass<br>
</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333">      {<br>
            </span><span style="font-size:12.0pt;font-family:Menlo;color:#009695">public</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333">
</span><span style="font-size:12.0pt;font-family:Menlo;color:#009695">static</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333">
</span><span style="font-size:12.0pt;font-family:Menlo;color:#009695">void</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333"> Main (</span><span style="font-size:12.0pt;font-family:Menlo;color:#009695">string</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333">[]
 args)<br>
            {<br>
                  </span><span style="font-size:12.0pt;font-family:Menlo;color:#009695">try</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333"> {<br>
                        Third ();<br>
                  }<br>
                  </span><span style="font-size:12.0pt;font-family:Menlo;color:#009695">catch</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333"> (</span><span style="font-size:12.0pt;font-family:Menlo;color:#3364A4">Exception</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333">
 e) {<br>
                        </span><span style="font-size:12.0pt;font-family:Menlo;color:#3364A4">Console</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333">.WriteLine (e);<br>
                  }<br>
            }<br>
            </span><span style="font-size:12.0pt;font-family:Menlo;color:#009695">static</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333">
</span><span style="font-size:12.0pt;font-family:Menlo;color:#009695">void</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333"> Third()<br>
            {<br>
                  Second ();<br>
            }<br>
            </span><span style="font-size:12.0pt;font-family:Menlo;color:#009695">static</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333">
</span><span style="font-size:12.0pt;font-family:Menlo;color:#009695">void</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333"> Second()<br>
            {<br>
                  </span><span style="font-size:12.0pt;font-family:Menlo;color:#009695">try</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333"> {<br>
                        First();<br>
                  }<br>
                  </span><span style="font-size:12.0pt;font-family:Menlo;color:#009695">catch</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333"> {<br>
                        </span><span style="font-size:12.0pt;font-family:Menlo;color:#009695">throw</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333">;<br>
                  }<br>
            }<br>
            </span><span style="font-size:12.0pt;font-family:Menlo;color:#009695">static</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333">
</span><span style="font-size:12.0pt;font-family:Menlo;color:#009695">void</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333"> First()<br>
            {<br>
                  </span><span style="font-size:12.0pt;font-family:Menlo;color:#009695">throw</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333">
</span><span style="font-size:12.0pt;font-family:Menlo;color:#009695">new</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333">
</span><span style="font-size:12.0pt;font-family:Menlo;color:#3364A4">Exception</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333"> (</span><span style="font-size:12.0pt;font-family:Menlo;color:#F57D00">"Something said... Not good..."</span><span style="font-size:12.0pt;font-family:Menlo;color:#333333">);<br>
            }<br>
      }<br>
}<br>
<br>
</span><o:p></o:p></p>
</div>
</body>
</html>