dotnet/wpf · error · ArgumentException

SR.Format(SR.AxNoConnectionPoint, eventInterface.Name)

Error message

SR.Format(SR.AxNoConnectionPoint, eventInterface.Name)

What it means

ConnectionPointCookie connects a COM event interface via IConnectionPointContainer.FindConnectionPoint. If no connection point is found for the requested event interface (ex == null after the attempt), the constructor throws ArgumentException with SR.AxNoConnectionPoint naming the interface.

Solutions

  1. Confirm the ActiveX control actually supports the event interface (check its type library/IID)
  2. Connect after the control is fully created and initialized
  3. Use the correct event interface type exposed by the interop assembly

Example fix

// before
new ConnectionPointCookie(ax, sink, typeof(WrongEventsInterface));
// after
new ConnectionPointCookie(ax, sink, typeof(IAxMyControlEvents)); // IID the control actually supports
Defensive patterns

Strategy: try-catch

Validate before calling

var cpc = (IConnectionPointContainer)comObject; cpc.EnumConnectionPoints(...); // verify IID of eventInterface is present before constructing cookie

Try / catch

try { var cp = new ConnectionPointCookie(obj, sink, typeof(IMyEvents)); } catch (ArgumentException) { /* object lacks this connection point */ }

Prevention

When it happens

Trigger: new ConnectionPointCookie(unk, sink, eventInterfaceType) where the COM object does not implement IConnectionPointContainer or has no connection point IID for eventInterface.

Common situations: Wiring an event sink to an ActiveX control that doesn't expose that event interface; wrong event interface type (IID mismatch); control not yet fully initialized/created when connecting.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14). Data as JSON: /api/errors/20753cc4a2291489. Report an issue: GitHub.

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/Controls/ConnectionPointCookie.cs:78

                    }
                }
            }
            else
            {
                ex = new InvalidCastException(SR.AxNoConnectionPointContainer);
            }


            if (connectionPoint == null || cookie == 0)
            {
                if (connectionPoint != null)
                {
                    Marshal.FinalReleaseComObject(connectionPoint);
                }

                if (ex == null)
                {
                    throw new ArgumentException(SR.Format(SR.AxNoConnectionPoint, eventInterface.Name));
                }
                else
                {
                    throw ex;
                }
            }
        }

        /// <summary>
        /// Disconnect the current connection point.  If the object is not connected,
        /// this method will do nothing.
        /// </summary>
        internal void Disconnect()
        {
            if (connectionPoint != null && cookie != 0)
            {
                try
                {

View on GitHub (pinned to 81131a70a4)