I have a method with a default parameter:
void Test(int? iRange = null);
When trying to expose my class to COM, I get a warning:
Type library exporter encountered an generic type instance in a signature. Generic code may not be exported to COM. Is it possible to some how expose this method?
Edit Sorry, i think this is to do with the nullable parameter (not the default parameter) I copied the original method signature incorrectly.
I came across something like this a couple of years ago, COM does not support generics and so anything you expose to COM must be generics free.
In this case "int? iRange" is just shorthand for "Nullable<int> iRange" and as such causes the error. You may have to find another way to express whatever it is you use null to express. You could add another argument or use an otherwise unused value of iRange (0, -1 and int.MinValue come to mind as possibilities - I would recommend providing the value as a const if you choose this option).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With