Skip to content

NativeAOT fails to catch rethrown exception in edge cases #88128

@janvorli

Description

@janvorli

The following code results in unhandled exception when compiled with NativeAOT:

class Program
{
    static void Main(string[] args)
    {
        try
        {
            throw new Exception("boo");
        }
        catch (Exception ex2)
        {
            Console.WriteLine($"1: {ex2}");
            try
            {
                throw;
                //throw new ArgumentException("aE");
            }
            catch (Exception ex3)
            {
                Console.WriteLine($"2: {ex3}");
            }
        }
    }
}

When the throw; is commented out and the throw new ArgumentException("aE"); is uncommented it works. So it is a rethrow only issue.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions