I have a standard Form
with only a AxWMPLib.AxWindowsMediaPlayer
and no code except autogenerated. I get System.ArgumentException
twice on every app start. It says, that object does not provide IPropertyNotifySink
interface. But how to implement it, since I haven't got namespace, which contains it (Microsoft.VisualStudio.OLE.Interop)? And what I have to do in implemented functions (OnChanged(Int32)
and OnRequestEdit(Int32)
)?

- 1,822
- 5
- 28
- 50
-
Did you change any properties or did you just add the component and debugged? – Visual Vincent Aug 24 '16 at 14:41
-
@VisualVincent Just added the component, nothing more. – JustLogin Aug 24 '16 at 14:47
-
Strange, what OS are you using? – Visual Vincent Aug 24 '16 at 14:55
-
@VisualVincent Windows 7. – JustLogin Aug 24 '16 at 14:56
-
What happens if you reset the list of exceptions to break on? `Debug > Windows > Exception Settings > Reset`? – Visual Vincent Aug 24 '16 at 15:03
-
@VisualVincent exactly the same. – JustLogin Aug 24 '16 at 15:06
-
And you have no specific line where the error is thrown? – Visual Vincent Aug 24 '16 at 15:08
-
It's in autogenerated line in Form1.Designer.cs: ((System.ComponentModel.ISupportInitialize)(this.axWindowsMediaPlayer1)).EndInit(); – JustLogin Aug 24 '16 at 15:11
-
1[From what I've been able to find so far](https://social.msdn.microsoft.com/Forums/vstudio/en-US/816ef365-0d7b-4587-9959-1534b924bde0/source-object-does-not-expose-ipropertynotifysink-event-interface-error-only-when-debugging?forum=vsdebug) resetting the exceptions should fix the issue. Please make sure that `System.ArgumentException` isn't still checked when you reset. – Visual Vincent Aug 24 '16 at 15:15
-
@VisualVincent Isn't it a bad practice, ignoring exceptions? Also, it's unchecked, but I still see it in diagnostics panel. – JustLogin Aug 24 '16 at 15:20
-
1You are not ignoring the exceptions, you are just ignoring those already handled by a `try/catch` block. The _unhandled exceptions_, which will cause your application to stop execution, will still be thrown. – Visual Vincent Aug 24 '16 at 15:26
-
At the moment I cannot find or come up with anything more for you to try. And as I've never experienced the exception myself I will not be able to try it. I'm afraid I can't do much more at this point. :/ – Visual Vincent Aug 24 '16 at 15:31
1 Answers
This is a normal mishap. A well-behaved ActiveX object ought to implement the IPropertyNotifySink interface (an unmanaged COM interface) but it is not required to do so. The AxHost wrapper class just blindly assumes it does, so tries to subscribe it, but the internal ConnectionContainer constructor discovers that it doesn't.
Which is not fatal, since implementing the interface is optional, AxHost calls the constructor with the throwException argument set to false. So you see the first-chance exception raised in the debugger but then it catches it again and returns. Fwiw, that code could have very easily been written so you'd never see the exception at all, but the Microsoft programmer took a shortcut with a catch-em-all exception handler. Just annoying, that's all.
It is definitely not your job to implement the interface, it is control's job. So trying to implement OnChanged() and OnRequestEdit() doesn't make sense.
Just keep motoring, you don't have a real problem.

- 922,412
- 146
- 1,693
- 2,536
-
-
1To allow an ActiveX host to report changes to stock properties that have ambient behavior. The Font property would be a standard example, a control normally uses the same font as its parent. BackColor is another one. Doesn't apply to WMP, it is not the kind of control that behaves like the ones you find back in the WPF or Winforms toolbox. – Hans Passant Aug 24 '16 at 20:42