Excel-DNA / Excel-DNA/ExcelDna

suggested enhancement - flag to indicate to intellisensehelper whether the workbook provider is required

Open
#687 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.5k
Forks
292
Avg merge
20d 12h
Merged PRs (30d)
1

Description

Hi Govert -

WorkbookIntelliSenseProvider throws an System.Runtime.InteropServices.COMException (Invalid Index) in the case we're relying on the DNA provider because the worksheet for the WB provider will not be present. This is a bit messy and trips up the debugger. Can we have a flag to indicate whether it is even required to load it, to avoid this spurious exception?
 
e.g.
```
public IntelliSenseHelper(IsEnableWBProvider)
{
Logger.Initialization.Verbose("IntelliSenseHelper Constructor Begin");
_syncContextMain = new WindowsFormsSynchronizationContext();
_uiMonitor = new UIMonitor(_syncContextMain);
_display = new IntelliSenseDisplay(_syncContextMain, _uiMonitor);

_providers = new List
{
new ExcelDnaIntelliSenseProvider(_syncContextMain)
};
// avoid loading and throwing a spurious exception if not needed
if (IsEnableWBProvider) _providers.Add(new WorkbookIntelliSenseProvider());

RegisterIntellisense();
Logger.Initialization.Verbose("IntelliSenseHelper Constructor End");
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.