Bug 408 - Infinite loop in MonoMac.ObjCRuntime.Class.Lookup() with NSProxy subclass
Summary: Infinite loop in MonoMac.ObjCRuntime.Class.Lookup() with NSProxy subclass
Alias: None
Product: MonoMac
Classification: Desktop
Component: Bindings ()
Version: GIT
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2011-08-25 07:37 UTC by Dan Fry
Modified: 2012-11-16 15:48 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Reproduces the infinite loop detailed in the bug description (22.86 KB, application/zip)
2011-08-25 07:37 UTC, Dan Fry

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Dan Fry 2011-08-25 07:37:50 UTC
Created attachment 185 [details]
Reproduces the infinite loop detailed in the bug description

The method MonoMac.ObjCRuntime.Class.Lookup() enters an infinite loop when looking up an object whose root superclass is not registered with MonoMac, for example NSProxy.

One real-world example of this occurs when generating a print preview in the standard Print panel and trying to obtain the current graphics context using NSGraphicsContext.CurrentContext. The object returned is a subclass of NSProxy, not NSObject.

The attached MD project reproduces the bug.

I am using OS X 10.6.8, MonoMac from git, MonoDevelop 2.6RC2 and MonoMac add-in
Comment 1 Sebastien Pouliot 2012-11-16 15:48:03 UTC
This was likely fixed a while ago. Running the attachment now throws:

System.ArgumentException has been thrown
Could not find a valid superclass for type NSPrintPreviewGraphicsContext. Did you forget to register the bindings at MonoMac.ObjCRuntime.Class.Register() or call NSApplication.Init()?