<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="http://www.codeplex.com/rss.xsl"?><rss version="2.0"><channel><title>patterns &amp; practices SharePoint Guidance</title><link>http://spg.codeplex.com/project/feeds/rss</link><description>We develop guidance to help devs and architects build applications on SharePoint. </description><item><title>New Post: Can't find xUnit file in MS Visual Web Developer Express</title><link>http://spg.codeplex.com/discussions/317883</link><description>&lt;div style="line-height: normal;"&gt;
&lt;div&gt;&lt;span style="border-collapse:separate; color:#000000; font-family:Arial; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px; font-size:medium"&gt;I
 have integrated NUnit as an external tool in MS Visual Web Devloper Express. This works fine, with the following parameters:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="border-collapse:separate; color:#000000; font-family:Arial; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px; font-size:medium"&gt;&lt;br&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="border-collapse:separate; color:#000000; font-family:Arial; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px; font-size:medium"&gt;Arguments:
 &amp;nbsp; &amp;nbsp;/run $(ProjectDir)/$(ProjectFileName)&lt;/span&gt;
&lt;div&gt;&lt;span style="border-collapse:separate; color:#000000; font-family:Arial; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px; font-size:medium"&gt;&lt;br&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="border-collapse:separate; color:#000000; font-family:Arial; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px; font-size:medium"&gt;Initial
 directory: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$(ProjectDir)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="border-collapse:separate; color:#000000; font-family:Arial; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px; font-size:medium"&gt;When
 I try to use exactly the same parameters for xUnit, I get two messages:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="border-collapse:separate; color:#000000; font-family:Arial; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px; font-size:medium"&gt;&amp;nbsp;
 -&amp;nbsp; Error loading assembly. Could not find file c:\run&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="border-collapse:separate; color:#000000; font-family:Arial; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px; font-size:medium"&gt;&amp;nbsp;
 -&amp;nbsp; Could not find file:&amp;nbsp; c:\Documents and Settings\...........................\myProject.Tests\xunit.dll&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="border-collapse:separate; color:#000000; font-family:Arial; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px; font-size:medium"&gt;I
 would be grateful for any advice.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</description><author>OldGrantonian</author><pubDate>Thu, 16 Feb 2012 11:43:29 GMT</pubDate><guid isPermaLink="false">New Post: Can't find xUnit file in MS Visual Web Developer Express 20120216114329A</guid></item><item><title>New Post: SharePoint 15 and SharePoint Guidance</title><link>http://spg.codeplex.com/discussions/310364</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Hi, SharePoint 15 is around the corner. Do you already have plans on:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Is there going to be a SP15 version of SharePoint Guidance implemented? &lt;/li&gt;&lt;li&gt;Any schedule estimate for this (before RTM, after RTM...)? &lt;/li&gt;&lt;li&gt;How can we best prepare our apps using SP2010 version of &amp;#65279;SharePoint Guidance for migration to SP15?
&lt;/li&gt;&lt;/ul&gt;
&lt;/div&gt;</description><author>hhtech1</author><pubDate>Mon, 13 Feb 2012 12:22:03 GMT</pubDate><guid isPermaLink="false">New Post: SharePoint 15 and SharePoint Guidance 20120213122203P</guid></item><item><title>New Post: Addding a Custom SiteMapProvider to the SiteMap Provider section of the Web.config</title><link>http://spg.codeplex.com/discussions/291166</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;I am writing a feature receiver to add an entry for a custom SiteMapProvider to the Site Map Provider section of the web.config. I'm working with SharePoint 2007. I am considering using&amp;nbsp;SPWebConfigModification but I am also looking at the Guidance Library.
 Can I use&amp;nbsp;IConfigManager to update that section in the web.config? What would you recommend?&lt;/p&gt;
&lt;/div&gt;</description><author>xelaju</author><pubDate>Fri, 03 Feb 2012 15:13:56 GMT</pubDate><guid isPermaLink="false">New Post: Addding a Custom SiteMapProvider to the SiteMap Provider section of the Web.config 20120203031356P</guid></item><item><title>New Post: Adding DiagnosticsCategory to DefaultArea</title><link>http://spg.codeplex.com/discussions/288010</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Im having some problems adding new diagnostics categories to the default area. Does anyone have a working example og how i can do that?&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;</description><author>nowisee</author><pubDate>Tue, 31 Jan 2012 12:43:04 GMT</pubDate><guid isPermaLink="false">New Post: Adding DiagnosticsCategory to DefaultArea 20120131124304P</guid></item><item><title>Commented Issue: LogToOperations - Category [4250]</title><link>http://spg.codeplex.com/workitem/4250</link><description>Missing a map from the string representation of an enum of the category back to a  short to display in the Windows Event Log. The category in the windows event log always shows &amp;#34;None&amp;#34;.&lt;br /&gt;Comments: ** Comment from web user: aeberhar ** &lt;p&gt;I&amp;#39;m still seeing this problem.  Will it be fixed&amp;#63;&lt;/p&gt;</description><author>aeberhar</author><pubDate>Thu, 26 Jan 2012 00:34:50 GMT</pubDate><guid isPermaLink="false">Commented Issue: LogToOperations - Category [4250] 20120126123450A</guid></item><item><title>New Post: Servicelocator causing Activate Features to fail</title><link>http://spg.codeplex.com/discussions/238390</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;hmm....if you are setting the site, then it will save the type mapping at the site collection level, not the farm level.&amp;nbsp; Since this operation stores the settings for the site collection level in the property bag of the root site it will work.&amp;nbsp; If you did not set the site, then the type mappings are stored to the farm property bag.&amp;nbsp; SharePoint prevents writing to the farm property bag from a content web, so it will cause a security exception if you try to do this from feature activated (unless it is a farm scoped feature).&amp;nbsp; Also you really only want to register the setting once - what happens if you activate the feature in mulitple places within the farm?&lt;/p&gt;
&lt;p&gt;In order to clear the cache for the service locator, call the Reset method - this will clear the cache.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;</description><author>ckeyser</author><pubDate>Fri, 09 Dec 2011 21:35:57 GMT</pubDate><guid isPermaLink="false">New Post: Servicelocator causing Activate Features to fail 20111209093557P</guid></item><item><title>New Post: Servicelocator causing Activate Features to fail</title><link>http://spg.codeplex.com/discussions/238390</link><description>&lt;div style="line-height: normal;"&gt;&lt;blockquote style="padding-bottom: 0px; font-style: italic; margin: 0.25em 1em 0px; padding-left: 0.25em; padding-right: 0.25em; padding-top: 0px; border: #ccc 0.1em solid;"&gt;&lt;strong&gt;jmillman wrote:&lt;/strong&gt;&lt;br /&gt;
&lt;blockquote style="padding-bottom: 0px; font-style: italic; margin: 0.25em 1em 0px; padding-left: 0.25em; padding-right: 0.25em; padding-top: 0px; border: #ccc 0.1em solid;"&gt;&lt;strong&gt;ckeyser wrote:&lt;/strong&gt;&lt;br /&gt;
&lt;p&gt;I believe I see two issues in the above stack trace:&lt;/p&gt;
&lt;p&gt;- You must register your services in the &lt;em&gt;FeatureInstalled&lt;/em&gt; event.&amp;nbsp; Registering services writes to the farm level configuration, which is not permitted from a content web, and that is where FeatureActivated will often run.&amp;nbsp; The documentation appears incorrect in this regard.&amp;nbsp; I let the team know it needs to be updated.&lt;/p&gt;
&lt;p&gt;- You must register the events for the event log on each web front end.&amp;nbsp; This is true when using the SharePoint logging - this is not a specific requirement of the p&amp;amp;p logger, it's a dependency on the underlying SharePoint logging infrastructure.&amp;nbsp; The content web doesn't have sufficient permission to create the events for the event log, which writes to the registry.&amp;nbsp; There is a helper class for this as well, DiagnosticsAreaEventSource.&amp;nbsp; You can either do this from a command line app, or you can write a timer job.&amp;nbsp; Let me know if you need an example for a timer job and I will write a blog post with an example.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;br /&gt;Hi,&lt;/p&gt;
&lt;p&gt;Is there any way to do this in feature activated?&amp;nbsp; It seems like the real reason to use this is so that I can change the provider at run time, via a feature activation for instance. I can actually do it and it will work, but only when I deploy the wsp via Visual Studio with auto activation.&amp;nbsp; I really don't want to have an admin have to run a power shell script, or have to hit central admin to swap my provider.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here is my code:&lt;/p&gt;
&lt;p&gt;IServiceLocatorConfig typeMappings = serviceLocator.GetInstance&amp;lt;IServiceLocatorConfig&amp;gt;();&lt;br /&gt;IServiceLocator serviceLocator = SharePointServiceLocator.GetCurrent();&lt;br /&gt;typeMappings.RemoveTypeMapping&amp;lt;IContextService&amp;gt;(null);&lt;/p&gt;
&lt;p&gt;The error that happens if I try to toggle the feature activation in site settings:&lt;/p&gt;
&lt;p&gt;Configsetting with key 'Microsoft.Practices.SharePoint.Common.TypeMappings' could not be set 'Microsoft.Practices.SharePoint.Common.ServiceLocation.ServiceLocationConfigData' with type 'Microsoft.Practices.SharePoint.Common.ServiceLocation.ServiceLocationConfigData'. The technical exception was: System.Security.SecurityException: Access denied.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;br /&gt;I actually got it to work without error by setting the site to the current site in feature activation.&amp;nbsp; While this does get around the error, the service doesn't swap out until I do an iisreset.&amp;nbsp; Is there any way to swap the service on the fly?&lt;/p&gt;&lt;/div&gt;</description><author>jmillman</author><pubDate>Fri, 09 Dec 2011 14:34:57 GMT</pubDate><guid isPermaLink="false">New Post: Servicelocator causing Activate Features to fail 20111209023457P</guid></item><item><title>New Post: Servicelocator causing Activate Features to fail</title><link>http://spg.codeplex.com/discussions/238390</link><description>&lt;div style="line-height: normal;"&gt;&lt;blockquote style="padding-bottom: 0px; font-style: italic; margin: 0.25em 1em 0px; padding-left: 0.25em; padding-right: 0.25em; padding-top: 0px; border: #ccc 0.1em solid;"&gt;&lt;strong&gt;ckeyser wrote:&lt;/strong&gt;&lt;br /&gt;
&lt;p&gt;I believe I see two issues in the above stack trace:&lt;/p&gt;
&lt;p&gt;- You must register your services in the &lt;em&gt;FeatureInstalled&lt;/em&gt; event.&amp;nbsp; Registering services writes to the farm level configuration, which is not permitted from a content web, and that is where FeatureActivated will often run.&amp;nbsp; The documentation appears incorrect in this regard.&amp;nbsp; I let the team know it needs to be updated.&lt;/p&gt;
&lt;p&gt;- You must register the events for the event log on each web front end.&amp;nbsp; This is true when using the SharePoint logging - this is not a specific requirement of the p&amp;amp;p logger, it's a dependency on the underlying SharePoint logging infrastructure.&amp;nbsp; The content web doesn't have sufficient permission to create the events for the event log, which writes to the registry.&amp;nbsp; There is a helper class for this as well, DiagnosticsAreaEventSource.&amp;nbsp; You can either do this from a command line app, or you can write a timer job.&amp;nbsp; Let me know if you need an example for a timer job and I will write a blog post with an example.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;br /&gt;Hi,&lt;/p&gt;
&lt;p&gt;Is there any way to do this in feature activated?&amp;nbsp; It seems like the real reason to use this is so that I can change the provider at run time, via a feature activation for instance. I can actually do it and it will work, but only when I deploy the wsp via Visual Studio with auto activation.&amp;nbsp; I really don't want to have an admin have to run a power shell script, or have to hit central admin to swap my provider.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here is my code:&lt;/p&gt;
&lt;p&gt;IServiceLocatorConfig typeMappings = serviceLocator.GetInstance&amp;lt;IServiceLocatorConfig&amp;gt;();&lt;br /&gt;IServiceLocator serviceLocator = SharePointServiceLocator.GetCurrent();&lt;br /&gt;typeMappings.RemoveTypeMapping&amp;lt;IContextService&amp;gt;(null);&lt;/p&gt;
&lt;p&gt;The error that happens if I try to toggle the feature activation in site settings:&lt;/p&gt;
&lt;p&gt;Configsetting with key 'Microsoft.Practices.SharePoint.Common.TypeMappings' could not be set 'Microsoft.Practices.SharePoint.Common.ServiceLocation.ServiceLocationConfigData' with type 'Microsoft.Practices.SharePoint.Common.ServiceLocation.ServiceLocationConfigData'. The technical exception was: System.Security.SecurityException: Access denied.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;</description><author>jmillman</author><pubDate>Fri, 09 Dec 2011 03:58:07 GMT</pubDate><guid isPermaLink="false">New Post: Servicelocator causing Activate Features to fail 20111209035807A</guid></item><item><title>New Post: Registering type mappings at site collection level, and in sandbox</title><link>http://spg.codeplex.com/discussions/282129</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Update: got this working now at site collection level by adding this line to the type registration code in the feature receiver:&lt;/p&gt;
&lt;div style="color: black; background-color: white;"&gt;
&lt;pre&gt;SharePointServiceLocator.Reset();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description><author>hhtech1</author><pubDate>Thu, 08 Dec 2011 08:30:43 GMT</pubDate><guid isPermaLink="false">New Post: Registering type mappings at site collection level, and in sandbox 20111208083043A</guid></item><item><title>New Post: Registering type mappings at site collection level, and in sandbox</title><link>http://spg.codeplex.com/discussions/282129</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Hi, I can't seem to get service locator type registering working at site collection level. I am using latest download from &lt;a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=23919"&gt;http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=23919&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;First, basic question: we would like to use service locator also in sandbox and in multiple-vendor environments, so we are trying to register types at site collection level instead of farm (to avoid sandboxing issue and to avoid possible mixups when several vendors are using SPG in the farm). Should using service locator in sandbox be possible this way?&lt;/p&gt;
&lt;p&gt;Second, the actual issue. I have a site collection scoped feature, where I try to register the types at site collection level. I get no errors and I can see typemappings added to the collection.&lt;/p&gt;
&lt;p&gt;However when I later come back to retrieve instance, my registered type is not there.&lt;/p&gt;
&lt;p&gt;Should this work in this build?&lt;/p&gt;
&lt;p&gt;Code I try to use for registering our ICustomCache interface in FeatureActivated:&lt;/p&gt;
&lt;div style="color: black; background-color: white;"&gt;
&lt;pre&gt;IServiceLocator serviceLocator = SharePointServiceLocator.GetCurrent();
IServiceLocatorConfig config = serviceLocator.GetInstance&amp;lt;IServiceLocatorConfig&amp;gt;();
config.Site = siteColl;
config.RegisterTypeMapping&amp;lt;ICustomCache, CustomCache&amp;gt;();

&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Code I try to use to get instance of ICustomCache (but at this point mapping does not exist in typeMappingsDictionary):&lt;/p&gt;
&lt;pre&gt;IServiceLocator loc = SharePointServiceLocator.GetCurrent();
ICustomCache cache = loc.GetInstance();
&lt;/pre&gt;
&lt;p&gt;If I change my feature scope to Farm instead of Site, and my feature event to FeatureInstalled instead of FeatureActivated, and remove use of config.Site, then it works. But I would prefer the site collection option.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;</description><author>hhtech1</author><pubDate>Wed, 07 Dec 2011 13:12:23 GMT</pubDate><guid isPermaLink="false">New Post: Registering type mappings at site collection level, and in sandbox 20111207011223P</guid></item><item><title>New Post: SharePoint Logger Proxy in sandbox solution</title><link>http://spg.codeplex.com/discussions/281129</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Did you check the level configured in central admin to make sure it was medium or lower for the default category?&amp;nbsp; The default category if you do not specify one is&amp;nbsp; &lt;span style="color: #a31515;"&gt;SharePoint&amp;nbsp;Guidance &lt;span style="color: #000000;"&gt;and the log level for that category should be at least medium.&amp;nbsp; Also consider defining your own category.&amp;nbsp; if you log events, you will need to register the categories prior to use on each WFE.&amp;nbsp; The guide describes how to do that (writing to the event log causes a category to added to the registry if it doesn't already exist, which is a security issue - therefore it needs to be registered prior to use from a higher privileged process) - this includes the SharePoint Guidance category.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;</description><author>ckeyser</author><pubDate>Tue, 29 Nov 2011 12:27:53 GMT</pubDate><guid isPermaLink="false">New Post: SharePoint Logger Proxy in sandbox solution 20111129122753P</guid></item><item><title>New Post: SharePoint Logger Proxy in sandbox solution</title><link>http://spg.codeplex.com/discussions/281129</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have deployed the sandbox logger proxy solution in SharePoint and the following assemblies are added to the GAC successfully:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Microsoft.Practices.ServiceLocation&lt;/p&gt;
&lt;p&gt;Microsoft.Practices.SharePoint.Common&lt;/p&gt;
&lt;p&gt;Microsoft.Practices.SharePoint.Common.LoggerProxy&lt;/p&gt;
&lt;p&gt;Microsoft.Practices.SharePoint.Common.XmlSerializers&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And added the following code to Trace in logs:&lt;/p&gt;
&lt;p&gt;IServiceLocator serviceLocator = SharePointServiceLocator.GetCurrent();&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p&gt;ILogger logger = serviceLocator.GetInstance&amp;lt;ILogger&amp;gt;();&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p&gt;logger.TraceToDeveloper(&amp;quot;Visual Webpart1 Started&amp;quot;, SandboxTraceSeverity.Medium);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But on executing the sandbox solution, no traces are found. On debugging, always&amp;nbsp;proxyCheckerIsInstalled=0 in&amp;nbsp;ProxyInstalled() method.&lt;/p&gt;
&lt;p&gt;Whether I'm missing some more configuration?&lt;/p&gt;
&lt;/div&gt;</description><author>Mahaprabhu</author><pubDate>Tue, 29 Nov 2011 07:18:45 GMT</pubDate><guid isPermaLink="false">New Post: SharePoint Logger Proxy in sandbox solution 20111129071845A</guid></item><item><title>New Post: [SP logger] access denied when saving areas</title><link>http://spg.codeplex.com/discussions/280519</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Solved the issue with a script from here http://unclepaul84.blogspot.com/2010/06/sppersistedobject-xxxxxxxxxxx-could-not.html. Essentially you change &lt;strong&gt;Microsoft.SharePoint.Administration.SPWebService.ContentService.RemoteAdministratorAccessDenied &lt;/strong&gt;to FALSE.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Cheers&lt;/p&gt;&lt;/div&gt;</description><author>Fusion2k</author><pubDate>Fri, 25 Nov 2011 07:30:22 GMT</pubDate><guid isPermaLink="false">New Post: [SP logger] access denied when saving areas 20111125073022A</guid></item><item><title>New Post: [SP logger] access denied when saving areas</title><link>http://spg.codeplex.com/discussions/280519</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Went through the ULS logs and found this:&lt;/p&gt;
&lt;p&gt;The SPPersistedObject, FarmSettingStore Name=_pnpFarmConfig_, could not be updated because the current user is not a Farm Administrator.&lt;/p&gt;
&lt;p&gt;Feature receiver assembly 'KreiranjePDFporocil, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cd534680f0521697', class 'KreiranjePDFporocil.Features.KreirajPDFporocilaFeature.KreirajPDFporocilaFeatureEventReceiver', method 'FeatureActivated' for feature '06d55510-5328-47d7-a3a6-59d1d860d924' threw an exception: Microsoft.Practices.SharePoint.Common.Configuration.ConfigurationException: Configsetting with key 'Microsoft.Practices.SharePoint.DiagnosticAreas' could not be set 'Microsoft.Practices.SharePoint.Common.Logging.DiagnosticsAreaCollection' with type 'Microsoft.Practices.SharePoint.Common.Logging.DiagnosticsAreaCollection'. The technical exception was: System.Security.SecurityException: Dostop zavrnjen. ---&amp;gt; System.Security.SecurityException: Dostop zavrnjen.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;at Microsoft.SharePoint.Administration.SPPersistedObject.BaseUpdate()&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;at Microsoft.Practices.SharePoint.Common.Configuration.SPFarmPropertyBag.set_Item(String key, String value)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;at Microsoft.Practices.SharePoint.Common.Configuration.ConfigManager.SetInPropertyBag(String key, Object value, IPropertyBag propertyBag)&amp;nbsp; The Zone of the assembly that failed was:&amp;nbsp; MyComputer&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&lt;br /&gt;&amp;nbsp;-- End of inner exception stack trace ---&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;at Microsoft.Practices.SharePoint.Common.Configuration.ConfigManager.SetInPropertyBag(String key, Object value, IPropertyBag propertyBag)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;at Microsoft.Practices.SharePoint.Common.Logging.DiagnosticsAreaCollection.SaveConfiguration()&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;at KreiranjePDFporocil.Features.KreirajPDFporocilaFeature.KreirajPDFporocilaFeatureEventReceiver.FeatureActivated(SPFeatureReceiverProperties properties)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce)&lt;/p&gt;
&lt;p&gt;And am even more confused at what could be wrong.&lt;/p&gt;&lt;/div&gt;</description><author>Fusion2k</author><pubDate>Thu, 24 Nov 2011 07:29:32 GMT</pubDate><guid isPermaLink="false">New Post: [SP logger] access denied when saving areas 20111124072932A</guid></item><item><title>New Post: [SP logger] access denied when saving areas</title><link>http://spg.codeplex.com/discussions/280519</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Checked the "Sharepoint 2010 Timer" service and it's running as Network Service user... so I think that's OK.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;P.S.: the code i'm using in the event reciever&lt;/p&gt;
&lt;p&gt;
&lt;div style="color: black; background-color: white;"&gt;
&lt;pre&gt;&lt;span style="color: green;"&gt;// This helper property builds a collection of areas and categories.&lt;/span&gt;
        DiagnosticsAreaCollection _myAreas = &lt;span style="color: blue;"&gt;null&lt;/span&gt;;
        DiagnosticsAreaCollection MyAreas
        {
            &lt;span style="color: blue;"&gt;get&lt;/span&gt;
            {
                &lt;span style="color: blue;"&gt;if&lt;/span&gt; (_myAreas == &lt;span style="color: blue;"&gt;null&lt;/span&gt;)
                {
                    _myAreas = &lt;span style="color: blue;"&gt;new&lt;/span&gt; DiagnosticsAreaCollection();
                    DiagnosticsArea crmArea = &lt;span style="color: blue;"&gt;new&lt;/span&gt; DiagnosticsArea(&lt;span style="color: #a31515;"&gt;"PorocilniSistem"&lt;/span&gt;);
                    crmArea.DiagnosticsCategories.Add(&lt;span style="color: blue;"&gt;new&lt;/span&gt; DiagnosticsCategory(
                    &lt;span style="color: #a31515;"&gt;"KreiranjePDFporocil"&lt;/span&gt;, EventSeverity.Warning, TraceSeverity.Medium));
                    _myAreas.Add(crmArea);
                }
                &lt;span style="color: blue;"&gt;return&lt;/span&gt; _myAreas;
            }
        }
        
        &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;override&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; FeatureActivated(SPFeatureReceiverProperties properties)
        {
            IConfigManager configMgr = SharePointServiceLocator.GetCurrent().GetInstance&amp;lt;IConfigManager&amp;gt;();
            DiagnosticsAreaCollection configuredAreas = &lt;span style="color: blue;"&gt;new&lt;/span&gt; DiagnosticsAreaCollection(configMgr);
            &lt;span style="color: blue;"&gt;foreach&lt;/span&gt; (DiagnosticsArea newArea &lt;span style="color: blue;"&gt;in&lt;/span&gt; MyAreas)
            {
                &lt;span style="color: blue;"&gt;var&lt;/span&gt; existingArea = configuredAreas[newArea.Name];
                &lt;span style="color: blue;"&gt;if&lt;/span&gt; (existingArea == &lt;span style="color: blue;"&gt;null&lt;/span&gt;)
                {
                    configuredAreas.Add(newArea);
                }
                &lt;span style="color: blue;"&gt;else&lt;/span&gt;
                {
                    &lt;span style="color: blue;"&gt;foreach&lt;/span&gt; (DiagnosticsCategory c &lt;span style="color: blue;"&gt;in&lt;/span&gt; newArea.DiagnosticsCategories)
                    {
                        &lt;span style="color: blue;"&gt;var&lt;/span&gt; existingCategory = existingArea.DiagnosticsCategories[c.Name];
                        &lt;span style="color: blue;"&gt;if&lt;/span&gt; (existingCategory == &lt;span style="color: blue;"&gt;null&lt;/span&gt;)
                        {
                            existingArea.DiagnosticsCategories.Add(c);
                        }
                    }
                }
            }
            configuredAreas.SaveConfiguration();
        }

        &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;override&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
            IConfigManager configMgr = SharePointServiceLocator.GetCurrent().GetInstance&amp;lt;IConfigManager&amp;gt;();
            DiagnosticsAreaCollection configuredAreas = &lt;span style="color: blue;"&gt;new&lt;/span&gt; DiagnosticsAreaCollection(configMgr);
            &lt;span style="color: blue;"&gt;foreach&lt;/span&gt; (DiagnosticsArea area &lt;span style="color: blue;"&gt;in&lt;/span&gt; MyAreas)
            {
                DiagnosticsArea areaToRemove = configuredAreas[area.Name];
                &lt;span style="color: blue;"&gt;if&lt;/span&gt; (areaToRemove != &lt;span style="color: blue;"&gt;null&lt;/span&gt;)
                {
                    &lt;span style="color: blue;"&gt;foreach&lt;/span&gt; (DiagnosticsCategory c &lt;span style="color: blue;"&gt;in&lt;/span&gt; area.DiagnosticsCategories)
                    {
                        &lt;span style="color: blue;"&gt;var&lt;/span&gt; existingCat = areaToRemove.DiagnosticsCategories[c.Name];
                        &lt;span style="color: blue;"&gt;if&lt;/span&gt; (existingCat != &lt;span style="color: blue;"&gt;null&lt;/span&gt;)
                        {
                            areaToRemove.DiagnosticsCategories.Remove(existingCat);
                        }
                    }

                    &lt;span style="color: blue;"&gt;if&lt;/span&gt; (areaToRemove.DiagnosticsCategories.Count == 0)
                    {
                        configuredAreas.Remove(areaToRemove);
                    }
                }
            }
            configuredAreas.SaveConfiguration();
        }

        &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;override&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; FeatureInstalled(SPFeatureReceiverProperties properties)
        {
            DiagnosticsAreaEventSource.EnsureConfiguredAreasRegistered();
        }
&lt;/pre&gt;
&lt;/div&gt;
&lt;/p&gt;&lt;/div&gt;</description><author>Fusion2k</author><pubDate>Thu, 24 Nov 2011 06:49:18 GMT</pubDate><guid isPermaLink="false">New Post: [SP logger] access denied when saving areas 20111124064918A</guid></item><item><title>New Post: [SP logger] access denied when saving areas</title><link>http://spg.codeplex.com/discussions/280519</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Did you change the account the timer job is running under, or permissions for that account?&amp;nbsp; It sounds like the account the event receiver is running under doesn't have permissions to write to farm level configuration.&amp;nbsp;&lt;/p&gt;&lt;/div&gt;</description><author>ckeyser</author><pubDate>Wed, 23 Nov 2011 12:03:07 GMT</pubDate><guid isPermaLink="false">New Post: [SP logger] access denied when saving areas 20111123120307P</guid></item><item><title>New Post: [SP logger] access denied when saving areas</title><link>http://spg.codeplex.com/discussions/280519</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Hello&lt;/p&gt;
&lt;p&gt;As the title indicates i'm having problems with an access denied exception whenever i try to add or remove my areas with the logger. Specifically when i call &amp;quot;configuredAreas.SaveConfiguration();&amp;quot; from FeatureActivated() or FeatureDeactivating(). The rest
 of the cody is copy pasted from the SPG2010 so I don't think the problem is there. The only addition i made is I call EnsureRegisteredAsEventSource in the Feature installed method.&lt;/p&gt;
&lt;p&gt;The funny thing is it worked a day ago :/ and I have no idea what went wrong.&lt;/p&gt;
&lt;p&gt;I am quite lost on what to do and any help would be appreciated...&lt;/p&gt;
&lt;/div&gt;</description><author>Fusion2k</author><pubDate>Wed, 23 Nov 2011 07:52:57 GMT</pubDate><guid isPermaLink="false">New Post: [SP logger] access denied when saving areas 20111123075257A</guid></item><item><title>New Post: SPG 2010 on NuGet</title><link>http://spg.codeplex.com/discussions/278676</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Just wanted to know why you haven't put the SPG ommon dlls on NuGet?&lt;/p&gt;
&lt;/div&gt;</description><author>jole</author><pubDate>Tue, 08 Nov 2011 08:03:05 GMT</pubDate><guid isPermaLink="false">New Post: SPG 2010 on NuGet 20111108080305A</guid></item><item><title>New Post: Logging with custom diagnostic categories from sandbox</title><link>http://spg.codeplex.com/discussions/277978</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;I'm glad you found it.&amp;nbsp; This is an area of the API that is unfortunately not that intuitive, and doesn't use compile time checking so it can be hard more challenging to isolate.&amp;nbsp; In hindsight I would have designed it differently.&lt;/p&gt;&lt;/div&gt;</description><author>ckeyser</author><pubDate>Thu, 03 Nov 2011 11:33:46 GMT</pubDate><guid isPermaLink="false">New Post: Logging with custom diagnostic categories from sandbox 20111103113346A</guid></item><item><title>New Post: Logging with custom diagnostic categories from sandbox</title><link>http://spg.codeplex.com/discussions/277978</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;*sigh*. &amp;nbsp;After all that, I figured out that I was just never in sync with how I was adding categories and then how I was referencing them later. &amp;nbsp;Here's the updated code for any poor soul who may try this same approach:&lt;/p&gt;
&lt;p&gt;
&lt;div style="color: black; background-color: white;"&gt;
&lt;pre&gt;&lt;span style="color: gray;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; LoggingConfigurationEventReceiver.cs&lt;/span&gt;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; System;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Linq;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Runtime.InteropServices;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; Microsoft.SharePoint;

&lt;span style="color: blue;"&gt;using&lt;/span&gt; Microsoft.Practices.SharePoint.Common.Logging;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; Microsoft.Practices.SharePoint.Common.Configuration;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; Microsoft.Practices.SharePoint.Common.ServiceLocation;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; Wingtip.Global.Logging;

&lt;span style="color: blue;"&gt;namespace&lt;/span&gt; Wingtip.Global.Features.LoggingConfiguration
{
	&lt;span style="color: gray;"&gt;///&lt;/span&gt; &lt;span style="color: gray;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
	&lt;span style="color: gray;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; This class handles events raised during feature activation, deactivation, installation, uninstallation, and upgrade.&lt;/span&gt;
	&lt;span style="color: gray;"&gt;///&lt;/span&gt; &lt;span style="color: gray;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
	&lt;span style="color: gray;"&gt;///&lt;/span&gt; &lt;span style="color: gray;"&gt;&amp;lt;remarks&amp;gt;&lt;/span&gt;
	&lt;span style="color: gray;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; The GUID attached to this class may be used during packaging and should not be modified.&lt;/span&gt;
	&lt;span style="color: gray;"&gt;///&lt;/span&gt; &lt;span style="color: gray;"&gt;&amp;lt;/remarks&amp;gt;&lt;/span&gt;

	[Guid(&lt;span style="color: #a31515;"&gt;"5f49c1dd-9204-4c55-9802-ccdc9061f42b"&lt;/span&gt;)]
	&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; LoggingConfigurationEventReceiver : SPFeatureReceiver
	{				
		&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;override&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; FeatureActivated(SPFeatureReceiverProperties properties)
		{
			IConfigManager configMgr = SharePointServiceLocator.GetCurrent().GetInstance&amp;lt;IConfigManager&amp;gt;();
			ILogger logger = SharePointServiceLocator.GetCurrent().GetInstance&amp;lt;ILogger&amp;gt;();
			&lt;span style="color: blue;"&gt;var&lt;/span&gt; areaCollection = &lt;span style="color: blue;"&gt;new&lt;/span&gt; DiagnosticsAreaCollection(configMgr);

			&lt;span style="color: blue;"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue;"&gt;var&lt;/span&gt; area &lt;span style="color: blue;"&gt;in&lt;/span&gt; Areas.AllAreas())
			{
				&lt;span style="color: blue;"&gt;if&lt;/span&gt; (&lt;span style="color: blue;"&gt;null&lt;/span&gt; == areaCollection[area.Name])
				{
					areaCollection.Add(area);
				}
				&lt;span style="color: blue;"&gt;else&lt;/span&gt;
				{
					&lt;span style="color: blue;"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue;"&gt;var&lt;/span&gt; category &lt;span style="color: blue;"&gt;in&lt;/span&gt; area.DiagnosticsCategories)
					{
						&lt;span style="color: blue;"&gt;var&lt;/span&gt; existingArea = areaCollection[area.Name];						
						&lt;span style="color: blue;"&gt;if&lt;/span&gt; (&lt;span style="color: blue;"&gt;null&lt;/span&gt; == existingArea.DiagnosticsCategories[category.Name])
						{
							existingArea.DiagnosticsCategories.Add(category);
						}
					}
				}
			}

			areaCollection.SaveConfiguration();

			logger.TraceToDeveloper(&lt;span style="color: #a31515;"&gt;"Logging areas and categories added."&lt;/span&gt;, 
				String.Format(&lt;span style="color: #a31515;"&gt;"{0}/{1}"&lt;/span&gt;, Areas.Wingtip.Name, Areas.Wingtip.Configuration));
		}

		&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;override&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; FeatureDeactivating(SPFeatureReceiverProperties properties)
		{
			IConfigManager configMgr = SharePointServiceLocator.GetCurrent().GetInstance&amp;lt;IConfigManager&amp;gt;();
			ILogger logger = SharePointServiceLocator.GetCurrent().GetInstance&amp;lt;ILogger&amp;gt;();
			&lt;span style="color: blue;"&gt;var&lt;/span&gt; areaCollection = &lt;span style="color: blue;"&gt;new&lt;/span&gt; DiagnosticsAreaCollection(configMgr);

			logger.TraceToDeveloper(&lt;span style="color: #a31515;"&gt;"Removing areas and categories."&lt;/span&gt;,
				String.Format(&lt;span style="color: #a31515;"&gt;"{0}/{1}"&lt;/span&gt;, Areas.Wingtip.Name, Areas.Wingtip.Configuration));

			&lt;span style="color: blue;"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue;"&gt;var&lt;/span&gt; area &lt;span style="color: blue;"&gt;in&lt;/span&gt; Areas.AllAreas())
			{
				DiagnosticsArea existingArea = &lt;span style="color: blue;"&gt;null&lt;/span&gt;;
				&lt;span style="color: blue;"&gt;if&lt;/span&gt; (&lt;span style="color: blue;"&gt;null&lt;/span&gt; != (existingArea = areaCollection[area.Name]))
				{
					areaCollection.Remove(existingArea);
				}
			}

			areaCollection.SaveConfiguration();
		}

	}
}

&lt;span style="color: gray;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; Areas.cs&lt;/span&gt;

&lt;span style="color: blue;"&gt;using&lt;/span&gt; System;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Collections.Generic;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Linq;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; Microsoft.Practices.SharePoint.Common.Logging;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; Microsoft.SharePoint.Administration;

&lt;span style="color: blue;"&gt;namespace&lt;/span&gt; Wingtip.Global.Logging
{
	&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; Areas
	{
		&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; IEnumerable&amp;lt;DiagnosticsArea&amp;gt; AllAreas()
		{
			&lt;span style="color: blue;"&gt;return&lt;/span&gt; &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(Areas).GetNestedTypes()
				.Where(t =&amp;gt; t.GetCustomAttributes(&lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(AreaAttribute), &lt;span style="color: blue;"&gt;false&lt;/span&gt;).Any())
				.Select(t =&amp;gt; BuildArea(t));
		}

		[Area(Name=&lt;span style="color: #a31515;"&gt;"Wingtip"&lt;/span&gt;)]
		&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; Wingtip
		{
			&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; Name 
			{ 
				&lt;span style="color: blue;"&gt;get&lt;/span&gt; 
				{
					&lt;span style="color: blue;"&gt;var&lt;/span&gt; attr = (AreaAttribute)&lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(Wingtip).GetCustomAttributes(&lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(AreaAttribute), &lt;span style="color: blue;"&gt;false&lt;/span&gt;).First();
					&lt;span style="color: blue;"&gt;return&lt;/span&gt; attr.Name;
				} 
			}

			[Category(DefaultEventSeverity = EventSeverity.Information, DefaultTraceSeverity = TraceSeverity.Verbose)]
			&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; ProductDevelopment
			{
				&lt;span style="color: blue;"&gt;get&lt;/span&gt; { &lt;span style="color: blue;"&gt;return&lt;/span&gt; &lt;span style="color: #a31515;"&gt;"Product Development"&lt;/span&gt;; }
			}

			[Category(DefaultTraceSeverity=TraceSeverity.Verbose, DefaultEventSeverity=EventSeverity.Information)]
			&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; Configuration
			{
				&lt;span style="color: blue;"&gt;get&lt;/span&gt; { &lt;span style="color: blue;"&gt;return&lt;/span&gt; &lt;span style="color: #a31515;"&gt;"Configuration"&lt;/span&gt;; }
			}			
		}

		&lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; DiagnosticsArea BuildArea(Type areaType)
		{
			&lt;span style="color: blue;"&gt;var&lt;/span&gt; cats = &lt;span style="color: blue;"&gt;new&lt;/span&gt; DiagnosticsCategoryCollection();
			&lt;span style="color: blue;"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue;"&gt;var&lt;/span&gt; category &lt;span style="color: blue;"&gt;in&lt;/span&gt; areaType.GetProperties().Where(p =&amp;gt; p.GetCustomAttributes(&lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(CategoryAttribute), &lt;span style="color: blue;"&gt;false&lt;/span&gt;).Any()))
			{
				&lt;span style="color: blue;"&gt;var&lt;/span&gt; catAttr = category.GetCustomAttributes(&lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(CategoryAttribute), &lt;span style="color: blue;"&gt;false&lt;/span&gt;).First() &lt;span style="color: blue;"&gt;as&lt;/span&gt; CategoryAttribute;
				cats.Add(&lt;span style="color: blue;"&gt;new&lt;/span&gt; DiagnosticsCategory(category.GetValue(&lt;span style="color: blue;"&gt;null&lt;/span&gt;, &lt;span style="color: blue;"&gt;null&lt;/span&gt;) &lt;span style="color: blue;"&gt;as&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt;,
					catAttr.DefaultEventSeverity, catAttr.DefaultTraceSeverity));
			}

			AreaAttribute areaAttr = areaType.GetCustomAttributes(&lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(AreaAttribute), &lt;span style="color: blue;"&gt;false&lt;/span&gt;).First() &lt;span style="color: blue;"&gt;as&lt;/span&gt; AreaAttribute;
			&lt;span style="color: blue;"&gt;return&lt;/span&gt; &lt;span style="color: blue;"&gt;new&lt;/span&gt; DiagnosticsArea(areaAttr.Name, cats);
		}
	}
}

&lt;/pre&gt;
&lt;/div&gt;
As for me, my next stop is to see about getting satellite resource assemblies going instead of this craptacular static class arrangement.&lt;/p&gt;&lt;/div&gt;</description><author>aggieben</author><pubDate>Thu, 03 Nov 2011 01:25:31 GMT</pubDate><guid isPermaLink="false">New Post: Logging with custom diagnostic categories from sandbox 20111103012531A</guid></item></channel></rss>
