Reputation: 3538
I am facing this error on changing a Sub to a Function in VB.Net
Type System.Collection.Generic.List(Of mshtml.IHTMLDocument2) cannot be used across assembly boundaries because it has a generic type parameters that is an embedded interop type.
Does anyone knows how to get it resolved?
Upvotes: 14
Views: 5960
Reputation: 7733
I fixed this by making sure that all assemblies had "Embed Interop Types" to FALSE.
It seems that usually when you use a COM library that parameter is set to true by default.
Upvotes: 17
Reputation: 3538
Changing the return type from List(Of mshtml.IHTMLDocument2) to IList(Of mshtml.IHTMLDocument2) or IEnumerable(Of mshtml.IHTMLDocument2) resolves the issue.
Upvotes: 17