analysis-net icon indicating copy to clipboard operation
analysis-net copied to clipboard

Error dissasembling when handling exceptions

Open rcastano opened this issue 7 years ago • 3 comments

The following code throws an exception.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Ex1 : Exception
{

}
class Ex2 : Exception
{

}
class TestExceptionsWhen
{
    public void Main(int y)
    {
        int x = 5;
        try
        {
            x = x / y;
        }
        catch (Exception ex) when (ex is Ex1 || ex is Ex2)
        {

        }
    }
}

rcastano avatar Jul 13 '18 14:07 rcastano

The exception is also thrown in advance-pta using Analysis-Explorer.

m-carrasco avatar Jul 13 '18 15:07 m-carrasco

@edgardozoppi This is a first attempt fix the problem. It's in my fork.

https://github.com/garbervetsky/analysis-net/commit/0027733806523f749c4a5d85fdfa3ebdb4b1ff04

Probably is just a partial solution. I created two handles: one for the filter and its catch block but I treat Filters as Catch blocks (that has to be fixed)

garbervetsky avatar Jul 13 '18 18:07 garbervetsky

There seems to be a type error too in the TAC produced for this code:

  L_0027:  $s0 = $s0 > $s1;
  L_0029:  goto L_002C;
  L_002B:  $s0 = 1;
  L_002C:  local_2 = $s0;
  L_002D:  $s0 = local_2;
  L_002E:  $s1 = 0;
  L_002F:  $s0 = $s0 > $s1;

I'm not sure what the underlying cause is but I wasn't able to reproduce the problem with a simpler code snippet (such as without using the 'when' keyword).

Please confirm whether you're able to reproduce this issue and whether to file it as a separate issue.

rcastano avatar Aug 28 '18 08:08 rcastano