Skip to content
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

iOS: Attempting to JIT compile method '(wrapper native-to-managed) void System.Net.NetworkInformation.BsdNetworkInterface/<>c__DisplayClass5_0:<GetBsdNetworkInterfaces>b__0 (intptr,Interop/Sys/IpAddressInfo*)' while running in aot-only mode. #47120

Closed
rolfbjarne opened this issue Jan 18, 2021 · 2 comments
Assignees
Labels
area-Codegen-meta-mono os-ios Apple iOS runtime-mono specific to the Mono runtime
Milestone

Comments

@rolfbjarne
Copy link
Member

Description

The following code throws an exception at runtime when running on an iOS device:

NetworkInterface.GetAllNetworkInterfaces ();

Exception:

System.ExecutionEngineException: Attempting to JIT compile method '(wrapper native-to-managed) void System.Net.NetworkInformation.BsdNetworkInterface/<>c__DisplayClass5_0:<GetBsdNetworkInterfaces>b__0 (intptr,Interop/Sys/IpAddressInfo*)' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.
    at System.Net.NetworkInformation.BsdNetworkInterface.GetBsdNetworkInterfaces()
    at System.Net.NetworkInformation.NetworkInterfacePal.GetAllNetworkInterfaces()
    at System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()
    at MySingleView.AppDelegate.FinishedLaunching(UIApplication app, NSDictionary options) in /Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/AppDelegate.cs:line 43

Repro:

git clone https://github.com/rolfbjarne/xamarin-macios
cd xamarin-macios
git checkout dotnet-attempting-to-jit-compile-method-GetBsdNetworkInterfaces
./configure --enable-dotnet
make reset
make all -j8
make install -j8
make singleview -C tests/dotnet

Complete output

Configuration

.NET 6.0.100-alpha.1.21060.3

Binlog:
MySingleView.binlog.zip

Regression?

No (new feature)

@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Net untriaged New issue has not been triaged by the area owner labels Jan 18, 2021
@ghost
Copy link

ghost commented Jan 18, 2021

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

The following code throws an exception at runtime when running on an iOS device:

NetworkInterface.GetAllNetworkInterfaces ();

Exception:

System.ExecutionEngineException: Attempting to JIT compile method '(wrapper native-to-managed) void System.Net.NetworkInformation.BsdNetworkInterface/<>c__DisplayClass5_0:<GetBsdNetworkInterfaces>b__0 (intptr,Interop/Sys/IpAddressInfo*)' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.
    at System.Net.NetworkInformation.BsdNetworkInterface.GetBsdNetworkInterfaces()
    at System.Net.NetworkInformation.NetworkInterfacePal.GetAllNetworkInterfaces()
    at System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()
    at MySingleView.AppDelegate.FinishedLaunching(UIApplication app, NSDictionary options) in /Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/AppDelegate.cs:line 43

Repro:

git clone https://github.com/rolfbjarne/xamarin-macios
cd xamarin-macios
git checkout dotnet-attempting-to-jit-compile-method-GetBsdNetworkInterfaces
./configure --enable-dotnet
make reset
make all -j8
make install -j8
make singleview -C tests/dotnet

Complete output

Configuration

.NET 6.0.100-alpha.1.21060.3

Binlog:
MySingleView.binlog.zip

Regression?

No (new feature)

Author: rolfbjarne
Assignees: -
Labels:

area-System.Net, untriaged

Milestone: -

@imhameed imhameed added area-Codegen-meta-mono os-ios Apple iOS runtime-mono specific to the Mono runtime and removed area-System.Net untriaged New issue has not been triaged by the area owner labels Jan 18, 2021
@marek-safar marek-safar added this to the 6.0.0 milestone Jan 20, 2021
@lambdageek
Copy link
Member

This is similar to #55736 - It's not an AOT compiler problem, it's a problem in the libraries not using [UnmanagedCallersOnly] or [MonoPInvokeCallback] to tell the AOT compiler that a managed function will be passed to native code and invoked from there.

This particular issue looks like it was fixed by #52192 which switched from passing lambdas to the native method, to using unmanaged function pointers.

@ghost ghost locked as resolved and limited conversation to collaborators Aug 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Codegen-meta-mono os-ios Apple iOS runtime-mono specific to the Mono runtime
Projects
None yet
Development

No branches or pull requests

4 participants