AssertTypeIsAccessible vs IsNestedPublic

Mar 11, 2008 at 9:52 AM

Consider this example:

public class a { public class b { public static bool doIt() { return true; } } }

It is impossible to execute

...Imports.AddMethod ("doIt", typeof (b), "Functions");

because it says "Type 'b' is not accessible to the expression."


typeof(b).IsNestedPublic == true && typeof(b).DeclaringType != null && typeof(b).DeclaringType.IsPublic == true && typeof(b).DeclaringType.DeclaringType == null;

Does it make sense to consider this case? The DeclaringType chain can be long, and the check should be done through all the chain. But if everything is public... what do you think?
Mar 12, 2008 at 3:24 AM
I didn't want to put in the restriction that the types available to an expression have to be public; especially if they don't have to be. If an expression is compiled with an expression owner, then it can access all internal types in the same module as the owner.

I think I just have to tweak the relevant code to handle nested types and I think it should be quick to compute.
Mar 29, 2008 at 3:14 AM
This has been fixed in Flee-