
Creating Proxies for Non-Serializable Structs
If your object model contains non-serializable structs, it is strongly recommended that you make them serializable. If for some reason you cannot change the definitions of the structs to make them serializable, you can use ProxyGen.exe to generate proxies for the structs.
However, the generated proxies might not behave as expected in all cases. Because the proxies are defined as classes, rather than structs, this means that the proxies used by the add-in are reference types, and the corresponding structs in the host application are value types. This might cause unpredictable behavior.
To help ensure that the proxies work as expected, the structs in the host application must override the GetHashCode and Equals methods:
GetHashCode must return a hash code that is unique for each instance of the struct.
Equals must return true if the two struct references that are compared refer to the same object, and false if they refer to different objects. The easiest way to do this is to call ReferenceEquals in your implementation of Equals.