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
- "Draw Additional Lights Shadowmap" calls increase when custom MaterialBlockProperty is used
- Crash on _platform_memmove when importing the "Dragon Crashers - URP 2D Sample Project" to a new 2D project
- "Shader is not supported on this GPU" warnings and and shaders are not loading when building the project for non-Chromium browsers
- [iOS][URP] The screen flickers and the "Execution of the command buffer was aborted due to an error during execution" error is thrown continuously
- Shortcut Manager shows empty conflict filter when resolving runtime conflicts involving different contexts
Add comment