Unhandled SecurityException because ADXRegistry.OpenKey

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

Unhandled SecurityException because ADXRegistry.OpenKey
 
Subscribe
Dirk




Posts: 73
Joined: 2017-10-05
Hello,
we receive a SecurityException, because ADXRegistry.OpenKey fails. This exception is handled by excel and an error dialog is shown. What is the cause?
callstack:

AddinExpress.Projects.Common.ADXRegistry.OpenKey
Microsoft.Win32.Registry.OpenSubKey
System.ThrowHelper.ThrowSecurityException.

Which Keys do you want to read / write?
I do not have further information about the case and that was done.
Our AddIn is using a COM Add-In for ribbon and a Excel Add-In for UDF in the same assembly (dll).

best regards
Dirk
Posted 14 Mar, 2019 12:13:59 Top
Andrei Smolin


Add-in Express team


Posts: 16214
Joined: 2006-05-11
Hello Dirk,

On what stage do you get this? When you install the add-in? Or, when it loads? Is there something of value in the corresponding log file (adxregistrator.log or adxloader.log)?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 15 Mar, 2019 05:21:00 Top
Dirk




Posts: 73
Joined: 2017-10-05
The exception happens if the Excel Add-In is used. No we have no log files. Can you check what you are doing in the registry?
Posted 18 Mar, 2019 04:13:57 Top
Andrei Smolin


Add-in Express team


Posts: 16214
Joined: 2006-05-11
Hello Dirk,

Dirk Reuß writes:
The exception happens if the Excel Add-In is used.


Could you please explain? Does this mean that the add-ins load successfully and you work with them and then you get the exception out of the blue?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 18 Mar, 2019 04:48:57 Top
Dirk




Posts: 73
Joined: 2017-10-05
Yes. The exception happens when excel is opened.
Posted 18 Mar, 2019 07:09:26 Top
Andrei Smolin


Add-in Express team


Posts: 16214
Joined: 2006-05-11
Hello Dirk,

How can we reproduce this issue? Do you get it if you register your add-in from the Visual Studio IDE?

If this only occurs after the add-in gets installed, please let me run the installer in our environment.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 18 Mar, 2019 07:35:17 Top
Dirk




Posts: 73
Joined: 2017-10-05
It is the environment of our customer, so we cannot run and test there. If' ve seen the exception in the excel standard unhandled exception dialog. We have a screenshot from our customer. That's why I'm asking why XLL or COM Addin tries to access the registry. But you say, you don't. But the callstack is from addin express "AddinExpress.Projects.Common.ADXRegistry.OpenKey". Unfortunally I do not see who is calling this function.
Posted 18 Mar, 2019 08:49:16 Top
Andrei Smolin


Add-in Express team


Posts: 16214
Joined: 2006-05-11
Hello Dirk,

an installer of an Add-in Express add-in only the registry keys described in section "Locating COM Add-ins in the Registry" and "Locating Excel UDF Add-ins in the Registry". At the run time, the add-in may modify values and keys under {HKCU}\Software\Microsoft\Office\{host}\AddIns\{your add-in ProgID} and under {HKCU}\Software\Microsoft\Office\{host}\AddIns\ADXXLForm. Check if the user has permissions to do so.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 18 Mar, 2019 10:20:40 Top
Dirk




Posts: 73
Joined: 2017-10-05
Ok. Can our AddIn work even if addinexpress cannot write to the registry?
I do not want the error dialog of security exception, if not absolutely necessary.
Is there a way we can catch this exceptions in our code?
What do you mean by "{host}"?
Posted 18 Mar, 2019 11:10:50 Top
Andrei Smolin


Add-in Express team


Posts: 16214
Joined: 2006-05-11
Hello Dirk,

You can try to intercept that exception using the OnError event of the add-in module. Note however that inability to write to the registry may cause further issues.

{host} = {host Office application, e.g. Excel, Word, Outlook, etc.}

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 19 Mar, 2019 03:57:48 Top