private void GetWorkspacesCallback(object sender, EventArgs args) { if (!(args is OleMenuCmdEventArgs menuArgs)) { return; } var inParam = menuArgs.InValue; var vOut = menuArgs.OutValue; if (inParam != null) { WorkspaceLogger.Log.Error("Input param is illegal"); } else if (vOut != IntPtr.Zero) { var workspaces = _workspaceService.GetWorkspaces().ToArray <string>(); Marshal.GetNativeVariantForObject(workspaces, vOut); } else { WorkspaceLogger.Log.Error("Output param is required"); } }