APTCA and Custom Attributes

Haibo just posted an excellent article about what happens when you use reflection to get a custom attribute across trust boundaries.  The specific situation he talks about is when you have:

  1. A fully trusted assembly defining a custom attribute

  2. A partially trusted assembly containing that attribute in its metadata

  3. A fully trusted assembly reflecting over the partial trust assembly

It’s another case where APTCA can bite you if you’re not careful … and in this case the behavior might be quite surprising.  Definitely worth a read.

Comments (2)

  1. Peter says:

    When your RSS feed is posting via ".NET Framework Featured Blogs", I get broken links. This page links to blogs.msdn.com, but the links in the RSS body are msdn.microsoft.com.

    RSS from your site directly is good.

  2. Hmm, thanks for reporting that Peter.  I’ll forward it on to the MSDN admin to take a look.