This is a longstanding issue with Office plugins: they do not provide a SynchronizationContext .
As I mentioned in my blog, you can get around this to make sure you have the correct SynchronizationContext . This is a bit hacky, but it works:
private async void SearchPaneButton_Click(object sender, EventArgs e) { if (SynchronizationContext.Current == null) SynchronizationContext.SetSynchronizationContext(new WindowsFormsSynchronizationContext()); await SearchAsync(); } private async Task SearchAsync() { var searchText = SearchTextBox.Text; SearchPaneButton.Text = "Loadingβ¦"; var data = await new DataServiceClient().GetDataAsync(searchText); SearchPaneButton.Text = "Search"; ToggleWorkbookEvents(); }
Regarding the issue of event triggering, I have no idea.
source share