SharpGenTools / SharpGen.Runtime.COM

COM runtime support for SharpGen generated interop code.
MIT License
13 stars 7 forks source link

Equality members and operators for COM objects #5

Closed nerzhulart closed 5 years ago

nerzhulart commented 5 years ago

Add equality members and operator overloads to support classic COM objects comparison behavior (when you compares references in classic COM it checks theirs underlying objects).

We have a lot of code in our debugger where we compare COM objects just as references. After migration to SharpGen I've faced with a lot of issues because reference equality fails because SharpGen creates new objects instead of using the single proxy per each real native object. Since it's very hard to find all such code I just added equality operator and everythig started to work well. I guess other developer can face with the same problem while migrating their projects from classic COM

jkoritzinsky commented 5 years ago

Do we want to do this at the CppObject layer instead of the ComObject layer? Or do we want to limit this to just the COM support?

nerzhulart commented 5 years ago

Do we want to do this at the CppObject layer instead of the ComObject layer? Or do we want to limit this to just the COM support?

Hm. I thought about it but wasn't sure if any native interop needs this behavior, so decided to add this only for COM. If you think that it's good idea to add these operators for base CppObject I can move the changes into main repo