<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Feedback on Link and Disjunctive Demands</title><link>http://blogs.msdn.com/b/shawnfa/archive/2005/02/16/374580.aspx</link><description>In the spirit of gathering feedback from the community, here are two more feature areas we're interested in knowing how you use: Have you ever encountered the need to use a LinkDemand for a permission that did not inherit from CodeAccessPermission. (For</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Feedback on Link and Disjunctive Demands</title><link>http://blogs.msdn.com/b/shawnfa/archive/2005/02/16/374580.aspx#390411</link><pubDate>Wed, 09 Mar 2005 12:07:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:390411</guid><dc:creator>Nicole Calinoiu</dc:creator><description>Oops... I missed the friend assemblies aspect of this that Michele caught.  I've already responded to a similar recommendation to use friend assemblies in place of identity permissions at &lt;a target="_new" href="http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=e6d03969-e4f1-4b81-a051-2540429efee2"&gt;http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=e6d03969-e4f1-4b81-a051-2540429efee2&lt;/a&gt;.  In case you don't want to wade through that mess, my two main points from there are:&lt;br&gt;&lt;br&gt;1.  One might want to expose a semi-public API to assemblies that don't yet exist at the time the API is released.&lt;br&gt;&lt;br&gt;2.  Not all internally visible types and members should necessarily form part of a semi-public API.&lt;br&gt;&lt;br&gt;I also agree with Michele's point concerning reflection, but it'll become largely irrelevant if fully trusted code passes all identity permissions since most code that has permission to reflect into internally visible members acquires that permission via a full trust grant.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=390411" width="1" height="1"&gt;</description></item><item><title>re: Feedback on Link and Disjunctive Demands</title><link>http://blogs.msdn.com/b/shawnfa/archive/2005/02/16/374580.aspx#381109</link><pubDate>Sun, 27 Feb 2005 05:09:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:381109</guid><dc:creator>Michele Leroux Bustamante</dc:creator><description>&amp;quot;Whidbey also introduced friend assemblies, which can help you achieve the same goal.&amp;quot;&lt;br&gt;&lt;br&gt;I have a real issue with recommending friend assemblies to achieve the same goal:&lt;br&gt;1. This couples assemblies. You have to specify the assembly name for the InternalsVisibleToAttribute, but what you more likely want to do is specify which &amp;quot;strong name callers&amp;quot; can access all of your types. With StrongNameIdentityPermissionAttribute I can (yes, for each type) specify a group of callers by their private key signature - i.e., approved partners or more likely &amp;quot;our&amp;quot; assemblies).&lt;br&gt;&lt;br&gt;2. InternalsVisibleTo does not prevent reflection over types and members, even if those types/members are internal/protected/private. StrongNameIdentityPermissionAttribute does protect private members (et. al.) if you apply it at the type level (it can't be applied to fields). &lt;br&gt;&lt;br&gt;IMHO on very rare occasions should friend assemblies be leveraged.&lt;br&gt;Thankfully, now we have DemandChoice to specify multiple valid strong name demands/linkdemands.&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=381109" width="1" height="1"&gt;</description></item><item><title>re: Feedback on Link and Disjunctive Demands</title><link>http://blogs.msdn.com/b/shawnfa/archive/2005/02/16/374580.aspx#374721</link><pubDate>Wed, 16 Feb 2005 20:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:374721</guid><dc:creator>Nicole Calinoiu</dc:creator><description>a) So far, only in scenarios for which DemandChoice would be a better option.  That said, I do have a plan to use a custom non-CAS permission that would be quite expensive to verify under certain conditions.  Having the option to use a LinkDemand where appropriate could help avoid some performance bottlenecks.&lt;br&gt;&lt;br&gt;b) There are scenarios where I would find DemandChoice to be very useful.  For example, when invoking a managed wrapper that calls into an unmanaged API (e.g.: OpenFileDialog), the managed wrapper often maps from some other permission onto UnmanagedCode permission.  In this sort of situation, I might want to be able to use DemandChoice to force all calling code to have either UnmanagedCode permission or the permission demanded by the managed wrapper.  (In the OpenFileDialog example, this might mean asserting FileDialogPermission after making a  disjunctive demand for FileDialogPermission or UnmanagedCode permission.)&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=374721" width="1" height="1"&gt;</description></item><item><title>re: Feedback on Link and Disjunctive Demands</title><link>http://blogs.msdn.com/b/shawnfa/archive/2005/02/16/374580.aspx#374646</link><pubDate>Wed, 16 Feb 2005 19:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:374646</guid><dc:creator>Sebastien Pouliot</dc:creator><description>a) Yes I've already implemented something like that using a custom (non CAS) IPermission based class. LinkDemand was cheaper to use (but a full Demand would have worked).&lt;br&gt;&lt;br&gt;b) The only time I missed that feature (1.0/1.1) was for grouping multiple identity permissions together. We prefered using declarative security (as much as possible) to allow &amp;quot;easier reviewing&amp;quot; of the permissions. However I much prefer using declarations at a class/method level than at the assembly level.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=374646" width="1" height="1"&gt;</description></item></channel></rss>