Excel-DNA / ExcelDna

Excel-DNA - Free and easy .NET for Excel. This repository contains the core Excel-DNA library.
https://excel-dna.net
zlib License
1.26k stars 270 forks source link

The ribbon is no longer loaded since today's Excel Beta Version 2310 Build 16924.20002. #642

Closed tomhafner closed 5 months ago

tomhafner commented 9 months ago

The ribbon is not loaded in either old (Framework 4.6) or current ExcelDNA (.net6). It still worked yesterday with Excel version 16924.20000.

govert commented 9 months ago

Please report to Microsoft too - at least from the File -> Feedback -> Send a Frown.

slovebj commented 8 months ago

The problem is that after updating Excel to version 2310 (16924.20002), the ribbon can display, but the CustomTaskPane (CTP) cannot. Upon investigation, it was found that the following statement is not running normally: CustomTaskPane ctp = CustomTaskPaneFactory.CreateCustomTaskPane(typeof(CTPControl), "CTPname")。The problem was not present in earlier versions.

govert commented 8 months ago

@slovebj If you've tried to update your add-in project to .NET 6, you might be running into this CTP-related problem: https://groups.google.com/g/exceldna/c/onRDZLJwoBY/m/ddsjBDbsBAAJ

Otherwise, if the only change is the Excel version, please report to Microsoft.

gmichaud commented 8 months ago

Our team is experiencing the same thing -- ribbon no longer displays when opening XLL or starting from Visual Studio, but works fine when installed from .msi.

govert commented 8 months ago

Hi @gmichaud - Are you running the same Beta version of Excel? When you say "installed from .msi", do you mean a non Excel-DNA COM add-in that implements the ribbon interface, and is registered normally?

Please also press the "Send a Frown" button to report this to Microsoft.

tomhafner commented 8 months ago

If you open the AddIn (xll file) for the second time in the same Excel instance, it also works...

wh1t3cAt1k commented 8 months ago

@govert it's the same ExcelDNA-based add-in which we register in the AutoOpen registry key during the MSI-based installation.

It's only the F5 from VS or double-clicking the XLL that is not working (ribbon does not get displayed).

I have already confirmed that even a complete reinstallation of Excel or cleaning up all add-in related registry keys don't help.

MichaelAnckaert commented 8 months ago

I'm also seeing this issue on the current build: Microsoft® Excel® for Microsoft 365 MSO (Version 2310 Build 16.0.16924.20042) 64-bit. Issue also reported to Microsoft.

govert commented 8 months ago

If you

Maybe the problem relates to how we try to get hold of the Application COM object during start-up. This has been very problematic over the years, and Microsoft have fiddled from their side often - they've broken, fixed and re-broken stuff here in the past.

govert commented 8 months ago

They've also been working on the add-in initialization sequence because our ad-hoc add-in loading was interfering with their add-in event raising sequence, so that's another possible cause of the problem. But that's less likely as it sounds like the problem happens with no other add-ins installed, just loading the Excel-DNA one at startup.

govert commented 8 months ago

Sometimes these problems do get fixed before the release version 🙏

Domchix commented 8 months ago

Same issue for users that have 2310 version, when trying to create CTP, it throws a null reference exception. Using the overload public static CustomTaskPane CreateCustomTaskPane(object userControl, string title); .NET 4.6.1 ExcelDna 1.5.1 image

ittegrat commented 8 months ago

My findings are:

Tested with ExcelDna 1.7.0-rc7 (.NET Framework) and this simple addin (rename it to *.dna) ExcelDna64.txt

govert commented 8 months ago

I can reproduce the problem with the Beta Channel Version 2311 Build 16.0.17005.20000 and I have reported it through the Send a Frown button. I've also added my vote to the post here: https://feedbackportal.microsoft.com/feedback/idea/bb5bcdc1-0f61-ee11-a81c-000d3ae46fcb

It doesn't seem related to getting hold of the COM objects as I first thought. The COM calls to load the Ribbon add-in seem to succeed without error.

I sometimes see a security bar flash up and then disappear (below the formula bar, above the sheet). I don't know what it says. When I add the .xll folder as a Trusted Location, that doesn't seem to happen anymore, but the ribbon still does not load.

I will investigate further . . . and other insights are very welcome.

govert commented 8 months ago

I think I've found a fairly safe workaround by tuning the COM add-in load calls. I'll test a bit more and then make an updated preview soon.

govert commented 8 months ago

OK, could you try v1.7.0-rc8 please? It looks like some toggling of the add-in properties is enough to make it work.

tomhafner commented 8 months ago

Hi, the ribbon work, but the CTP not... Null Reference Exception in CustomUI.CustomTaskPaneFactory.CreateCustomTaskPane

govert commented 8 months ago

OK, I see the CustomTaskPane problem - it's very confusing what Excel is doing here . . .

ittegrat commented 8 months ago

For me, with the latest Excel beta version (17005.20000) and .Net Framework 4.8, it doesn't work; I need to reload the addin to show the Ribbon and reload one more time to be able to show the CTP. I don't know if this info can help, but I noticed a change in Excel with the add-in user interface errors. I enabled the option Show add-in user interface errors and I've declared a non existent procedure in the onLoad attribute of the customUI. With the current and previous versions of Excel, if I open the program and I close and create new workbooks multiple times, and then I open the addin, Excel shows me the error multiple times. With the last working version (both on the beta and current preview channel) it shows me the error only once. In general, with the old versions I see Excel open -> n*(ctrl+w -> ctrl+n) -> load addin -> (n+3)*errors; after that, only on ctrl+n when a new window is created. With the last working version, I just see one error when I load the addin (and after that, only on ctrl+n), no matter how many times I create and destroy workbooks and windows. This behavior is identical with both ExcelDna rc4 and rc7.

govert commented 8 months ago

@ittegrat I made a newer Excel-DNA 1.7.0-rc8 today which did let the ribbon work for me, but the CTP is still broken - you mention rc7, which is not the right one to test for that. What is happening in the problem Excel version is that the COM add-ins are being (partially) loaded by Excel during the early calls to Application.COMAddIns and Application.COMAddIns.Update. It's aprtly loaded in the sense that the ribbon interface GetCustomUI() is not called at this stage. Then when we call addIn.Connect = true this does not do anything for already-partly-loaded add-ins. Adding addIn.Connect = false before does an unload and allows a 'full' reload after. But the CTP (and general Excel-DNA Com add-in loading) mechanism is confused by the extra loads and unexpected event sequence. I know Microsoft was working on improving the COM add-in events, so that might have triggered the changes from their side. I'm not sure how much to fiddle with this while it's a beta Excel version that is behaving like this - maybe they'll fix it or revert before a release 🤞

govert commented 8 months ago

OK, I've gone a bit further and pushed an update to NuGet as 1.7.0-rc9. Please let me know how it looks and if you are able to test with a beta version or an Excel release version from before these troubles.

HeidiSem commented 8 months ago

ribbon and CTP seem to work with 1.7.0-rc9 with the latest beta version 2311 (Build 17005.200000) Out of interest, what was the problem with the ctp?

ittegrat commented 8 months ago

Quick tested and working both Ribbon and CTP with:

I'll do more tests in the next few days.

govert commented 8 months ago

Out of interest, what was the problem with the ctp?

tomhafner commented 8 months ago

I don't know yet whether I should be happy about the solution or not, because since there is a solution, Microsoft refuses to correct it....?

Feedback from Microsoft:

Well, I’ve double checked internally, and we could share the following:

First, we were thinking if that's specific to ExcelDNA only, then the question should get to the ExcelDNA developers first and If there is a repro with a normal XLAM or VSTO/COM add-in, we can look at it, of course.

Hence, we’ve checked the following link and found an update two days ago stated that the issue has been resolved, thus, can you please double check this at your end.

govert commented 8 months ago

How big a problem do you think this is going to be if the Excel release looks like the beta?

Excel-DNA is a library used to make other add-ins, and I have no telemetry to estimate how widespread use (or use of specific features) might be. Do I understand it right?

@tomhafner Maybe you could respond to Microsoft with a suggestion that they indicate the above (or at least some helpful information) in the release notes. The relevant Excel behavior, and Excel-DNA implementation, had been stable for 15 years.

chrish29 commented 8 months ago

Hello to add my experience as I have also noticed the ribbon not loading too. We have 2 Ribbon UI's that load on start up and in a scenario where the add in was already working it is only the 2nd Ribbon UI that doesn't appear load so we end up with half our ribbon buttons. On a clean machine it doesn't load at all!

Also, Version 2310 was posted to the Current channel last night that contains the issue. It hit my dev machine this morning,

govert commented 8 months ago

@chrish29 Thanks for the additional feedback and confirming the problem release to the Current channel.

Have you been able to check whether Excel-DNA version 1.7.0-rc9 fixes your two ribbon scenario?

I think I will publish a final 1.7.0 release over the weekend with the workaround as it is in 1.7.0-rc9.

chrish29 commented 8 months ago

Hi @govert, Yes 1.7.0-rc9 does fix our ribbon scenario. We have tested it now in all sorts of environments! Thanks.

We rarely use custom task panes so haven't seen that side of things.

govert commented 8 months ago

The problem was present in the initial release of 2310 to the Current Channel - Version 2310 Build 16.0.16924.20054. After doing an Update Now, the problem is not present in Version 2310 Build 16.0.16924.20124.

It looks like they have reverted the changes which caused this problem.

mike3sullivan commented 8 months ago

Confirmed that 1.7.0-rc9 fixed the problems with .Net 6-based add-in and that Excel's Build 16.0.16924.20124 fixed the (embarrassingly) old v0.34.6 .Net Framework 4.7.2-based add-in.

Is there going to be any reprecussions from 1.7.0-rc9 now that Excel's behaviour has changed back?

chrish29 commented 8 months ago

It looks like they have reverted the changes which caused this problem.

Yep, I am seeing the same.