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

MethodNotFoundException in GetExtern(), possibly during JIT #415

aarononeal opened this Issue Aug 25, 2013 · 0 comments


None yet
2 participants

aarononeal commented Aug 25, 2013

I ran into this issue today and wanted to document it.

void Start() {
    var x = NSApplication.NSApplicationLaunchRemoteNotificationKey;

Running that I get MethodNotFoundException.

What seems to happen is Start() is JIT compiled, NSApplicationLaunchRemoteNotificationKey is resolved, which resolves ObjectiveCRuntime.GetExtern() which internally uses GetInstanceInternal. The latter is an internal method which hasn't been registered yet because the bridge hasn't been bootstrapped because ObjectiveCRuntime.Initialize() hasn't actually executed yet. More specifically, the static constructor for ObjectiveCRuntime hasn't executed yet because Start() is still being compiled.

Moving the constant extern to a separate method works around it.

void Start() {
void CheckConstant() {
    var x = NSApplication.NSApplicationLaunchRemoteNotificationKey;

@ghost ghost assigned letiemble Aug 25, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment