DesktopColorPicker NilObjectException

Feedback Case Number: 64758

I’m seeing a nightmare bug to track down but I think it’s internal to the new DesktopColorPicker control. Essentially I’m getting a NilObjectException if I use the DesktopColorPicker but only in a particular (reproducible) scenario in a complex app I have.

I can see from the Feedback app that there are a few NilObjectException bugs with the DesktopColorPicker that are marked as fixed (not yet shipped though) so I’m hoping this will be too. Unfortunately, my bug doesn’t match the other bug descriptions (hence the new bug filing).

This is part of a project I was planning on open sourcing tonight but this bug is holding me up.

Any chance @Greg_O_Lone or @Robin_Lauryssen-Mitc you could just take a look to see if the bug is fixed in whatever new build you guys are working on? If not, I’ll need to re-engineer the app to now use the DesktopColorPicker. Unfortunately, I had to re-engineer it away from SelectColor because that is also broken on Big Sur.

Here’s the stack trace:

I’ve seen this too with DesktopColorPicker, but haven’t been able to replicate it yet. Some other NilObjectExceptions were caught and fixed during the testing phase, but there’s definitely at least one still lurking in there…

1 Like

Good to know I’m not the only one suffering. Fingers crossed it can be fixed.

It’s literally the only thing holding me up right now and there is no workaround. Made even more frustrating by the fact that SelectColor is also broken on macOS.

Thanks, Garry. Would you mind sharing steps to replicate?

It’s a little complicated.

I have built a code editor from scratch in Xojo (syntax highlighting, autocomplete, undo, themable, etc) and am planning on open sourcing it. As part of this I created a project to demo it.

Part of that project uses the DesktopColorPicker to choose colours for the editor’s theme. This is the part that hard crashes. I didn’t really want to release the project until this is fixed as it reflects badly on something I’m pretty proud of.

I have submitted a bug report and attached the full project to Xojo privately so they can fix it.

Perhaps I should just release it anyway. The annoying thing is I want to do a YouTube video about it and how some of the components work but I can’t do this if if keeps crashing!

Just out of curiosity, does it actually crash or is it just dropping into the debugger? If you are able to click run afterwards and continue your app run, this issue has been fixed for the next release and it won’t actually affect your app at runtime now anyway. It’s just annoying when debugging.

Just out of curiosity, does it actually crash or is it just dropping into the debugger?

I’ve seen both in my desktop app, in that I’ve seen the debugger issue in my own testing in Xojo 2021.2.1 but some of our beta testers have submitted stack traces that show that there’s a NilObjectException being thrown. I haven’t submitted this to Feedback yet because I’ve yet to work out how to replicate it.
















-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]


-[NSTextView mouseDown:]


-[NSCell _selectOrEdit:inView:target:editor:event:start:end:]

-[NSTextFieldCell _selectOrEdit:inView:target:editor:event:start:end:]

-[NSCell editWithFrame:inView:editor:delegate:event:]


-[NSTextField mouseDown:]


-[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:]

-[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:]

-[NSWindow(NSEventRouting) sendEvent:]


-[NSApplication(NSEvent) sendEvent:]





-[NSApplication run]





-- ENDS --

I’ll peek and see what potential nil objects we have in there

Do you have any info about specific versions of macOS where this is occurring?

It drops into the debugger and I can resume but then the app immediately drops into my app’s App.UnhandledException event.

I just built the app (rather than run it from the debugger) and am able to reproduce the crash. I get an “unhandled NilObjectException” dialog.

I’m using 11.3 on an M1 Mac.

Yeah I think this issue has already been fixed for the next release.


Which is going to begin testing with us helpful beta testers very soon right… :pray:


Do you have any info about specific versions of macOS where this is occurring?

I’ve received these stack traces from both macOS 11.3.1 and 10.15.7