This project is read-only.

Error message "A IDockManager extension must be included..." after upgrading to version 1.7

Aug 20, 2014 at 8:52 PM
After upgrading from version 1.6 to 1.7 I get this runtime message:

"A IDockManager extension must be included because a UI plugin was found.
A IHeaderControl extension must be included because a UI plugin was found.
A IStatusControl extension must be included because a UI plugin was found."

The only plugins I use are TableEditor.dll and Tools.dll. Thes are placed in folders Extensions and Plugins of the main project of the solution, respectively, just as they were when I used version 1.6. They are marked as Copy Always to ensure they are copied to the output folder.

I have double-checked that all DotSpatial references in the solution have the correct version number, which the have (1.7). I have used the VS command Clean Solution and Rebuidl Solution, but the message is still displayed.

The Tools.dll-plugin seems to work anyway, the tools are available in the toolbox window in the application.

I am using VS 2013 prof.
Aug 21, 2014 at 9:33 AM
Have a look at discussion Use GDAL in VB-Project.
Aug 21, 2014 at 5:01 PM
Should that empty class be put in a separate project, compiled and the DLL put in the Plugins folder?
Aug 21, 2014 at 8:18 PM
Edited Aug 21, 2014 at 8:54 PM
More info: I tried with creating an empty class put in a separate project, built it and put the DLL in the Plugins folder, but the problem remains. I also tried putting it as a class in the project where DS is used in my solution.

Some observations:
-After appManager.LoadExtensions() is called, the folder "Windows Extensions" is added to the appManager.Directories list. I have no Windows Extension folder in my output directory.
-In the DS 1.7 download package, there is no DotSpatial.Plugins.TabbedDocking.dll in folder Windows Extensions (it was in version 1.6).
-Even if I remove all plugin dll:s, the message "..UI plugin was found" is displayed when appManager.LoadExtensions() is called, so it seems to be a bug with a misleading message.
Aug 22, 2014 at 9:46 AM
Yes the error message is a bit misleading. The reason it pops up is because the appManager checks whether the IDockManager, IHeaderControl, IStatusControl are there because if you are going to use extensions they will be needed.

I went and build a new project with a form and a file with the empty implementations of the missing controls.
I also added references to DotSpatial.Data, DotSpatial.Controls from the DS 17 full download and System.ComponentModel.Composition.
Without the empty implementations I get your error messages, with them the errors are gone.
Imports DotSpatial.Controls

Public Class Form1

    Public WithEvents app As DotSpatial.Controls.AppManager

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
        app = New AppManager

        app.LoadExtensions()
    End Sub

End Class
Imports DotSpatial.Controls.Header
Imports System.ComponentModel.Composition
Imports DotSpatial.Controls.Docking

<Export(GetType(IHeaderControl))>
Public Class MyHeaderControl
    Implements IHeaderControl

    Public Sub Add(item As HeaderItem) Implements IHeaderControl.Add

    End Sub

    Public Sub Remove(key As String) Implements IHeaderControl.Remove

    End Sub

    Public Sub RemoveAll() Implements IHeaderControl.RemoveAll

    End Sub

    Public Event RootItemSelected(sender As Object, e As RootItemEventArgs) Implements IHeaderControl.RootItemSelected

    Public Sub SelectRoot(key As String) Implements IHeaderControl.SelectRoot

    End Sub
End Class

'<Export(GetType(IStatusControl))>
Public Class MyStatusControl
    Implements IStatusControl

    Public Sub Add(panel As StatusPanel) Implements IStatusControl.Add

    End Sub

    Public Sub Remove(panel As StatusPanel) Implements IStatusControl.Remove

    End Sub

    Public Sub Progress(key As String, percent As Integer, message As String) Implements DotSpatial.Data.IProgressHandler.Progress

    End Sub
End Class

'<Export(GetType(IDockManager))>
Public Class MyDockManager
    Implements IDockManager

    Public Event ActivePanelChanged(sender As Object, e As DockablePanelEventArgs) Implements IDockManager.ActivePanelChanged

    Public Sub Add(panel As DockablePanel) Implements IDockManager.Add

    End Sub

    Public Sub HidePanel(key As String) Implements IDockManager.HidePanel

    End Sub

    Public Event PanelAdded(sender As Object, e As DockablePanelEventArgs) Implements IDockManager.PanelAdded

    Public Event PanelClosed(sender As Object, e As DockablePanelEventArgs) Implements IDockManager.PanelClosed

    Public Event PanelHidden(sender As Object, e As DockablePanelEventArgs) Implements IDockManager.PanelHidden

    Public Event PanelRemoved(sender As Object, e As DockablePanelEventArgs) Implements IDockManager.PanelRemoved

    Public Sub Remove(key As String) Implements IDockManager.Remove

    End Sub

    Public Sub ResetLayout() Implements IDockManager.ResetLayout

    End Sub

    Public Sub SelectPanel(key As String) Implements IDockManager.SelectPanel

    End Sub

    Public Sub ShowPanel(key As String) Implements IDockManager.ShowPanel

    End Sub
End Class
Aug 22, 2014 at 4:50 PM
Thank you for your help! Will there be a patch for version 1.7?

My solution has all GIS-functionality in a separate project (dll), so the output will not be placed in the application output directory automatically. I tried to put the class in the GIS-project but without success. Then in a separate dll, also without success. Finally I put it in the main project, and then the error message disappeared. I do not understand why it did not work as a separate dll (neither by building it and putting in the Plugins folder, nor by including it as a project in the solution). I also noted that trying to add the extension TableEditor raises an exception, while other plugins are ok.

Class put in the main project of the application:
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using DotSpatial.Controls.Header;
using DotSpatial.Controls.Docking;

namespace DotSpatialHeaderControlDummy
{
    [Export(typeof(IHeaderControl))] // THIS ATTRIBUTE REQUIRED!
    public class DummyHeaderControl : IHeaderControl
    {
        public void Add(HeaderItem item)
        {
        }

        public void Remove(string key)
        {
        }

        public void RemoveAll()
        {
        }

        public void SelectRoot(string key)
        {
        }

        public event EventHandler<RootItemEventArgs> RootItemSelected;
    }

    public class DummyStatusControl : IStatusControl
    {
        public void Progress(string key, int percent, string message)
        {
        }

        public void Add(StatusPanel panel)
        {
        }

        public void Remove(StatusPanel panel)
        {
        }
    }

    public class DummyDockManager : IDockManager
    {
        public void Add(DockablePanel panel)
        {
        }

        public void Remove(string key)
        {
        }

        public void ResetLayout()
        {
        }

        public void SelectPanel(string key)
        {
        }

        public void HidePanel(string key)
        {
        }

        public void ShowPanel(string key)
        {
        }

        public event EventHandler<DockablePanelEventArgs> ActivePanelChanged;
        public event EventHandler<DockablePanelEventArgs> PanelClosed;
        public event EventHandler<DockablePanelEventArgs> PanelAdded;
        public event EventHandler<DockablePanelEventArgs> PanelRemoved;
        public event EventHandler<DockablePanelEventArgs> PanelHidden;
    }

}
Aug 22, 2014 at 9:12 PM
What error was raised when you added the TableEditor plugin? Was it before or after you added the dummy implementations?
Aug 24, 2014 at 12:06 PM
The error message is:
Error while while activating DotSpatial.Plugins.TableEditor.TableEditorPlugin,
DotSpatial.Plugins.TableEditor, Version=1.0.1185.0, Culture= neutral,
PublicKeyToken= null.

It is displayed only when I include the dummy implementations.
Aug 24, 2014 at 1:22 PM
Did you set app.Map = {the Map you use} before you ran LoadExtensions?

The TableEditorPlugin tries to add its event handler to app.Map.LayerAdded and throws an Exception if he can't do that e.g. because app.Map is null.
Aug 25, 2014 at 7:06 AM
Setting app.Map = (the map I use) solved the problem with TableEditorPlugin. Thank you!

/Peder