Search Issue Tracker
Fixed
Votes
0
Found in
Issue ID
805846
Regression
No
Wrong exception types don't fall through in generic methods, causing invalid cast exception
Given this code, .NET and IL2CPP output differs:
using System;
using static System.Console;
class Program
{
public delegate void ActionDelegate();
static void CatchException<T>(ActionDelegate action) where T : Exception
{
try
{
action();
}
catch (T e)
{
WriteLine("Caught T: {0}", e.Message);
}
}
static void Main()
{
try
{
CatchException<NullReferenceException>(() => { throw new NotImplementedException(); });
}
catch (Exception e)
{
WriteLine("Caught something. Exception type: {0}", e.GetType());
}
}
}
>csc a.cs /nologo
>a.exe
Caught something. Exception type: System.NotImplementedException
>il2cpp.exe --outputpath=a_il2cpp.exe --cachedirectory="obj_cache" --generatedcppdir="generated_cpp" a.exe && a_il2cpp.exe
.....
Caught something. Exception type: System.InvalidCastException
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Foldout arrow indent is misaligned in the Inspector when used in Custom Type
- [Android] The Player screen turns black when playing a video under certain conditions
- Search window icons at the bottom are cut off when Search window is resized vertically
- "Try something else?" text label is cut off when searching for a long text in the Search window
- Rendering Debugger window sections do not have a minimum width set when resizing with the slider in the middle of the window
Add comment