RE: [ExcelDna] Possible very minor v 1.5 issue?

125 views
Skip to first unread message

Govert van Drimmelen

unread,
Aug 16, 2021, 10:10:07 AMAug 16
to exce...@googlegroups.com

Hi Brian,

 

That sounds like Excel crashing, and it would be worthwhile to try to find.

Maybe you can check in the Windows event log for some more information, particularly the error code.

 

Are you also using the IntelliSense extension?

If so, it might be worth checking whether this is related, as I think that’s a more fragile part than the main add-in library.

 

-Govert

 

 

From: exce...@googlegroups.com <exce...@googlegroups.com> On Behalf Of bpie...@gmail.com
Sent: 16 August 2021 16:06
To: Excel-DNA <exce...@googlegroups.com>
Subject: [ExcelDna] Possible very minor v 1.5 issue?

 

Hi Govert,

 

More an FYI than anything else, but I've recently updated to v1.5 and I've seen a couple times where a few moments after closing an Excel workbook that was using ExcelDna a new Excel instance would open. This isn't something I can easily recreate, and it may just be coincidence that it has happened a couple times after the upgrade. I'm going to spend a little more time attempting to recreate, but just letting you know in case you're aware of any changes that might result in such behavior.

 

Best,

 

Brian

 

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/972a3114-5ee0-4eb9-90bb-f89332e37d18n%40googlegroups.com.

bpie...@gmail.com

unread,
Aug 16, 2021, 10:13:50 AMAug 16
to Excel-DNA
Hi Govert,

Whoops -- sorry, re-entered this on another thread since I wanted to get the behavior in the topic...

I'll check the Windows event logs and let you know if I see anything. I do use Intellisense and also upgraded that.

Brian

bpie...@gmail.com

unread,
Aug 16, 2021, 10:21:07 AMAug 16
to Excel-DNA
The Excel crashes were indeed seen in the Windows event logs. Two instances from the last hour copied below.

Here's the first:

Log Name:      Application
Source:        Application Error
Date:          8/16/2021 9:28:06 AM
Event ID:      1000
Task Category: (100)
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      DESKTOP-VAMV8QV
Description:
Faulting application name: EXCEL.EXE, version: 16.0.14228.20250, time stamp: 0x610dc117
Faulting module name: KERNELBASE.dll, version: 10.0.19041.1151, time stamp: 0x891df6d3
Exception code: 0xe0434352
Fault offset: 0x0000000000034ed9
Faulting process id: 0x2f38
Faulting application start time: 0x01d792a2180c11d0
Faulting application path: C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE
Faulting module path: C:\Windows\System32\KERNELBASE.dll
Report Id: 13830924-4204-44d0-a17f-f69f6b070c20
Faulting package full name: 
Faulting package-relative application ID: 
Event Xml:
  <System>
    <Provider Name="Application Error" />
    <EventID Qualifiers="0">1000</EventID>
    <Version>0</Version>
    <Level>2</Level>
    <Task>100</Task>
    <Opcode>0</Opcode>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2021-08-16T13:28:06.5594635Z" />
    <EventRecordID>86217</EventRecordID>
    <Correlation />
    <Execution ProcessID="0" ThreadID="0" />
    <Channel>Application</Channel>
    <Computer>DESKTOP-VAMV8QV</Computer>
    <Security />
  </System>
  <EventData>
    <Data>EXCEL.EXE</Data>
    <Data>16.0.14228.20250</Data>
    <Data>610dc117</Data>
    <Data>KERNELBASE.dll</Data>
    <Data>10.0.19041.1151</Data>
    <Data>891df6d3</Data>
    <Data>e0434352</Data>
    <Data>0000000000034ed9</Data>
    <Data>2f38</Data>
    <Data>01d792a2180c11d0</Data>
    <Data>C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE</Data>
    <Data>C:\Windows\System32\KERNELBASE.dll</Data>
    <Data>13830924-4204-44d0-a17f-f69f6b070c20</Data>
    <Data>
    </Data>
    <Data>
    </Data>
  </EventData>
</Event>


...and here's the 2nd:
Log Name:      Application
Source:        Application Error
Date:          8/16/2021 9:53:28 AM
Event ID:      1000
Task Category: (100)
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      DESKTOP-VAMV8QV
Description:
Faulting application name: EXCEL.EXE, version: 16.0.14228.20250, time stamp: 0x610dc117
Faulting module name: KERNELBASE.dll, version: 10.0.19041.1151, time stamp: 0x891df6d3
Exception code: 0xe0434352
Fault offset: 0x0000000000034ed9
Faulting process id: 0xefc
Faulting application start time: 0x01d792a5b7701a91
Faulting application path: C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE
Faulting module path: C:\Windows\System32\KERNELBASE.dll
Report Id: 1e0015d4-c2ea-4be7-93d0-849232939214
Faulting package full name: 
Faulting package-relative application ID: 
Event Xml:
  <System>
    <Provider Name="Application Error" />
    <EventID Qualifiers="0">1000</EventID>
    <Version>0</Version>
    <Level>2</Level>
    <Task>100</Task>
    <Opcode>0</Opcode>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2021-08-16T13:53:28.5019831Z" />
    <EventRecordID>86251</EventRecordID>
    <Correlation />
    <Execution ProcessID="0" ThreadID="0" />
    <Channel>Application</Channel>
    <Computer>DESKTOP-VAMV8QV</Computer>
    <Security />
  </System>
  <EventData>
    <Data>EXCEL.EXE</Data>
    <Data>16.0.14228.20250</Data>
    <Data>610dc117</Data>
    <Data>KERNELBASE.dll</Data>
    <Data>10.0.19041.1151</Data>
    <Data>891df6d3</Data>
    <Data>e0434352</Data>
    <Data>0000000000034ed9</Data>
    <Data>efc</Data>
    <Data>01d792a5b7701a91</Data>
    <Data>C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE</Data>
    <Data>C:\Windows\System32\KERNELBASE.dll</Data>
    <Data>1e0015d4-c2ea-4be7-93d0-849232939214</Data>
    <Data>
    </Data>
    <Data>
    </Data>
  </EventData>
</Event>

bpie...@gmail.com

unread,
Aug 16, 2021, 11:30:58 AMAug 16
to Excel-DNA
Hi Govert -- I think I can say with a little more confidence that this results from some change in v1.5. The same crash did happen again shortly after I sent those event log details. I reverted to version 1.1.1 and no crash has been witnessed since.

Govert van Drimmelen

unread,
Aug 16, 2021, 3:48:10 PMAug 16
to Excel-DNA
I'd love to track the problem down, though it might take some effort.
For a start, could you post the exact Excel version you're seeing this with?

The next big step would be to confirm that the same error happens even without the IntelliSense loaded.
You should be able to disable IntelliSense without changing your add-in by setting an environment variable called EXCELDNA_INTELLISENSE_DISABLEDVERSIONS and making the value * (meaning all versions are disabled).

Next up, apart from IntelliSense, there is not much code from the Excel-DNA side that runs when Excel closes.
Maybe you can indicate which of these features you use:
* Installing COM event handlers for Application or Workbook events from your code.
* Custom Task Panes - are you using these?
* An RTD server or something like the ExcelAsync.Run or ExcelAsync.Observe features that depend on RTD.
* Ribbon extension

I can't think of many changes that relate to the shutdown sequence where Excel-DNA has changed between version 1.1 and 1.5.
One special case is where there is an access violation error we sometimes see during shutdown, where the .NET runtime changes the exception handling behaviour depending on whether the library is built targeting .NET 2.0 or .NET 4.x. For Excel-DNA we have changed to targeting .NET 4.x in the build and added the [HandleCorruptedStateException] attribute where I expect the problem.
But the error you are seeing is not an access violation, but a more general error in the .NET runtime.

Of course anything you can do to make a reproducible case that I can try out would be wonderful.
There might be some way to set Windows up to let you attach a debugger when the process crashes.

Otherwise we'll need to make some more instrumented versions to figure out where things are going wrong.

-Govert

bpie...@gmail.com

unread,
Aug 19, 2021, 3:40:53 PMAug 19
to Excel-DNA
Hi Govert,

I'm glad to help any way I can. I'm using x64 Excel version 2107 (Build 14228.20250 Click-to-Run) on Windows 2010.

I'll disable IntelliSense and report back, but on the other questions:
(1) Yes, I handle various workbook events including the BeforeClose event (code has not changed in ages)
(2) I do not use custom Task Panes at all
(3) I have a couple reg-free RTD servers, but I do not use ExcelAsync at all
(4) Yes, I do use the ribbon extension

I had spent some time trying to recreate, but it's so sporadic that I'm not confident at all that I'll be able to devise some a reproducible case. I'll spend some time running and closing in the VS debugger, though, since that tends to trap more low-level exceptions and if it does may provide a little more insight into where it's happening.

I'm happy to try running with versions that are instrumented with deeper trace logging as needed.

Brian

Govert van Drimmelen

unread,
Aug 20, 2021, 4:21:39 PMAug 20
to exce...@googlegroups.com

Hi Brian,

 

> I'll disable IntelliSense and report back

Thank you – that would be the first area to identify or eliminate.

 

You could also add a handler for AppDomain.CurrentDomain.UnhandledException in your add-in and just write the Exception.ToString() to a file or something.

The crash code you see in the event log indicates that it is an unhandled exception from the .NET runtime, so maybe we get lucky.

bpie...@gmail.com

unread,
Aug 23, 2021, 11:07:23 AMAug 23
to Excel-DNA
I've been mid-move so hectic lately, but planning to run some tests this week. I did already have that unhandled exception handler in place, and unfortunately nothing captured there.

Govert van Drimmelen

unread,
Sep 7, 2021, 4:34:48 PMSep 7
to Excel-DNA
Hi Brian,

Have you been able to revisit this at all, particularly checking without the IntelliSense?
I am thinking of releasing the base Excel-DNA as a start, to see if I can get some more feedback from others too.

Thanks,
Govert

bpie...@gmail.com

unread,
Sep 9, 2021, 7:21:48 AMSep 9
to Excel-DNA
Hi Govert,

Sorry -- I suck. Literally doing this right now. Will hopefully have some info within a couple hours if I can recreate.

Brian

bpie...@gmail.com

unread,
Sep 9, 2021, 8:38:38 AMSep 9
to Excel-DNA
Some prelim results:

  -I am able to recreate periodically in Visual Studio, but it won't trap the Exception even when configured to break on every possible type of Exception.
  -I do still see the crash when Intellisense is disabled (I disabled by literally commenting out the IntelliSenseServer.Install() call and confirmed there was  no intellsense)
  -So far I am *NOT* able to recreate when I remove the ribbon menu. Still trying, but anecdotally so far it seems like it may be related to the ribbon menu

Brian

Govert van Drimmelen

unread,
Sep 9, 2021, 9:38:23 AMSep 9
to exce...@googlegroups.com

Hi Brian,

 

Thank you very much – that’s already very helpful!

 

I realize that happens without changes to your code between the Excel-DNA versions, but it would still help to understand what interactions are involved.

 

  • Do you have aspects of your ribbon that track the active / open workbooks?
  • Are you handling the ribbon OnDisconnection or OnBeginShutdown events?

 

  • Could you try with the ribbon enabled, but all or most of the callbacks commented out?

bpie...@gmail.com

unread,
Sep 9, 2021, 9:38:52 AMSep 9
to Excel-DNA
Well this is frustrating. I am trying to confirm that by re-enabling the ribbon menu I can recreate the crash, but so far no luck at all. I can say for sure that it happened with IntelliSense off, so I don't believe that was related. But Possibly my inability to recreate was not related to removing the ribbon menu.

I'm going to stick with the release candidate. If I can get to a place where I can get it to happen periodically again, I'll try toggling the ribbon on/off to try and confirm if it is related to that.

Brian

bpie...@gmail.com

unread,
Sep 9, 2021, 9:40:45 AMSep 9
to Excel-DNA
Just saw your questions. Will answer in a few...

bpie...@gmail.com

unread,
Sep 9, 2021, 9:55:36 AMSep 9
to Excel-DNA
The ribbon itself does not track active/open workbooks, but I have a UDF that can be used to enable/disable certain menu entries (by setting a in internal flag for whether the entry should be visible then calling invalidate to reset the ribbon). In the case where I saw a crash, that method was not used at all so I don't believe it would have been a factor (though since that menu was not used, it means that all of my default menus remained invisible ...so a menu existed, but no items visible). I do have the OnBeginShutdown() event defined ...and it calls a static method on another class that is intended to do any pre-close cleanup ...but at present I see all I have in that method is a comment haha, so it's a noop.

As noted in my last message, it's possible that the disappearance of the crash when I disabled the menu is a coincidence since I can't recreate now even after re-enabling the menu. If I can get it to happen periodically again, I'll try commenting out the callbacks to see if that makes a difference.

Brian

bpie...@gmail.com

unread,
Sep 9, 2021, 10:54:02 AMSep 9
to Excel-DNA
Not related to the menu. It happened again in my add-in that had the menu enabled, so I switched to using a version that had the menu support entirely removed ...and after several attempts I did get it to happen again. I then disabled BOTH IntelliSense and the ribbon menu, and after many attempts was again able to see the issue. So I don't think it's related to either of them. Not sure what the next steps would be -- if you want to iterate on my trying versions with deeper trace logging, I'll make it a priority to recreate with those. That said, no need to jump through any hoops on my account as version 1.1.1 is working great for me.

Brian

bpie...@gmail.com

unread,
Oct 11, 2021, 4:47:22 PMOct 11
to Excel-DNA
Hi Govert,

I am again attempting to recreate this, this time with FirstChance exceptions being logged. I have not yet been able to make it happen with that logging enabled ...so of course not impossible it was related to some resource cleanup my add-in was doing that was somehow exposed in the release candidate but which has been cleaned up on my side... but FYI about a couple things that were logged:

(1) Some Exception from HRESULT in IntelliSense (almost certainly not related to crash since crash occurred with IntelliSense disabled before and also not causing a crash now):

    Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))
       at Microsoft.Office.Interop.Excel.Sheets.get__Default(Object Index)
   at ExcelDna.IntelliSense.WorkbookIntelliSenseProvider.WorkbookRegistrationInfo.Refresh()

(2) Some attempt to access registry that fails due to lack of permission:

    Access to the registry key 'HKEY_CLASSES_ROOT\_ExcelDna_PermissionsTest_Machine' is denied.
       at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str)

Will report back if I'm able to recreate with FirstChance exception logging and anything worthwhile captured.

Brian

bpie...@gmail.com

unread,
Oct 13, 2021, 3:33:15 PMOct 13
to Excel-DNA
No further occurrences yet. At this point I can only assume there was something in my code that was exposed by upgrading but that I've since corrected. I'm planning to stay on the release candidate, and will report back if I ever do see it again.

Brian

Govert van Drimmelen

unread,
Oct 13, 2021, 3:45:22 PMOct 13
to exce...@googlegroups.com

Hi Brian,

 

Thank you for the follow-up and checking some more.

I think I’ll make the release candidate the official release, and we’ll see if anyone else runs into trouble.

 

Regarding the first-change exceptions:

  • Your (1): The IntelliSense implementation is very tricky to get right, but in this case I’m checking the Sheets collection for a workbook with a specific name. I don’t know whether looping through all the sheets and checking names myself would be better.
  • Your (2): For the registry access I don’t know of a good way to check access other than trying and dealing with the exception. So these first-change exceptions are ‘by design’ until someone comes up with a better plan.

 

Thanks again for the effort!

bpie...@gmail.com

unread,
Oct 14, 2021, 8:33:59 AM (13 days ago) Oct 14
to Excel-DNA
Doh - it did just happen again this morning, of course after I sent that last message (it's amazing how that works haha). Regrettably nothing logged by FirstChance exception. I don't think it's a show-stopper since only happens very infrequently when closing, so your plan to roll it and see if it occurs elsewhere seems fine to me. I'm always happy to try and recreate with some test versions as needed.

Brian
Reply all
Reply to author
Forward
0 new messages