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)
)?
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.