Floating ToolWindow error

When I run the API Help ‘Add ToolWindow’ example:

[CODE]Project.UndoContext.BeginUndoStep(“AddToolWindow”);

try
{
    // How to create a ToolWindow and dock it in different places.
    // Add it tabbed on the left side.
    ToolWindow tw = new ToolWindow("MyToolWindow_1");
    tw.Caption = "Tabbed on the left side.";
    UIEnvironment.Windows.AddTabbed(tw, UIEnvironment.Windows["ObjectBrowser"] as ToolWindow);

    // Add it docked on the right side.
    ToolWindow tw2 = new ToolWindow("MyToolWindow_2");
    tw2.Caption = "Docked on the right side.";
    UIEnvironment.Windows.AddDocked(tw2, DockStyle.Right);

    // Add a floating ToolWindow.
    ToolWindow tw3 = new ToolWindow("MyToolWindow_3");
    tw3.Caption = "Floating ToolWindow.";
    UIEnvironment.Windows.Add(tw3);
}
catch (Exception e)
{
    Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
    throw e;
}
finally
{
    Project.UndoContext.EndUndoStep();
}[/CODE] ... the first two ToolWindows work OK, but the line: [CODE]UIEnvironment.Windows.Add(tw3);
[/CODE] gives this error:

If I click 'Close' the floating ToolWindow appears OK.

I do not know what is meant by 'user defined breakpoint'.

Can anyone replicate this behaviour?

Thanks,

Kevin

Hi Kevin,

I could reproduce this, there is a (unnecessary) call to Debug.Break() which really shouldn’t have been in a release build.. The workaround is to add the window docked, then float it.

UIEnvironment.Windows.AddDocked(tw3, DockStyle.Right); tw3.Float();
regards,
Johannes

Thanks Johannes,

That works OK.

Regards,

Kevin