I get this error message very often:

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

I get this error message very often:
Exception has been thrown by the target of an invocation 
Subscribe
Leon Lai Kan




Posts: 200
Joined: 2018-12-20
Hi, Andrei

I don't want to bother you again with a problem that has persisted for months.
But I am getting really discouraged and depressed.
And I really need to sort out this problem.

As I explained, my problem is that my add-in does not register in Excel.
And if it is registered, it does not load in Excel.

I tried everything: Reinstalling Office, Reinstalling .NET Framework 4.0, Reinstalling ADX.

Every time I think I have sorted out the problem. But soon the problem recurs.

Last week, in despair, I asked an IT friend to FORMAT my computer (remove everything!).
Then re-install Windows 10 (64-bit), Office 2016 (32-bit), .NET Framework 4.0, and Add-in Express.

I worked for one week developing my add-in for Excel.
No problem. I could successfully build, register and load my add-in in Excel WITHOUT PROBLEM.
I was very happy at last and thought that my former problems happened because I was using Office 2016 as 64-bit instead of 32-bit.


This morning, my nightmares began again.
My add-in is in a very early stage (I restarted it all over again at least a dozen times!).
There are only Excel tabs, groups, buttons and icons.
I have practically not written any code yet.

My problem arose when I was changing icons (the glyph property of a button).
I change icons quite frequently in order to get the most appropriate ones for my project.
I did not have problems changing glyphs (since I reformatted my computer).

But now, suddenly, I get that dreaded message

msconlib
Exception has been thrown by the target of an invocation


And now, I cannot register the add-in in Excel.
Although ADX says "The ADX project registration succeeded", the add-in is NOT Registered (and NOT loaded in Excel).

Even add-ins (with glyphs) developed before cannot be registered.

I tried to register the add-in on the 2nd computer with ADX installed. It is not registered!


====

Andrei,
Would you mind if I send you a zip file of my project (in a very early stage), so that you can try to see what's going wrong?

How can I send it?

I have a hint at what may be going wrong: I notice that it's always when I change the glyph on a button that the problem arises.

Most of the time, no problem arises when I change the glyphs.
But occasionally, the problem occurs and the infamous message pops up:
msconlib
Exception has been thrown by the target of an invocation


From that moment, my add-in fails to register in Excel.

Do you think changing glyphs too often could be the cause of my problem?
I worked on numerous samples from your web site (I don't put glyphs on the buttons) and never had such problems.

-----
I also notice that after my add-in has crashed, I get this message each time I run Visual Studio:

The file
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.
Vsa.tbl could not be loaded. An attempt to repair this
condition failed because the file could not be found.

Please reinstall this program.


Very mysterious message. Why does it mention .NET Framework 2.0???








Best Regards,
Leon
Posted 25 Jun, 2019 05:59:40 Top
Andrei Smolin


Add-in Express team


Posts: 16316
Joined: 2006-05-11
Leon,

Is your add-in disabled in Excel? See File | Options.

Do you ever reset your debugging session?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 25 Jun, 2019 06:43:21 Top
Leon Lai Kan




Posts: 200
Joined: 2018-12-20
Hi, Andrei

Is your add-in disabled in Excel? See File | Options.

There are no disabled items.

Do you ever reset your debugging session?

What do you mean by this?

Leon
Posted 25 Jun, 2019 06:50:38 Top
Andrei Smolin


Add-in Express team


Posts: 16316
Joined: 2006-05-11
If you open File | Options, is your add-in listed at all?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 25 Jun, 2019 06:52:07 Top
Leon Lai Kan




Posts: 200
Joined: 2018-12-20
If you open File | Options, is your add-in listed at all?


No. Not listed at all.
Previously, before the crash, it was listed and loaded correctly.


---

But if I now create another add-in (Add-in 2), this one will be listed (and correctly loaded).
Posted 25 Jun, 2019 06:57:39 Top
Andrei Smolin


Add-in Express team


Posts: 16316
Joined: 2006-05-11
Move all custom code in the constructor of the add-in module to an event of the module. Depending on the way you start the host application, the very first event is either AddinInitialize or OnRibbonBeforeCreate. Also, remove initializers from all declarations of all complex-type variable declared on the module level:

dim myVar as MyType = Nothing ==> dim myVar as MyType

You should initialize all such variables in an event of the add-in module.

When this is done, register the add-in project and check if it loads.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 25 Jun, 2019 07:07:07 Top
Leon Lai Kan




Posts: 200
Joined: 2018-12-20
Move all custom code in the constructor of the add-in module to an event of the module


My add-in consists only of tabs, groups, and buttons with glyphs.
Hence in a very early stage of completion.

I have not written a single line of code.
There are no custom codes, only autogenerated codes.


This is a deliberate policy. The add-in I have developed (and which fails to register in Excel) is just to show how my buttons will look in the completed add-in.

I develop my complex add-in as small separate add-ins because of my previous nasty experience.
Later, I will combine them all in a single add-in.
Posted 25 Jun, 2019 07:17:25 Top
Andrei Smolin


Add-in Express team


Posts: 16316
Joined: 2006-05-11
Let Add-in Express create a setup project for this add-in project; build the setup project, run the installer, start Excel and provide adxregistrator.log and adxloader.log.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 25 Jun, 2019 08:10:10 Top
Leon Lai Kan




Posts: 200
Joined: 2018-12-20
Andrei,

This is something I have not (yet) done before.

It will take me some time to read the ADX manual or other ADX documentation.

Can you give me some tips so I can jump start?

Leon
Posted 25 Jun, 2019 09:21:26 Top
Andrei Smolin


Add-in Express team


Posts: 16316
Joined: 2006-05-11
Install Visual Studio Installer for your VS version; find the corresponding link in section Installation Software Products Supported by the Add-in Express Setup Project Wizard.

Then build your project, right-click it in solution Explorer and choose item Add-in Express | Create Setup Project on the context menu. Choose all defaults in the wizard windows. This ends with creating a setup project. Build it. Navigate to the Debug folder of the setup project and start setup.exe (if exists) or .MSI.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 25 Jun, 2019 09:50:17 Top