Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Created attachment 8948 [details]
When calling an NSEvent within a MouseEntered event, there is an AssertionFailure
### Test Case
### Steps to Reproduce
1. Open attached test case
2. Run in Debug
3. Mouse over the main window
4. Notice failure in Application Output
### Error Details
>2014-12-02 16:46:39.941 MouseEnter[2838:727846] *** Assertion failure in -[NSEvent clickCount], /SourceCache/AppKit/AppKit-1343.16/AppKit.subproj/NSEvent.m:1636
>2014-12-02 16:46:39.942 MouseEnter[2838:727846] Invalid message sent to event "NSEvent: type=MouseEntered loc=(290.188,352.395) time=20614.8 flags=0x100 win=0x6e8a400 winNum=10055 ctxt=0x22283 evNum=2292 trackNum=2bb810 userData=0x0"
>2014-12-02 16:46:39.943 MouseEnter[2838:727846]
=== Xamarin Studio ===
Version 5.5.4 (build 15)
Installation UUID: 3e4348fa-e0b3-46a4-8426-58f27e19159e
Mono 3.10.0 ((detached/92c4884)
GTK+ 2.24.23 (Raleigh theme)
Package version: 310000031
=== Apple Developer Tools ===
Xcode 6.1 (6604)
=== Xamarin.iOS ===
Version: 220.127.116.11 (Business Edition)
Build date: 2014-11-16 21:03:22-0500
=== Xamarin.Android ===
Version: 18.104.22.168 (Business Edition)
Android SDK: /Users/codybeyer/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
2.1 (API level 7)
2.2 (API level 8)
2.3 (API level 10)
3.1 (API level 12)
4.0 (API level 14)
4.0.3 (API level 15)
4.1 (API level 16)
4.2 (API level 17)
4.4 (API level 19)
4.4.87 (API level 20)
Java SDK: /usr
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
=== Xamarin.Mac ===
Version: 22.214.171.124 (Business Edition)
=== Build Information ===
Release ID: 505040015
Git revision: f93940a35458a18052f1a25e106e62ca970d9c40
Build date: 2014-11-19 15:32:41-05
Xamarin addins: dc23cbd91a3a0e1d326328e1229e86c942a49ec8
=== Operating System ===
Mac OS X 10.10.1
Darwin Codys-MacBook-Pro.local 14.0.0 Darwin Kernel Version 14.0.0
Fri Sep 19 00:26:44 PDT 2014
So, I'm marking this bug invalid, as we're echoing what the underlying runtime is doing. However, I realize that isn't very helpful, so let me explain.
If you do the same thing your example does in objective-c:
You'll get the same assertion:
Now the deeper and more interesting question, is why are you seeing this. Let's take look at the documentation:
"Raises an NSInternalInconsistencyException if sent to a non-mouse event." "The return value of this method is meaningless for events other than mouse-down or mouse-up events."
Since you can send any message to any objective-c instance, and NSEvent is a base type of many events that could occur, Apple could have chosen to have "invalid" selectors, such as clickCount on an event that isn't related to clicking, act as any other does not respond message. However, Apple has chosen to throw this assert to help you figure out that you are treating this NSEvent incorrectly.
These are the only valid messages to send to any NSEvent:
The exposed C# properties are somewhat straightforward to find.
Beyond that, you need to check the type of the event and only query properties that make sense for that type.
The NSEvent API that apple exposed (and Xamarin.Mac exposed to c#) is less pleasant than many other APIs where the specific events only have properties for the valid event type.
As a side note, this also means that expanding an NSEvent inside the debugger may/will cause your application to crash. This is unfortunate, and a known issue. We're working with the XS team to fix this long term.