Bug 28294 - Bug when overridding NSView.SetFrameSize
Summary: Bug when overridding NSView.SetFrameSize
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) ()
Version: 1.12.0
Hardware: Macintosh Mac OS
: High normal
Target Milestone: 2.0.x
Assignee: Chris Hamons
Depends on:
Reported: 2015-03-21 14:22 UTC by Jon Lipsky
Modified: 2015-03-27 06:46 UTC (History)
2 users (show)

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

Test case to reproduce the issue. (15.20 KB, application/zip)
2015-03-21 14:23 UTC, Jon Lipsky

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 Jon Lipsky 2015-03-21 14:22:32 UTC
If you override the "SetFrameSize" method of NSView, the "height" field of the newSize argument is always 0 (the actual height is lost), thus your view won't render since it's resulting height is 0.

This is a new bug in the 1.12.x version of Xamarin.Mac (I just upgraded to, as this had been working in previous versions of Xamarin.Mac and MonoMac before that.

I have attached a sample to reproduce the problem.  The "CustomView" class in the sample overrides "SetFrameSize", and thus the view doesn't render.  If you comment out that method you'll see the view get's it's frame set correctly, and with then render correctly.

This method is useful to only invalidate portions of the view during a live resize, and while I can work around the issue in the short term, it has performance implications for me.
Comment 1 Jon Lipsky 2015-03-21 14:23:07 UTC
Created attachment 10442 [details]
Test case to reproduce the issue.
Comment 2 Chris Hamons 2015-03-23 10:57:52 UTC

There is a 64-bit specific marshaling bug that you've run into. Please install this version of Xamarin.Mac:


and rebuild. That should fix the problem. 

Sorry for the trouble. It is already fixed in the next version of Xamarin.Mac.
Comment 3 Rajneesh Kumar 2015-03-25 09:38:30 UTC

I have downloaded the fixed build from the link provided in the comment 2 and tried to verify this issue . But I observed that on running the attached sample, getting exception and application quit unexpectedly. Please refer the screencast: http://www.screencast.com/t/vSMTAoQyP83r

Build Info: https://gist.github.com/Rajneesh360Logica/385e95495a700e601bd7
Application Output: https://gist.github.com/Rajneesh360Logica/b1d7b6745b67a4237b57

Please please let me know what I am missing to check this issue ?
Comment 4 Chris Hamons 2015-03-26 16:43:56 UTC

Could you retest with the latest cycle 5 build? Maybe test on 10.10 machine to compare? I'm seeing both that build and cycle 5 both work.
Comment 5 Jon Lipsky 2015-03-26 16:56:51 UTC

As an FYI, that build fixed the issue for me.
Comment 6 Chris Hamons 2015-03-26 17:00:08 UTC
Awesome Jon, good to know.

Just FYI - Rajneesh is part of our awesome QA group who goes behind resolved bugs and validates the fix really still works so we don't regress on a fix we think is in. There was some confusion on which upcoming build has the fix I sent you.
Comment 7 Rajneesh Kumar 2015-03-27 06:46:49 UTC
As per @Jon comment 5 this issue has been fixed and working fine .
Hence I am closing this issue.