A new development in the Registry error

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

A new development in the Registry error
 
Pino Carafa




Posts: 162
Joined: 2016-09-28
Hello Andrei....

You may remember this issue
https://www.add-in-express.com/forum/read.php?FID=5&TID=16230

Where occasionally we would get an error message "Exception Message: Requested registry access is not allowed."

This would happen in Excel

We now have some new information that may help us figure out what is going on.

I can reproduce some of this on my own machine also - I can reproduce the fact that Excel starts and never stops, but I don't get the error popping up on my machine.

The issue happens when the user is using the Preview pane in their Windows Explorer. When they happen to click on a spreadsheet, I see in my task manager that Excel starts running and the preview appears in the Preview Pane. When they click on another document I see that Excel continues to run. It never closes.

On my own machine this doesn't seem to affect anything other than that Excel keeps on running for no good reason. But on the user's machine it seems to eventually lead to the error message popping up.

I'm wondering could it be that the Preview Pane is running in some kind of "sandbox" mode where it doesn't have access to the Registry key? Is there anything we can do to prevent our Add-in loading when Excel is running in "preview" mode?
Posted 17 Feb, 2022 11:22:55 Top
Jim J




Posts: 17
Joined: 2019-03-26
Hello,

I believe I addressed and solved the exact issue your are facing in a forum thread on June 24, 2021 and I even linked to one of your own old threads that raised the same issue I was having.

Please refer to my old thread located below and hopefully it solves your issue.

https://www.add-in-express.com/forum/read.php?FID=5&TID=16194

Regards,
Jim
Posted 17 Feb, 2022 17:12:52 Top
Pino Carafa




Posts: 162
Joined: 2016-09-28
Hello Jim J.... yes we are actually catching that error, too, but it still bothers me that this error occurs in the first place. It means that something is not working the way it's expected to, and there is always a chance that this may lead to unexpected behaviour. That would then result in customers phoning us demanding solutions and us - because the error is handled and nothing is shown to the user - not knowing where to look.
Posted 18 Feb, 2022 04:25:26 Top
Pino Carafa




Posts: 162
Joined: 2016-09-28
I will, however, pass your thread on to our Support staff who may refer to it when our customers report this to them, so thanks a million for that!
Posted 18 Feb, 2022 04:33:18 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Pino,

Preview starts Excel via Automation and you can detect this. Check Application.UserControl - it returns true if Excel is controlled by the user; it returns false if the application is started programmatically.

Regards from Poland (CET),

Andrei Smolin
Add-in Express Team Leader
Posted 18 Feb, 2022 05:01:43 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Pino Carafa writes:
When they click on another document I see that Excel continues to run. It never closes.


I assume this is by design: we saw this issue a whole while back - https://social.microsoft.com/Forums/windows/en-US/fb72e113-c65c-4d79-8188-d3bb548939cc/excel-2010-com-addin-windows-7-preview-pane-issue?forum=exceldev.

Regards from Poland (CET),

Andrei Smolin
Add-in Express Team Leader
Posted 18 Feb, 2022 05:06:28 Top
Pino Carafa




Posts: 162
Joined: 2016-09-28
Thanks Andrei. Checking the .UserControl property would not help us here. Our main application, for example, allows users to select files (including Excel spreadsheets) from a "repository" and if they then double click on one such file displayed in a grid, we actually use Automation to open the file; we found in the past that simply launching the file itself and letting the OS take care of starting Excel (or Word, or Outlook for that matter) would sometimes cause other issues. In Word, for example, it would sometimes cause Word to start pestering the user about saving their Normal.dot
Posted 18 Feb, 2022 05:56:53 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Pino,

A while back quite many issues occurred because Office updated itself while your add-in is being loaded. One of the symptoms was the "Could not load file or assembly 'Microsoft.Office.Interop.{application} {other details}' or one of its dependencies. Access is denied."

We solved it by using embedded interops: set Embed Interop Types = true on interop references. A side effect: you may stop deploying the interops.

Regards from Poland (CET),

Andrei Smolin
Add-in Express Team Leader
Posted 18 Feb, 2022 07:26:25 Top
Jim J




Posts: 17
Joined: 2019-03-26
Pino,

It should be noted this is 100% a Microsoft issue.

If a user installs 64-bit Office first then uninstalls it and installs the 32-bit version then the error will occur every time if they use the Windows preview pane. Microsoft needs to either fix their un-installation procedure that properly removes the registry items I mentioned in the linked thread or they need to fix how the Windows preview pane handles office files. The other issue that occurs when first installing 64-bit Office before installing 32-bit Office is the Windows preview pane will not work on Office files at all regardless of whether the user has any add-ins installed.

To be clear there is nothing wrong with Add-in Express and the only thing you can do with your add-in is properly trap the error in the Add-in express OnError event and show a friendly error message telling the user why the error is occurring and how to fix it by deleting the invalid registry key. To properly trap this error ensure both the outer and inner exception matches, the user is running 32-bit Excel and the following 64-bit Excel registry key exists [HKEY_CLASSES_ROOT\CLSID\{00020827-0000-0000-C000-000000000046}] (notes the registry keys of Word and PowerPoint are different).

Regards,
Jim
Posted 18 Feb, 2022 12:58:57 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Jim,

Thank you very much for posting these details!

Regards from Poland (CET),

Andrei Smolin
Add-in Express Team Leader
Posted 22 Feb, 2022 05:40:38 Top