{"record":{"id":"20753cc4a2291489","repo":"dotnet/wpf","slug":"sr-format-sr-axnoconnectionpoint-eventinterface-name","errorCode":null,"errorMessage":"SR.Format(SR.AxNoConnectionPoint, eventInterface.Name)","messagePattern":"SR\\.Format\\(SR\\.AxNoConnectionPoint, eventInterface\\.Name\\)","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/Controls/ConnectionPointCookie.cs","lineNumber":78,"sourceCode":"                    }\n                }\n            }\n            else\n            {\n                ex = new InvalidCastException(SR.AxNoConnectionPointContainer);\n            }\n\n\n            if (connectionPoint == null || cookie == 0)\n            {\n                if (connectionPoint != null)\n                {\n                    Marshal.FinalReleaseComObject(connectionPoint);\n                }\n\n                if (ex == null)\n                {\n                    throw new ArgumentException(SR.Format(SR.AxNoConnectionPoint, eventInterface.Name));\n                }\n                else\n                {\n                    throw ex;\n                }\n            }\n        }\n\n        /// <summary>\n        /// Disconnect the current connection point.  If the object is not connected,\n        /// this method will do nothing.\n        /// </summary>\n        internal void Disconnect()\n        {\n            if (connectionPoint != null && cookie != 0)\n            {\n                try\n                {","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/Controls/ConnectionPointCookie.cs#L60-L96","documentation":"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.","triggerScenarios":"new ConnectionPointCookie(unk, sink, eventInterfaceType) where the COM object does not implement IConnectionPointContainer or has no connection point IID for eventInterface.","commonSituations":"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.","solutions":["Confirm the ActiveX control actually supports the event interface (check its type library/IID)","Connect after the control is fully created and initialized","Use the correct event interface type exposed by the interop assembly"],"exampleFix":"// before\nnew ConnectionPointCookie(ax, sink, typeof(WrongEventsInterface));\n// after\nnew ConnectionPointCookie(ax, sink, typeof(IAxMyControlEvents)); // IID the control actually supports","handlingStrategy":"try-catch","validationCode":"var cpc = (IConnectionPointContainer)comObject; cpc.EnumConnectionPoints(...); // verify IID of eventInterface is present before constructing cookie","typeGuard":null,"tryCatchPattern":"try { var cp = new ConnectionPointCookie(obj, sink, typeof(IMyEvents)); } catch (ArgumentException) { /* object lacks this connection point */ }","preventionTips":["Verify the event interface IID exists in the control's type library","Connect sinks only after full control initialization","Use the interop assembly's declared event interface, not a look-alike"],"tags":["wpf","com","activex","connection-point"],"backgroundTag":"missing-dependency","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}