[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 367
  • Last Modified:

'System.ArgumentException' in VB.NET Add - in

I'm trying to write an Add -in for PowerPoint(2003) ib VB.Net
But I get an exception on the stage of "OnConnection" method of Connect class.
My code goes like this :  
Public Sub OnConnection(ByVal application As Object, ByVal connectMode As Extensibility.ext_ConnectMode, ByVal addInInst As Object, ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnConnection
        MsgBox("On Connection In MyAddin")
        'Instance of COM add-in
        addInInstance = addInInst
        'Check if we entered into PowerPoint
        If TypeOf application Is PowerPoint.Application Then
            PowerPointApp = CType(application, PowerPoint.Application)

        End If

        ' If you aren't in startup, manually call OnStartupComplete.
        If (connectMode <> Extensibility.ext_ConnectMode.ext_cm_Startup) Then _
           Call OnStartupComplete(custom)

    End Sub


After debugging this method i get :
A first chance exception of type 'System.ArgumentException' occurred in PowerPointAddInn.dll

I have no idea why this happends - may be you kow the reason? ???
  • 2
1 Solution
Does the error actually stop your code from executing? Often FirstChanceExceptions won't prevent your code from running.
vbaprojectAuthor Commented:
You right - the error doesn't stop the code from executing but i'm trying to prevent future problems and thus i'm looking for an answer at the beginning.
I suspect the exception will be significant later on...
It is likely that the following is happening

Somewhere internally to .NET an exception is thrown and handled, however because you have the debugger attached you can see this by way of a FirstChanceException. Running without the debugger you wouldn't even be aware of this. In this instance I would ignore the exception and reevaluate if it appears during system testing.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now