3

I was made aware of an interesting situation by my client today. I am sure it is something simple but seems like I can't put my finger on it. Have never faced this issue and Google has not been too helpful.

Problem

On my client's laptop, the Add-In is created with Add-in Express™ for Microsoft® Office and .net. When running the Add-in from VS, the breakpoints do not trigger. I logged in via teamviewer. We created a new test project (Add-in) and added this simple code.

Private Sub AdxExcelAppEvents1_WorkbookOpen(sender As Object, hostObj As Object) Handles _
AdxExcelAppEvents1.WorkbookOpen
    MessageBox.Show ("Hello World")
End Sub

I put a breakpoint on AdxExcelAppEvents1_WorkbookOpen and ran. I got the message when I opened a new workbook but the breakpoint did not trigger.

I tested the same code on my laptop and it works just fine.

What has he and I tried

  1. Unregister, Clean + Rebuild, Register
  2. Manually cleaning the Debug folder
  3. Repairing Add-In Express
  4. Uninstalling/ReInstalling Add-In Express
  5. Jumping between frameworks 4.5 and 4.6, 4.7.1
  6. Toggling Tools | Options | Debugging | General require source files to exactly match the original version
  7. Toggling Solution platforms (x86|64|AnyCPU)

Applications

  1. Visual Studio Version: 2019 Pro
  2. MS Office: 2016 Professional Plu 2016

Let me know if you need anything else?

FYI: This has been crossposted at Add-in Express forum I usually do not crosspost but seems like my client is under pressure and has to deliver this project on monday morning.

Siddharth Rout
  • 147,039
  • 17
  • 206
  • 250
  • An Add-in Express add-in is ***NOT*** VSTO technology. Please edit this question accordingly. Yes, both base on IDT2Extensibility, but in essence they are competing tools... – Cindy Meister Mar 21 '20 at 18:06
  • 2
    I absolutely agree with you Cindy. I added that tag because I thought someone who works with VSTO may have experienced this while creating an Add-in :) – Siddharth Rout Mar 21 '20 at 18:24
  • I know nothing about Addin Express, but are you generating the "Debug Info" (Proj Propererties>Compile Tab->Advanced Compile Options button)? – TnTinMn Mar 21 '20 at 21:09
  • Thanks @TnTinMn. It is set as `full` as usual. There are very few differences between them. I like using Add-in Express because it gives me a better control over my Add-in. My client informs me that the breakpoints were working and then Excel got stuck. He had to `End-Task` it. After that the breakpoints stopped triggering – Siddharth Rout Mar 22 '20 at 06:13
  • are you sure that the add-in that is loaded by Excel is the one that you build ? It is possible that you load an old one located somewhere else. In Excel remove the addin and add it again by hand. You may also try the `Debugger.Break` from `System.Diagnostics` – Malick Mar 22 '20 at 09:24
  • @Malick: That was my thought too. And hence I tried what you said but it did not help. I also tried point 6 because of this. I also changed the message. But everytime i ran the code, the updated message showed. Also like I said, I created a new project and it happened with that as well... – Siddharth Rout Mar 22 '20 at 09:29
  • 1
    Can you put a breakpoint on a method before, ex: ThisAddIn.Startup, does it work ? – Malick Mar 22 '20 at 09:35
  • In Add-in Express, we do tno have `ThisAddIn.Startup`. Yes it works for `AddinModule_AddinInitialize`. – Siddharth Rout Mar 22 '20 at 09:46
  • So if it works, that's great, there is a problem with your `WorkbookOpen` event, maybe a runtime error..(or a problem in add-in express - but I never use it), you can try to step in up to this event. One idea would be to open programmaticaly a worbook and to step in – Malick Mar 22 '20 at 09:51
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/210095/discussion-between-siddharth-rout-and-malick). – Siddharth Rout Mar 22 '20 at 09:52

2 Answers2

2

You can use the method Debugger.Break from System.Diagnostics and observe if you get more information about a plausible unhandled exception. In this case, we get the exception wkernelbase.pdb not loaded and Siddharth found it can be fixed by selecting : Tools->Options->Debugging->Symbols->Select "Microsoft Symbol Servers".

Malick
  • 6,252
  • 2
  • 46
  • 59
  • 1
    Thank you for staying with me on this! One thing I would like to add is if `Debugger.Break` fails then try `If (Debugger.IsAttached = False) Then Debugger.Launch()` – Siddharth Rout Mar 22 '20 at 11:01
0

I suppose there's an {excel}.exe.config file in the Office folder. The .config requires all add-ins to use .NET 2.0 (3.0, 3.5).

That would explain the issue: you use .NET 2.0 (3.0, 3.5) while the debugger expects to use .NET 4.0 (4.X).

And yes, Add-in Express is built around the COM Add-in technology, not VSTO Add-in.

  • Thanks Andrei. I do not have the config file. That was one of the few things I had ealier checked. Anyways it is sorted. It was a simple setting which had got unchecked. All good now. I have been making VSTO Add-ins for almost 12 years now. I have been testing Add-in express for the last 1 month now and I like it. :) As far as VSTO tag is concerned, the reason why I tagged it as VSTO is so that anyone who creates Add-in might have faced a similar situation or could suggest something. And that is exactly what happend. Malick helped me figure out the problem. – Siddharth Rout Mar 23 '20 at 07:23