Refering to Client Plugin SDK and Sample, I built a simple homeview plugin, it is loaded, and events fire as intended. But it also throws a strange error --"Error" :bject reference not set to an instance of an object.". Can someone help why ?
public class Plugin2 : Plugin {
public VIApp _viApp;
public void Load(VIApp app) {
// Test Loading
if (app == null) { throw new Exception("Plugin.Load() viApp is null.\nPlugin load failed"); }
_viApp = app;
// Test Menu
Extension ext = _viApp.NewExtension();
ext.Name = "PowerCLI";
ext.Activated += new ExtensionEvent(ext_Activated);
ext.Image = Properties.Resources.PowerCLI1;
_viApp.AddExtension("HomeView.Applications", ext);
}
void ext_Activated(Extension sender) {
try {
System.Windows.Forms.MessageBox.Show("hi");
} catch { }
}
public void Unload() {
//_viApp = null;
}
}
Attachments:
-
error.png (25.6 K)