Quantcast
Channel: SharpDevelop Community
Viewing all articles
Browse latest Browse all 1764

Debugging, using Netoffice & events

$
0
0

I'm trying to inspect variables while debugging, in Visual Studio all works fine. In SD all works fine except when debugging within a NetOffice event handler. In the below code if I break within myOlItems_ItemAdd sub, I can't inspect any vars and everything freezes in outlook and the app. I'm sure this has something to do with threads but if anyone can confirm this and why and if there is a workaround I'd appreciate it.

This is easy to reproduce by running the below code with netoffice installed (nuget Install-Package NetOffice.Excel -Version 1.7.3) any and all versions exibit this problem including in C#. i'm running SD version 4.4.2.9749 vb.net, but still happens in 5.X c# or vb.net.

Thanks

-TD

Imports Outlook = NetOffice.OutlookApi

Imports NetOffice.OutlookApi.Enums

Public Partial Class MainForm

Public Sub New()

   Me.InitializeComponent()

End Sub

Sub Button1Click(sender As Object, e As EventArgs)

  Dim outlookApplication As New Outlook.Application()

  Dim objNS As Outlook._NameSpace = outlookApplication.GetNamespace("MAPI")

  Dim inboxFolder As Outlook.MAPIFolder = objNS.GetDefaultFolder(OlDefaultFolders.olFolderInbox)

  Dim olInboxItems As Outlook.Items = CType(inboxFolder.Items, Outlook.Items)

  Dim ItemAdded As Outlook.Items_ItemAddEventHandler = AddressOf Me.myOlItems_ItemAdd

      AddHandler olInboxItems.ItemAddEvent, ItemAdded

End Sub

Private Sub myOlItems_ItemAdd(ByVal Item As Object)

Debugger.break

MessageBox.Show("Made it here")

End Sub

End Class

 


Viewing all articles
Browse latest Browse all 1764

Trending Articles