Dockbar not created (Rhino 6, C++ sdk)

Hello! I am porting our plugin from Rhino5 to Rhino6. While porting dockbar functionality, I found out that I cannot create it and do not know why. Basically, I got NULL pointer when I call dockbar creation dialog and then soon Rhino crashes with call stack going somewhere to Rhino internals. I am creating dockbar as stated in samples:
m_pDockBar = ::RhinoUiDockBarManager().CreateRhinoDockBar(
RUNTIME_CLASS(CTreeDockBar), PlugInID(), false, AFX_IDW_DOCKBAR_RIGHT, CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT, NULL,
CBRS_TOOLTIPS | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_LEFT);

Sample application works fine, but when I have copied the sources of sample dockbar class and dockbardialog, an attempt of creating sampledockbar also results in NULL pointer. Which might help identifying the problem is that the sample application initialises dockbar when the command is called, while in our application the plugin is initialised with initialisation of Rhino.

What can be helpful: in the documentation I hae found that CreateDockBarControls should not return false otherwise I would get NULL; this function is never called in our code even though it is declared and overriden.

Can anyone point me out what could be wrong please?

Hi @gundersen

The 'SampleDockbarsample, in theSampleUserInterface` project, of the developer samples seems to work.

https://github.com/mcneel/rhino-developer-samples/tree/6/cpp/SampleUserInterface

Does it work for you?

I should add that most have abandoned the old-school dockbars for the new tabbed panels.

– Dale

Hello Dale,

The SampleDockBar works inside SampleUserInterface project. But as soon as I insert the code into my project it stops working with the same reason: CreateRhinoDockBar returns NULL pointer. Maybe it is because initialisation code is called in different times as I mentioned in my previous message. Or maybe I just messed up with resources. My question was really the reasons CreateRhinoDockBar returns NULL except CreateDockBarControls returning false.

I will try new tabbed panel instead as you advised, thank you.

Eventually I found out what was going on, so I can share that with everyone else. The problem was not because of the old tabbed panel or the new one. The problem was because of project configurations.
The problem which I had appeared only in Debug configuration of the solution, because _DEBUG was defined and RHINO_DEBUG_PLUGIN wasn’t. If I used both, stdafx.h would complaint, in all the samples for Rhino 6 it contains #pragma which prevents to use both at the same time. So basically if _DEBUG is defined, the code will compile but will not run because inside Rhino SDK something is not supported for debug configuration.
As for the sample code, in the SampleUserInterface the debug configuration is compiled and linked against Release dlls and libs, which is not really a debug mode. In my code, however, I have to use 3rd party debug libraries, which I cannot link against Release configuration, as I get “mismatch libraries” error.