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 very often get this type of error message:

msconlib
Exception has been thrown by the target of an invocation


I have just restarted my Excel add-in (after reinstalling Excel)

I have created 4 Ribbon Tabs (with nice .jpg icons).
Works fine. I was hoping all my previous problems with non-registration or non-loading are gone.

But just now, I created another Ribbon Tab, and I got the above error message.

By experience, I know this is bad omen. Sooner or later my add-in will crash or fail to register and load.

---
I don't know what could be the reason for this problem.
But very often it seems to happen when I add or change the button glyphs.
I use 32x32 .png glyphs.
---

What does the message mean?
Do you have any idea what I could be doing wrong?


Thanks
Leon
Posted 27 May, 2019 06:52:20 Top
Andrei Smolin


Add-in Express team


Posts: 16312
Joined: 2006-05-11
Hello Leon,

Please provide the details.

Your code calls a method that may invoke other internal methods and so on. The issue is: some internal method fails. That means such an error can only be understood if all available information is provided. The information is required to find out the exact error message and context.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 27 May, 2019 08:15:02 Top
Leon Lai Kan




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

Thanks for your reply.

I understand that it may be very difficult for you to diagnose what problem is affecting my add-in.
It is also very difficult for me because the Error message is not precise enough.

However, I have some clues.

My add-in is in a very early stage: Just a few tabs, a few groups in each tab, and several buttons in each group.
Not a single line of (user) code yet.

In each button, I have added a png glyph of size 32x32 pixels.
There is no problem, and the (large) buttons appear beautiful at runtime.

Problems start appearing when I change the glyphs for more appropriate ones.
Sometimes the Error Message appears.

So, it seems that it is the act of changing glyphs which is causing the error.

And once the error has occurred, it seems anything that I do afterwards triggers this error: like creating a new tab or button.

How do I attach glyphs?
I use:
Glyph > Local Resource > Import
Then I select the directory where my images are found.
They are all .png files of size 32 x 32 pixels.

----

I think I will change my strategy:
I will design my add-in without glyphs.
Only when my add-in is complete will I add the glyphs and then deploy.

---

I'll glad to read your opinion on my strange problem.

NB:
There are no problems during build, register, and debug.
At runtime the add-in appears fine.
But since the Error Message is appearing all the time, I am concerned that my add-in may crash or fail to register or load at some more advanced stage.

Thanks
Leon
Posted 28 May, 2019 02:12:42 Top
Andrei Smolin


Add-in Express team


Posts: 16312
Joined: 2006-05-11
Hello Leon,

Since the error message doesn't look meaningful, look in other properties of the Exception object. Say, CallStack, InnerException.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 28 May, 2019 02:28:00 Top
Leon Lai Kan




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

look in other properties of the Exception object


How do I do this?

Note: I have not yet written a single line of code. No Try - Catch block yet written.

Leon
Posted 28 May, 2019 02:43:51 Top
Andrei Smolin


Add-in Express team


Posts: 16312
Joined: 2006-05-11
This doesn't mean there's no code.

Is this a run time or build time issue?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 28 May, 2019 02:49:31 Top
Leon Lai Kan




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



Is this a run time or build time issue?


It's neither a run time nor a build time issue.
The error occurs during design time in the ADX designer.

For example, when I change the properties of a button (e.g. changing its glyph).
Once the problem has started, it seems the Error Message is displayed even when I do some simple task like create a button, or delete a button. Probably this is because the previous error is still present...

And the strange thing is that there is no error during build time, or register or debug.

And at run time, the buttons etc. are well formed.

The error occurs only at design time. So, I am not sure we have any exceptions to catch.
Could you suggest any areas where I can investigate?

Thanks
Leon

-----
ADDED

Andrei,

I fear that my problems may not originate from ADX or Excel.
The same error message pops up regularly.
Just now, I had an idea:

I ran my mischievous sample on my home computer, with ADX installed.
To my great surprise, the "mischievous sample" behaves properly.
No error messages! Can change RegisterForAllUsers from False to True or vice versa without any problem.

So, the problem has to be sought elsewhere: Windows? .NET Framework? Visual Studio?


I will ask one of my friends (who is an informatician) to diagnose.

Meanwhile, now that my problem is clearer, I will welcome any suggestions from you.

Best Regards, and I really apologise for all the problems I am giving you.


Leon
Posted 28 May, 2019 03:54:21 Top
Andrei Smolin


Add-in Express team


Posts: 16312
Joined: 2006-05-11
Hello Leon,

No problem. I'd try to reinstall Add-in Express.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 29 May, 2019 06:37:15 Top
Leon Lai Kan




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

I am so happy I want to tell you.

After reinstalling ADX and Office several times, without any success, I just now reinstalled the newest version of .NET Framework.

Lo!
ADX works normally (even with my mischievous sample).

Don't know what happens. I am happy, because otherwise my next step would be to reinstall Windows 10.


Best Regards,
Leon
Posted 31 May, 2019 05:29:11 Top
Andrei Smolin


Add-in Express team


Posts: 16312
Joined: 2006-05-11
Hello Leon,

Congratulations! :)))

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 31 May, 2019 05:30:57 Top