-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[mono] Using Linq.Expressions on iOS crashes unless interpreter is enabled when migrating from xamarin to .NET #94063
Comments
Tagging subscribers to this area: @cston Issue DetailsDescriptionI'm migrating a multi platform game engine from prior to .NET Core/5/6/7/8 era to .NET7. The following code is crashing on iOS, unless I use internal static Func<object, int, object, bool> MakeChecker_Crashing(MethodInfo m)
{
var pObj = Expression.Parameter(typeof(object));
var pIndex = Expression.Parameter(typeof(int));
var pItem = Expression.Parameter(typeof(object));
var e = Expression.Call(Expression.Convert(pObj, m.DeclaringType), m, pIndex, pItem);
return Expression.Lambda<Func<object, int, object, bool>>(e, pObj, pIndex, pItem).Compile();
} The exception is
However it didn't crash in xamarin-ios prior to .NET7 migration. Interestingly, the following doesn't crash without interpreter: public static Func<object, object, bool> MakeChecker_NotCrashing(Type tObj, string methodName)
{
var fn = tObj.GetMethod(methodName);
var p = Expression.Parameter(typeof(object));
var pf = Expression.Parameter(typeof(object));
var e = Expression.Call(Expression.Convert(p, tObj), fn);
return Expression.Lambda<Func<object, object, bool>>(e, p, pf).Compile();
} I've made a repo with repro (see repro steps). The code is in Enabling interpreter adds to application size, in case of empty project using our game engine it's 4.4Mb which is a lot, considering game project teams are always hitting the wall of Apple's application size limit for metered connections. In such context even 100Kb is a lot. Side note: Default single view iOS application grew in size quite considerably, see picture: Reproduction Steps
Expected behaviorI'm really not sure if this is an expected breaking change or not. Actual behaviorThe crash. Regression?No response Known WorkaroundsNo response Configuration
Other informationNo response
|
Tagging subscribers to 'os-ios': @steveisok, @akoeplinger, @kotlarmilos Issue DetailsDescriptionI'm migrating a multi platform game engine from prior to .NET Core/5/6/7/8 era to .NET7. The following code is crashing on iOS, unless I use internal static Func<object, int, object, bool> MakeChecker_Crashing(MethodInfo m)
{
var pObj = Expression.Parameter(typeof(object));
var pIndex = Expression.Parameter(typeof(int));
var pItem = Expression.Parameter(typeof(object));
var e = Expression.Call(Expression.Convert(pObj, m.DeclaringType), m, pIndex, pItem);
return Expression.Lambda<Func<object, int, object, bool>>(e, pObj, pIndex, pItem).Compile();
} The exception is
However it didn't crash in xamarin-ios prior to .NET7 migration. Interestingly, the following doesn't crash without interpreter: public static Func<object, object, bool> MakeChecker_NotCrashing(Type tObj, string methodName)
{
var fn = tObj.GetMethod(methodName);
var p = Expression.Parameter(typeof(object));
var pf = Expression.Parameter(typeof(object));
var e = Expression.Call(Expression.Convert(p, tObj), fn);
return Expression.Lambda<Func<object, object, bool>>(e, p, pf).Compile();
} I've made a repo with repro (see repro steps). The code is in Enabling interpreter adds to application size, in case of empty project using our game engine it's 4.4Mb which is a lot, considering game project teams are always hitting the wall of Apple's application size limit for metered connections. In such context even 100Kb is a lot. Side note: Default single view iOS application grew in size quite considerably, see picture: Reproduction Steps
Expected behaviorI'm really not sure if this is an expected breaking change or not. Actual behaviorThe crash. Regression?No response Known WorkaroundsNo response Configuration
Other informationNo response
|
@rotanov thank you for reporting this issue and providing detailed repro steps. I managed to reproduce the issue with .NET8-rc2 release as well (for this reason I slightly modified the title). |
We don't have capacity to address this in .NET 9. Moving to .NET 10 |
Description
I'm migrating a multi platform game engine from prior to .NET Core/5/6/7/8 era to .NET7.
The following code is crashing on iOS, unless I use
<MtouchInterpreter>-all</MtouchInterpreter>
The exception is
However it didn't crash in xamarin-ios prior to .NET7 migration.
Interestingly, the following doesn't crash without interpreter:
I've made a repo with repro (see repro steps). The code is in
AppDelegate.cs
Enabling interpreter adds to application size, in case of empty project using our game engine it's 4.4Mb which is a lot, considering game project teams are always hitting the wall of Apple's application size limit for metered connections. In such context even 100Kb is a lot.
Side note:
Default single view iOS application grew in size quite considerably, see picture:
Reproduction Steps
xamarin-ios/xamarin-ios.sln
on a device (I've used iPhone XR)net/net7.sln
on a deviceExpected behavior
I'm really not sure if this is an expected breaking change or not.
Actual behavior
The crash.
Regression?
No response
Known Workarounds
No response
Configuration
Other information
No response
The text was updated successfully, but these errors were encountered: