Expand Minimize
0 out of 3 rated this helpful - Rate this topic

'<membername>' cannot expose type '<typename>' outside the project through <containertype> '<containertypename>'

A variable, procedure parameter, or function return is exposed outside its container, but it is declared as a type that must not be exposed outside the container.

The following skeleton code shows a situation that generates this error.

Private Class privateClass
End Class
Public Class mainClass
    Public exposedVar As New privateClass
End Class

A type that is declared Protected, Friend, Protected Friend, or Private is intended to have limited access outside its declaration context. Using it as the data type of a variable with less restricted access would defeat this purpose. In the preceding skeleton code, exposedVar is Public and would expose privateClass to code that should not have access to it.

Error ID: BC30909

To correct this error

  • Change the access level of the variable, procedure parameter, or function return to be at least as restrictive as the access level of its data type.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.