.NET 4.0 Security Hides Properties from Reflection APIs

Joined
Apr 23, 2012
Messages
1
Reaction score
0
Hello,
We are noticing that properties in some of the MSProject interop assembly object which were previously accessible via reflection in .NET 3.5 are now not accessible.

For example, the following used to work in 3.5

Type mspAssignmentType = Type.GetType(typeof(MSProject.Assignment).AssemblyQualifiedName);

PropertyInfo propInfo = mspAssignmentType.GetProperty("Start",BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static); // this returns null in .NET 4.0

The second line returns a PropertyInfo object in 3.5 but in .NET 4.0 it returns null.

Could someone familiar with the security model changes explain whether these properties can be accessed in 4.0 and if so, how we can go about doing that?

Thanks,
-Robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top