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
- Search field in UI Builder's Library has no character limit
- Changing the value in UI Builder by dragging increases it by a few thousand points when reaching the borders of the screen
- ARM64 architecture DLL incorrectly copied instead of x64 when building for Windows x64
- Crash on TypeTreeIterator::GetNode when opening a specific folder
- Crash on WriteSerializedAssetsV2 when (re)entering the Play Mode in a specific project when IEnumerator Start() is used
Add comment