Getting current instance of task pane returns null

Add-in Express™ Support Service
That's what is more important than anything else

Getting current instance of task pane returns null
 
Sean Devenish




Posts: 55
Joined: 2015-11-30
Hi aleksandr,

we only access the method from the following events:
processbeforedoubleclick
processfollowhyperlink
workbookbeforeclose
addinbeginshutdown

We have tried putting in a loop with a timer when accessing the pane to retry after 300 milliseconds but even after 3 or so retries we still keep getting null.

While we don't have live access to their environment, we can log what is going so if there is anything we can investigate that would be good to know.
Posted 16 Mar, 2017 00:17:31 Top
Andrei Smolin


Add-in Express team


Posts: 14106
Joined: 2006-05-11
Hello Sean,

Could you please check if AddinModule.CurrentInstance.ExcelApp.ActiveWindow is null in these events?

Is the workbook opened in a ProtectedViewWindow?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 16 Mar, 2017 06:56:11 Top
Andrei Smolin


Add-in Express team


Posts: 14106
Joined: 2006-05-11
Also, you write:

Sean Devenish writes:
we only access the method from the following events:


Does this mean that you don't access a task pane instance in any other event?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 16 Mar, 2017 06:57:21 Top
Sean Devenish




Posts: 55
Joined: 2015-11-30
Hi,

I can confirm we don't access the task pane in any other event. We have logged AddinModule.CurrentInstance.ExcelApp.ActiveWindow and can confirm that it is not null.

The error is reproducable by the client when first opening a document from their document management system, in all other instances the add-in works fine.

While we can't replicate the issue, we can coordinate with the client (they are a very large organisation) for you to have a look at the problem on their machine if you are available? Would there be any logging or other settings we could add to the project to make this a worthwhile exercise?
Posted 23 Mar, 2017 00:49:05 Top
Dmitry Kostochko


Add-in Express team


Posts: 2731
Joined: 2004-04-05
Hi Sean,

Thank you for the additional information.

I think the issue may be caused by the client's document management system. I suppose the code that is used in the DMS opens the first Excel workbook in some way that is not handled in our code. Can you ask your client to record a video that shows the whole process from opening a workbook and to getting the error and send the video to us? Also, what exactly document management system do they use? Probably we will be able to contact DMS developers and ask them about their code.
Posted 23 Mar, 2017 05:39:12 Top
Sean Devenish




Posts: 55
Joined: 2015-11-30
They are using Reckon APS Workpaper Manager. Please refer to the attached link below to a video showing the behaviour.

https://www.dropbox.com/s/ddc497aq4335b24/BF%20Test%20Screen.webm?dl=0

The first example shows creating a project within Workpaper Manager, opening the relevant document in Excel, and attempting to click on a hyperlink. Our code works on the follow hyperlink event and normally opens our custom task pane. The first time it is attempted (at 1:32), the task pane returns null and no task pane appears.

The second time they open the file in Excel from Workpaper Manager (immediately after, at 1:57), the task pane is retrieved and displayed without problem.
Posted 27 Mar, 2017 02:27:30 Top
Andrei Smolin


Add-in Express team


Posts: 14106
Joined: 2006-05-11
Hello Sean,

Could you please check if there's an extra EXCEL.EXE in processes before you open the workbook for the first time? If this is the case, you'll need to find what causes it from exiting; you may want to check https://www.add-in-express.com/creating-addins-blog/2011/11/04/why-doesnt-excel-quit/.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 27 Mar, 2017 08:56:37 Top
Sean Devenish




Posts: 55
Joined: 2015-11-30
Hi Andrei,

no there is not, this is after logging in to a terminal server session for the first time so Excel hasn't been opened previously. It is also worth noting that the addin is loaded and working, we are getting logging messages, other functions of the addin work, it is just the task pane that is being returned as null.
Posted 27 Mar, 2017 16:55:24 Top
Andrei Smolin


Add-in Express team


Posts: 14106
Joined: 2006-05-11
Sean,

Could you please try passing null to the indexer?

ADXTaskPane.ADXCustomTaskPaneInstance paneInstance = AddinModule.CurrentInstance.mainTaskPane[null];

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 28 Mar, 2017 05:28:20 Top
Sean Devenish




Posts: 55
Joined: 2015-11-30
Hi Andrei,

passing null to the indexer produces the same result.

Would supplying you with a copy of our code be of any assistance?
Posted 30 Mar, 2017 05:23:23 Top