title: Location of unhandled exception is incorrect when debugging F# code on Visual Studio
body: <p>When debugging C# code, Visual Studio shows the original location of unhandled exception.</p>
  
  <p>For example, when debugging following code, Visual Studio shows the unhandled DivideByZeroException was thrown at line 9.</p>
  
  <pre><code>using System;
  
  namespace ConsoleApplication8
  {
      class Program
      {
          static void Func()
          {
              throw new DivideByZeroException(); // line 9
          }
  
          static void Main(string[] args)
          {
              try { Func(); }
              catch (ArgumentException) { }
          }
      }
  }
  </code></pre>
  
  <p>I want to do the same thing in F#. Following is my translation of above code into F#.</p>
  
  <pre><code>open System
  
  let f() = raise (new DivideByZeroException()) // line 3
  
  [&lt;EntryPoint&gt;]
  let main argv = 
      try 
          f()
      with :? ArgumentException -&gt; () // line 9
      0
  </code></pre>
  
  <p>When I debug this code on Visual Studio, it breaks for unhandled exception and points line 9. I expect it points line 3.</p>
  
  <p>I tried Microsoft.FSharp.Core.Operators.reraise but it didn't change the result.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>C# debug screen capture </p>
  
  <p><a href="https://i.stack.imgur.com/eU0P2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eU0P2.png" alt="Debugging screen, C#"></a></p>
  
  <p>F# debug screen capture </p>
  
  <p><a href="https://i.stack.imgur.com/YsGHS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YsGHS.png" alt="Debugging screen, F#"></a></p>
  
  <p>Generated IL for C#</p>
  
  <p><a href="https://i.stack.imgur.com/JxaLx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JxaLx.png" alt="ILSpy for C#"></a></p>
  
  <p>Generated IL for F#</p>
  
  <p><a href="https://i.stack.imgur.com/1hQnT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1hQnT.png" alt="ILSpy for F#"></a></p>