Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot be used across assembly boundaries because it has a generic type parameters that is an embedded interop type

Tags:

vb.net

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?

like image 564
prem Avatar asked Aug 05 '14 06:08

prem


2 Answers

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.

like image 96
JasonS Avatar answered Nov 17 '22 07:11

JasonS


Changing the return type from List(Of mshtml.IHTMLDocument2) to IList(Of mshtml.IHTMLDocument2) or IEnumerable(Of mshtml.IHTMLDocument2) resolves the issue.

like image 29
prem Avatar answered Nov 17 '22 05:11

prem