Backgroundplugin never initialized

Even though I add the line

                _backgroundPlugins.Add(new *pluginname*BackgroundPlugin());

within the init of the definition class the background code never runs, and the init function is never called. How do I troubleshoot this?

In my experience the best way to debug a Smart Client plugin is this:

In your Visual Studio plugin project in propeties add a post-build event, something like this:

xcopy /y “$(TargetPath)” “[C:\Program](file:C:/Program) Files\Milestone\MIPPlugins\MyPlugin”

This automatically copies the newly build dll to where the Smart Client loads it.

In properties - debug pick “Start external program” point to the Smart Client - [C:\Program](file:C:/Program) Files\Milestone\XProtect Smart Client\Client.exe

With this in place when you start debugging, you can single step debug and put breakpoints even in init code.

In the MIP Documentation, in Plug-in development, Getting Started you can read more.

I put a breakpoint in the Init() function in the backgroundplugin and it never runs. It’s added in the _backgroundPlugins list and use Clear() on Close(). Where is Init() called?

One possible explanation -

In your BackgroundPlugin you must have-

public override List<EnvironmentType> TargetEnvironments
{
	get { return new List<EnvironmentType>() { EnvironmentType.Service }; }	// Default will run in the Event Server
}

Do you have the right environment(s) in this list?

-–

enum VideoOS.Platform.EnvironmentType

-

Available types of Environments available.

Enumerator:

Administration

When running in the Manamenent Client (Corporate or Expert products), of Management Application (Enterprise, Professional or Express products).

SmartClient

When running in the Smart Client.

Standalone

When running .Net component library (VideoOS.PLatform.SDK implementation).

Service

When running in the Event Server.

-–

Yes this line exists in the class, it’s barely touched after project creation.

        public override List<EnvironmentType> TargetEnvironments
        {
            get { return new List<EnvironmentType>() { EnvironmentType.Service }; } // Default will run in the Event Server
        }

Actually it might work now, I changed it to

        public override List<EnvironmentType> TargetEnvironments
        {
            get { return new List<EnvironmentType>() { EnvironmentType.SmartClient }; } // Default will run in the Event Server
        }

I did not realize it didn’t run locally and I just want it to run on the Smart Client.