I've been trying to implement IMessageFilter in C# and found something that puzzles me. My initial attempt to manually create the interop interface type and use it resulted in lots of access violations.
I then found an article online with a declaration of COM's IMessageFilter that I guess maybe they generated using tlbimp and it has all these attributes
MethodCodeType = MethodCodeType.Runtime)]
and adding these attributes everywhere means I stop getting Access violations. This gives me a bunch of questions
1) In IMessageFilter interface, there are HRESULTS everywhere but I don't see anything which is [Out Ref], so I don't undrstand why PreserveSig would
make any difference here?
2) Is the MethodImplOptions.InternalCall important? Why? What does it really mean?
3) MethodCodeType = Runtime - apparently MethodCodeType is for use only by compiler writers. So why would it matter whether I include it here or not?
And in summary, what has probably made the difference to whether I am getting access violations or not?
View Complete Post