"Member not found" error in C# add-in

Top  Previous  Next

As mentioned in other blog posts (e.g. here and here) as well, using Embed Interop Types = True with the Inventor interop assembly does not work well.


Apart from some events not firing, you might not find all the properties either. E.g. in the case of a Parameter object, when doing this:


var unitType = param.get_Units();


I get this error:


{"Member not found. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))"}


So just set Embed Interop Types to False:






Just for completeness' sake (though the above solution should solve the problem), there could be another way as well to avoid this error.

You could declare a dynamic variable for the parameter (in order to use late-binding) and access the property through that:


dynamic p = param;

var unitType = p.Units;


- Adam



Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)