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
- Articulation Bodies spawn at the same point on a Spline when entering the Play mode
- [HDRP] Mip Map Debugging View turns White if there are Directional Lights in the Scene
- RenderDoc Capture Frame can't be completed after Particle System is simulated
- Editor crashes when attempting to connect the client machine to the host machine
- CameraDepthTexture is flipped upside down when URP is rendering without the final blit
Add comment