Bug 924 - Cannot debug any UIViewController that makes use of CATiledLayer
Summary: Cannot debug any UIViewController that makes use of CATiledLayer
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 4.x
Hardware: Other Mac OS
: --- minor
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2011-09-20 05:52 UTC by René Ruppert
Modified: 2013-12-05 18:34 UTC (History)
5 users (show)

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

sample code (1.79 KB, application/octet-stream)
2011-09-26 09:54 UTC, Sebastien Pouliot

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 René Ruppert 2011-09-20 05:52:33 UTC
Monotouch 4.2 beta

I'm working on a PDF viewer. As soon as I add a CATiledLayer for PDF rendering as a sublayer the debugger hangs.
Not adding the sublayer allows debugging. I have seen this in two projects now, total different implementations; only thing in common: CATiledLayer.
Comment 1 Sebastien Pouliot 2011-09-20 21:18:59 UTC
I have a sample that use CATiledLayer and I can set breakpoints and continue execution with it - but it's used a the Layer property itself (thru [Export]), not adding it as a sublayer (e.g. AddSublayer). However the debugger should not be hanging...

* I assume it works correctly when not debugging ?

* Could you provide attach a case that hangs the debugger ?

* Also what version of MonoDevelop are you using ?

Comment 2 Rolf Bjarne Kvinge [MSFT] 2011-09-21 03:32:25 UTC
This sounds very much like a bug that has already been fixed: if managed code was executed on a thread that wasn't created by managed code (a helper thread created by CATiledLayer, which then calls into managed code somehow), and then that thread subsequently exits for any reason, the debugger would deadlock at any later breakpoint (the debugger tries to wait for the thread that had exited to stop, which never happens because it doesn't exist anymore).

The fix for this will be in the upcoming 4.2 release.
Comment 3 René Ruppert 2011-09-21 03:48:11 UTC
I'm using Monodevelop 2.6. The problem has been there since MT 3.2.6 and MD 2.1 (?). I can see if I can get a small example but maybe easier would be to check if the problem persists in the 4.2 release. Sounds like it's going to be available soon? Or could I just give the 4.9.2 a try which should already include the fix?
Comment 4 René Ruppert 2011-09-21 03:48:32 UTC
Oh, and yes: it works of course when not debugging!
Comment 5 Rolf Bjarne Kvinge [MSFT] 2011-09-21 04:07:03 UTC
It is not fixed in the current 4.2 beta, but a new beta will very soon be released which will include it.
Comment 6 Sebastien Pouliot 2011-09-22 15:25:28 UTC
René, can you still reproduce this issue now that you have 4.2.1 installed ?
Comment 7 René Ruppert 2011-09-26 04:16:36 UTC
Yes, still same issue. Put a breakpoint in CALayerDelegate DrawLayer and the whole app hangs.
Comment 8 Sebastien Pouliot 2011-09-26 08:03:59 UTC
In my sample I can set the breakpoint on DrawLayer without issue on the device (where zooming is easier) but I found out it gets hit only a single time on the simulator (using option to simulate the zoom). Note that, in both case, the debugger never hangs on me.

Can you duplicate your issue/hang on both the simulator and devices ?
Comment 9 René Ruppert 2011-09-26 09:26:39 UTC
I can replicate on the simulator. The breakpoint is hit and then the app does not react anymore.
It seems to work on the device though. iOS 4.3.5
Comment 10 Sebastien Pouliot 2011-09-26 09:54:23 UTC
Created attachment 492 [details]
sample code

Here's part of a Apple sample (ZoomingPdfViewer) I ported to MonoTouch that shows how I used CATiledLayer. You can try to compare if anything differs from your code. If not then we'll need a test case to debug this on our side.
Comment 11 René Ruppert 2011-09-26 10:55:14 UTC
Only difference I see:
[Export ("layerClass")]
public static Class LayerClass () 
	// instruct that we want a CATileLayer (not the default CALayer) for the Layer property
	return new Class (typeof (CATiledLayer));

I add my CATiledLayer as a sub layer to an existing UIView:
oZomablePageView.Layer.AddSublayer (this.oTiledLayer);
Comment 12 Rolf Bjarne Kvinge [MSFT] 2011-12-22 19:16:02 UTC
René, when it hangs in the simulator, can you do this:

* Get the pid of the app (printed to the application output).
* Open a terminal, and execute:

gdb program <pid>
<output from gdb>
(gdb) thread apply all bt
<more output from gdb>
(gdb) quit
<gdb wants confirmation, say yes>

* Save all the output to a text file and attach it here

This will hopefully make it possible to track the hang down.
Comment 13 PJ 2013-11-19 17:04:31 UTC
This bug has been in the NEEDINFO state with no changes for the last 90 days. Can we put this back into the NEW or CONFIRMED state, or are we still awaiting response?

If there is no change in the status of this bug over the next two weeks, this bug will be marked as NORESPONSE.
Comment 14 PJ 2013-12-05 18:34:36 UTC
This bug has not been changed from the NEEDINFO state since my previous comment, marking as RESOLVED NORESPONSE.

Please feel free to REOPEN this bug at any time if you are still experiencing the issue. Please add the requested information and set the bug back to the NEW (or CONFIRMED) state.