<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0' version='2.0'><channel><atom:id>tag:blogger.com,1999:blog-4423400943969518521</atom:id><lastBuildDate>Mon, 21 May 2012 13:06:08 +0000</lastBuildDate><category>Visual Studio</category><category>XSD</category><category>Performance</category><category>HTTPS</category><category>.NET C#</category><category>Model</category><category>AJAX</category><category>MSI</category><category>ASP.NET</category><category>HTTP</category><category>Administration</category><category>Configuration</category><category>Validator</category><category>XDT</category><category>CAST</category><category>CONVERT</category><category>InvalidCastException</category><category>Unity</category><category>Debugging</category><category>Configuration Transformation</category><category>Windows Azure</category><category>Unit Testing</category><category>Error 1001</category><category>Injection</category><category>Twitter OpenAuth oAuth Open Authentication PowerShell Cmdlet</category><category>External Process Debugging</category><category>Unit Test</category><category>XML</category><category>App.config</category><category>IIS</category><category>Service Installer</category><category>Null</category><category>TSQL</category><category>MsBuild Extension Path TFS2010 Microsoft Team Server 2010 Build Source Control TfsSource</category><category>C#</category><category>Remoting</category><category>MVC3</category><category>Slow</category><category>WCF</category><category>Failed Request Tracing</category><category>Argument</category><category>Event Log</category><category>WebRole</category><category>Worker Role</category><category>IIS7</category><category>WHERE failed</category><category>VSTS 2010 Visual Studio 2010 MSBuild BuildID Version Revision</category><category>Installation</category><category>.NET</category><category>ServiceBase EventLog</category><title>AbstractLabs</title><description></description><link>http://blog.abstractlabs.net/</link><managingEditor>noreply@blogger.com (AbstractLabs)</managingEditor><generator>Blogger</generator><openSearch:totalResults>27</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-8151504131611790649</guid><pubDate>Tue, 01 May 2012 17:12:00 +0000</pubDate><atom:updated>2012-05-02T19:04:24.456-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Unity</category><category domain='http://www.blogger.com/atom/ns#'>InvalidCastException</category><category domain='http://www.blogger.com/atom/ns#'>Injection</category><category domain='http://www.blogger.com/atom/ns#'>C#</category><title>Unity, Injection and the surprise InvalidCastException of System.Type</title><description>Chances are if you have run into this message you might be trying to inject your constructor, property or method with a type as a type. &lt;em&gt;The reason?&lt;/em&gt; Default behavior of unity is to resolve a type to an instance and inject it for you. This feature applies to all injection and is not terribly clear in the Unity documentation. It also comes up quite frequently on the &lt;a href="http://stackoverflow.com/questions/tagged/unity" target="_blank"&gt;stackoverflow&lt;/a&gt; unity channel.&lt;br /&gt;An example of the full error message in all it's glory:&lt;br /&gt;&lt;pre class="brush: plain"&gt;&lt;br /&gt;Resolution of the dependency failed, type = \"MyNamespace.IMyInteface\", name = \"(none)\".\r\nException occurred while: &lt;br /&gt;Resolving parameter \"myConstructorParameter\" of constructor MyNamespace.MyClass.Logger(System.Type myConstructorParameter).&lt;br /&gt;Exception is: InvalidCastException - Unable to cast object of type 'MyActualInstanceOfTypeProvidedToConstructor' to type 'System.Type'.&lt;br /&gt;-----------------------------------------------&lt;br /&gt;At the time of the exception, the container was:&lt;br /&gt;&lt;br /&gt;Resolving MyNamespace.MyClass,(none) (mapped from MyNamespace.IMyInterface, (none))\r\n  Resolving parameter \"myConstructorParameter\" of constructor MyClass(System.Type myConstructorParameter)&lt;br /&gt;&lt;/pre&gt;Solving this issue is not as complicated as the error message may seem... for unity. Microsoft did left some flexibility for us, it simply involves wrapping the type argument as an injection parameter:&lt;br /&gt;&lt;pre class="brush: csharp"&gt;&lt;br /&gt;new ParameterOverride("typeParameterArgument",new InjectionParameter(typeof(Type),typeof(MyNamespace.MyClassUsedAsInjectedTypeArgument)))&lt;br /&gt;&lt;/pre&gt;&lt;em&gt;Why?&lt;/em&gt; if you dive into the reflection tool of your choice you will eventually come across "InjectionParameterValue.ToParameter" this little gem will show you that unity is checking to see of the value is an InjectionParameterValue if it is no and the value is a type return a new ResolveParameter using the argument as a type.&lt;br /&gt;References: &lt;ul&gt;&lt;li&gt;&lt;a href="http://stackoverflow.com/questions/5600488/parameteroverride-failing-on-system-type-parameter"&gt;ParameterOverride failing on System.Type parameter&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://kozmic.pl/2008/12/03/unity-framework-and-the-principle-of-the-least-surprise/" target="_blank"&gt;http://kozmic.pl/2008/12/03/unity-framework-and-the-principle-of-the-least-surprise/&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-8151504131611790649?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2012/05/unity-and-invalidcastexception-unable.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-8861601421956709510</guid><pubDate>Thu, 16 Feb 2012 04:44:00 +0000</pubDate><atom:updated>2012-04-27T08:23:56.296-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Model</category><category domain='http://www.blogger.com/atom/ns#'>Argument</category><category domain='http://www.blogger.com/atom/ns#'>Null</category><category domain='http://www.blogger.com/atom/ns#'>MVC3</category><title>MVC3 controller action model argument is null</title><description>After re-naming some controller action arguments I recently discovered a method that was previously working, unexpectedly returning null for the controller action argument. The action used the default model binder pulling data from both the query string and route values. Consider the following code:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp"&gt;&lt;br /&gt;public class Search&lt;br /&gt;{&lt;br /&gt;  public string Name {get;set;}&lt;br /&gt;  public string Query {get;set;}&lt;br /&gt;}&lt;br /&gt;public ActionResult Results(Search query)&lt;br /&gt;{&lt;br /&gt;....&lt;br /&gt;}&lt;br /&gt;....&lt;br /&gt;///results/{Name}&lt;br /&gt;....&lt;br /&gt;///results/monkeys?Query=12-of-them-jumping&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The default model binder rather than binding to the object is trying to take your "Query" and plug it into the action method as an argument. Since string is not "Search" it results in a null value, the short lesson to take from this puzzle is to avoid naming properties on your object the same name as arguments you are passing into the controller action.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-8861601421956709510?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2012/02/mvc3-controller-action-model-argument.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-4073857054529433215</guid><pubDate>Thu, 15 Dec 2011 22:57:00 +0000</pubDate><atom:updated>2012-05-01T07:51:44.296-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>WHERE failed</category><category domain='http://www.blogger.com/atom/ns#'>CONVERT</category><category domain='http://www.blogger.com/atom/ns#'>TSQL</category><category domain='http://www.blogger.com/atom/ns#'>CAST</category><title>TSQL SELECT Convert or Cast DateTime but WHERE fails</title><description>&lt;div&gt;Can a select return when a where fails?&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;div&gt;This zen like question came up this afternoon while digging through some rather raw varchar table data. The answer is yes, and part of answer is coming up with the right question. While googling around I ended up settling on &lt;a href="http://stackoverflow.com/questions/7263501/conversion-to-datetime-fails-only-on-where-clause"&gt;"CONVERT fails in where clause but not in select"&lt;/a&gt;.&lt;/div&gt;&lt;br /&gt;Consider the following problem:&lt;/div&gt;&lt;pre class="brush: sql"&gt;&lt;br /&gt;SELECT * FROM dbo.MyTable&lt;br /&gt;WHERE ISDATE(value)=1 AND AND  CAST(Value AS datetime) &amp;gt; GETUTCDATE()&lt;br /&gt;&lt;br /&gt;--OR&lt;br /&gt;&lt;br /&gt;SELECT * FROM dbo.MyTable&lt;br /&gt;WHERE ISDATE(value)=1 AND CONVERT(datetime,Value) &amp;gt; GETUTCDATE()&lt;br /&gt;&lt;br /&gt;Value&lt;br /&gt;-----------------------&lt;br /&gt;2012-01-02 00:00:00.000&lt;br /&gt;&lt;br /&gt;--BUT&lt;br /&gt;&lt;br /&gt;SELECT CONVERT(datetime,Value) FROM dbo.MyTable&lt;br /&gt;WHERE ISDATE(value)=1&lt;br /&gt;&lt;br /&gt;--OR&lt;br /&gt;&lt;br /&gt;SELECT CAST(Value AS datetime) FROM dbo.MyTable&lt;br /&gt;WHERE ISDATE(value)=1&lt;br /&gt;&lt;br /&gt;Msg 241, Level 16, State 1, Line 1&lt;br /&gt;--HUH?&lt;br /&gt;Conversion failed when converting date and/or time from character string.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div&gt;To paraphrase the above, SQL Server may evaluate rows outside of the expected WHERE clause based on how the optimizer decides to limit the result set. This left me with three solutions:&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;Create an index to persuade the optimizer to avoid the alternate plan that evaluates non date columns (query condition that would allow you to do this not shown in examples. I am sure you can find one if you join a few things and look at the plan.)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Reload cast or converted data into a #temporary table&lt;/li&gt;&lt;br /&gt;&lt;li&gt;My solution below compliments of least resistance add some case logic around the value column&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;pre class="brush: sql"&gt;&lt;br /&gt;SELECT Value FROM dbo.MyTable&lt;br /&gt;WHERE CASE ISDATE(value)=1 THEN CONVERT(datetime,Value)&lt;br /&gt;ELSE NULL END &amp;gt; GETUTCDATE()&lt;br /&gt;--OIC :)&lt;/pre&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;When you think about how SQL Server has to discover the table data it makes sense. If you haven't run into the condition before it may cause a little head scratching. Hopefully with this post and the corresponding &lt;a href="http://stackoverflow.com/questions/7263501/conversion-to-datetime-fails-only-on-where-clause"&gt;stackoverflow&lt;/a&gt; post you can save a few extra hairs on your head.&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-4073857054529433215?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2011/12/tsql-select-convert-or-cast-datetime.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-769550995826375072</guid><pubDate>Tue, 20 Sep 2011 20:05:00 +0000</pubDate><atom:updated>2012-05-02T19:05:03.197-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Configuration</category><category domain='http://www.blogger.com/atom/ns#'>Windows Azure</category><title>Azure Security Certificate Names Are Case Sensitive</title><description>&lt;div&gt;If you receive the following error and are not using a proxy, and do not have Fiddler open, you might have some mixed case somewhere in your certificate name configuration settings:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1:55:36 PM - Warning: There are package validation warnings.&lt;/div&gt;&lt;div&gt;1:55:36 PM - Preparing...&lt;/div&gt;&lt;div&gt;1:55:36 PM - Connecting...&lt;/div&gt;&lt;div&gt;1:55:38 PM - Uploading...&lt;/div&gt;&lt;div&gt;1:56:25 PM - Creating...&lt;/div&gt;&lt;div&gt;1:56:42 PM - HTTP Status Code: 500/nError Message: The server encountered an internal error. Please retry the request./nOperation Id: {GUID}&lt;/div&gt;&lt;div&gt;1:56:43 PM - Deleting Quality Assurance Debug Only - Website&lt;/div&gt;&lt;div&gt;1:56:44 PM - There was no endpoint listening at https://management.core.windows.net/{GUID}/services/hostedservices/website/deploymentslots/Staging that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.&lt;/div&gt;&lt;div&gt;1:56:44 PM - Deployment failed&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-769550995826375072?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2011/09/azure-security-certificate-names-are.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-2719968173634783720</guid><pubDate>Fri, 09 Sep 2011 19:16:00 +0000</pubDate><atom:updated>2012-05-02T19:05:25.112-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Configuration</category><category domain='http://www.blogger.com/atom/ns#'>WebRole</category><category domain='http://www.blogger.com/atom/ns#'>Windows Azure</category><title>Windows Azure Multi-Site Single Role Using Host Headers With Config Transforms</title><description>I was excited to find out that Azure supported multiple sites with a single worker role with a few simple configuration changes thanks to &lt;a href="http://www.wadewegner.com/2011/02/running-multiple-websites-in-a-windows-azure-web-role/"&gt;Wade Wegner's Example&lt;/a&gt;. I was a little disappointed that the process of building the package did not include the XDT transforms on the config. Neither is the website packaged for deployment which strips out all non essential files references in the web application before deploying. After a number of google searches and some trial and error I came up with the following solution:&lt;div&gt;&lt;br /&gt;&lt;br /&gt;In my example I created a single website and associated it to my azure project as the only worker role.&lt;br /&gt;&lt;br /&gt;In the worker role pre-build event I have placed the following for each website that needed to be packaged and transformed:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Cloud Project Pre Build Event&lt;/strong&gt;&lt;br /&gt;&lt;pre class="brush: shell"&gt;&lt;br /&gt;rmdir ..\Deploy.Cloud\Website.Mvc /S /Q&lt;br /&gt;"%systemroot%\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe" "$(ProjectDir)..\Website.Mvc\Website.Mvc.csproj" "/p:Platform=AnyCPU;PackageAsSingleFile=False;Configuration=$(ConfigurationName);DesktopBuildPackageLocation=..\Package\Website.Mvc;PackageAsSingleFile=False;IntermediateOutputPath=..\Deploy.Cloud\Website.Mvc\\" /t:Package&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;em&gt;*You must remove the intermediate location before it creates the package otherwise debug/release configurations will not differ&lt;/em&gt;&lt;/div&gt;&lt;div&gt;&lt;em&gt;&lt;br /&gt;&lt;/em&gt;&lt;/div&gt;&lt;div&gt;&lt;em&gt;*Note the extra slash at the end yes that is intentional if you do not add it you will get some interesting error messages about properties with no value&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ServiceDefinition.csdef&lt;/strong&gt;&lt;br /&gt;&lt;pre class="brush: shell"&gt;&lt;br /&gt;&amp;lt;Site name="Website.Mvc" physicalDirectory="Website.Mvc\Package\PackageTmp"&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What's going on here&lt;/strong&gt;&lt;br /&gt;&lt;div&gt;Every time the cloud project builds it will copy and package the website in the cloud project's project root folder as the website name. Next step is to update the ServiceDefinition.csdef use the intermediate path location for the physicalDirectory. Why? because the package directory contains all of the assets to be deployed as a web deployment project which is not needed when deploying using a web role.&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;References&lt;/em&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;a href="http://www.wadewegner.com/2011/02/running-multiple-websites-in-a-windows-azure-web-role/"&gt;http://www.wadewegner.com/2011/02/running-multiple-websites-in-a-windows-azure-web-role/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.digitallycreated.net/Blog/59/locally-publishing-a-vs2010-asp.net-web-application-using-msbuild"&gt;http://www.digitallycreated.net/Blog/59/locally-publishing-a-vs2010-asp.net-web-application-using-msbuild&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://codingcockerel.co.uk/2008/05/18/how-to-publish-a-web-site-with-msbuild/"&gt;http://codingcockerel.co.uk/2008/05/18/how-to-publish-a-web-site-with-msbuild/&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-2719968173634783720?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2011/09/windows-azure-multi-site-single-role.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-3451786230812648347</guid><pubDate>Wed, 17 Aug 2011 17:42:00 +0000</pubDate><atom:updated>2012-02-15T21:32:19.150-08:00</atom:updated><title>Windows Azure Accelerator for Web Roles Missing Trace Logging By Default</title><description>After upgrading our applications to Windows Azure Accelerator for Web Roles I found that the trace messages disappeared. Windows Azure Accelerator for Web Roles default project does not enable trace logging by default. To fix this simply add the following lines to the WebRole.cs of the Windows Azure Accelerator for Web Role project.&lt;br /&gt;&lt;pre class="brush: csharp"&gt;&lt;br /&gt;private static void ConfigureDiagnosticsMonitor()&lt;br /&gt;{&lt;br /&gt;//... Omitted from example&lt;br /&gt;   // Trace Logs&lt;br /&gt;   diagnosticMonitorConfiguration.Logs.ScheduledTransferLogLevelFilter = LogLevel.Undefined;&lt;br /&gt;   diagnosticMonitorConfiguration.Logs.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);&lt;br /&gt;//... Omitted from example&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-3451786230812648347?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2011/08/windows-azure-accelerator-for-web-roles.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-3329388772926064523</guid><pubDate>Tue, 08 Feb 2011 15:46:00 +0000</pubDate><atom:updated>2012-05-02T19:06:16.560-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Worker Role</category><category domain='http://www.blogger.com/atom/ns#'>XDT</category><category domain='http://www.blogger.com/atom/ns#'>Configuration Transformation</category><category domain='http://www.blogger.com/atom/ns#'>Windows Azure</category><category domain='http://www.blogger.com/atom/ns#'>App.config</category><title>Using XDT with Worker Role App.configs</title><description>&lt;div&gt;Recently I wrote a worker role in windows azure and was hoping the app.config would transform much like the web.config in the web roles. Sadly this is not the case. The configuration transforms are very useful when making a distinction between production, staging and development environments. After a little research, I did discover how to roll my own hopefully Microsoft will extend this feature to the rest of the azure project types. &lt;/div&gt;&lt;br /&gt;&lt;div&gt;Like the web roles this transform is only executed when a deploy is executed, here is how it was done:&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Un-load the project containing your worker role and app.config&lt;/li&gt;&lt;li&gt;Edit the project file at the bottom add the following lines: &lt;pre class="brush: xml"&gt;&lt;br /&gt;&amp;lt;usingtask taskname="TransformXml" assemblyfile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll"&amp;gt;&lt;br /&gt;&amp;lt;target name="AfterCompile" condition="exists('app.$(Configuration).config')"&amp;gt;&lt;br /&gt;&amp;lt;transformxml source="app.config" destination="$(IntermediateOutputPath)$(TargetFileName).config" transform="app.$(Configuration).config"&amp;gt;&lt;br /&gt;&amp;lt;/transformxml&amp;gt;&amp;lt;/target&amp;gt;&lt;br /&gt;&amp;lt;/usingtask&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Add the following Item Group:&lt;pre class="brush: xml"&gt;&lt;br /&gt;&amp;lt;ItemGroup&amp;gt;&lt;br /&gt;&amp;lt;Content Include="App.config" /&amp;gt;&lt;br /&gt;&amp;lt;Content Include="App.Debug.Config"&amp;gt;&lt;br /&gt; &amp;lt;DependentUpon&amp;gt;App.Config&amp;lt;/DependentUpon&amp;gt;&lt;br /&gt; &amp;lt;SubType&amp;gt;Designer&amp;lt;/SubType&amp;gt;&lt;br /&gt;&amp;lt;/Content&amp;gt;&lt;br /&gt;&amp;lt;Content Include="App.Release.Config"&amp;gt;&lt;br /&gt; &amp;lt;DependentUpon&amp;gt;App.Config&amp;lt;/DependentUpon&amp;gt;&lt;br /&gt;&amp;lt;/Content&amp;gt;&lt;br /&gt;&amp;lt;/ItemGroup&amp;gt;&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;Now add the new configuration files to the project App.Debug.config, App.Release.config&lt;/li&gt;&lt;li&gt;Reload the worker role project project&lt;/li&gt;&lt;li&gt;Unload the cloud service project that references the worker role&lt;/li&gt;&lt;li&gt;Open the file for edit and add the following line:&lt;pre class="brush: xml"&gt;&lt;br /&gt;&amp;lt;Target Name="CopyWorkerRoleConfigurations" BeforeTargets="AfterPackageComputeService"&amp;gt;&lt;br /&gt; &amp;lt;Copy SourceFiles="..\{&lt;b&gt;PROJECT PATH&lt;/b&gt;}\obj\$(Configuration)\{&lt;b&gt;ASSEMBLY NAME&lt;/b&gt;}.dll.config" DestinationFolder="$(IntermediateOutputPath)\{&lt;b&gt;PROJECT NAME&lt;/b&gt;}" OverwriteReadOnlyFiles="true"/&amp;gt;&lt;br /&gt;&amp;lt;/Target&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Reload the project file&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;You will need to use the name of your project and the assembly name in the locations above. The paths are relative to the azure service project file. If you get lost you can add an &lt;error&gt; element to the target and set the text to your path.&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/error&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-3329388772926064523?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2011/02/using-xdt-with-worker-role-appconfigs.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-3794026769132948379</guid><pubDate>Sat, 18 Sep 2010 00:35:00 +0000</pubDate><atom:updated>2010-09-17T17:38:27.860-07:00</atom:updated><title>PowerShell Yammer</title><description>What I had learned in my &lt;a href="http://blog.abstractlabs.net/2010/09/powershell-openauthentication-and.html"&gt;last post&lt;/a&gt; I built a small PowerShell snap-in to integrate with the &lt;a href="https://www.yammer.com"&gt;Yammer&lt;/a&gt; API which is better suited for companies. I have started a second &lt;a href="http://psyammer.codeplex.com/"&gt;CodePlex&lt;/a&gt; project specifically for the snap-in.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-3794026769132948379?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2010/09/powershell-yammer.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-4528569832632860146</guid><pubDate>Fri, 03 Sep 2010 21:32:00 +0000</pubDate><atom:updated>2010-09-03T14:44:48.146-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Twitter OpenAuth oAuth Open Authentication PowerShell Cmdlet</category><title>PowerShell OpenAuthentication and Twitter</title><description>Twitter recently depreciated support of Basic Authentication which has made it a little more tricky to post updates via the API. I decided a Cmdlet seemed like the best route to take since the new method required storage of state for the oAuth token. I started a &lt;a href="http://pstwitter.codeplex.com/"&gt;CodePlex&lt;/a&gt; site for those of you who might also need the functionality or would like to contribute.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-4528569832632860146?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2010/09/powershell-openauthentication-and.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-9197084403678460549</guid><pubDate>Sat, 21 Aug 2010 04:15:00 +0000</pubDate><atom:updated>2010-08-20T21:26:07.664-07:00</atom:updated><title>Where Am I.cmd</title><description>After re-installing I have yet again found my static DHCP lease is no longer holding my IP address. I am at home and can't think of another way to find the IP, pinging my machine name continues to resolve to the static lease. If you find your self in the same boat and want to scan the network for IP to name resolution the following script should do the trick:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;@ECHO OFF&lt;br /&gt;FOR /L %%i IN (1,1,254) DO (&lt;br /&gt;ECHO 10.1.1.%%i&lt;br /&gt;nbtstat -A 10.1.1.%%i&lt;br /&gt;)&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-9197084403678460549?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2010/08/where-am-icmd.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-890907867325327425</guid><pubDate>Wed, 18 Aug 2010 04:49:00 +0000</pubDate><atom:updated>2010-08-17T21:59:28.042-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>MsBuild Extension Path TFS2010 Microsoft Team Server 2010 Build Source Control TfsSource</category><title>VSTS 2010 MsBuild Extension Pack TfsSource and Win32Exception: The system cannot find the file specified</title><description>I came across this error while trying to check out a file using MsBuild under TFS2010. The error message is misleading because your first inclination is to check the ItemPath or WorkingDirectory in the task. Had I not come across this forum post I may have been stuck for a bit &lt;a href="http://msbuildextensionpack.codeplex.com/Thread/View.aspx?ThreadId=74209"&gt;http://msbuildextensionpack.codeplex.com/Thread/View.aspx?ThreadId=74209&lt;/a&gt;. The current version of the Extension Pack has some hard coded paths in the task that tell it where to find the tf.exe file. After taking a look at the source code I found if you just add the following path to your Path environment variable the task will function properly.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-890907867325327425?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2010/08/vsts-2010-msbuild-extension-pack.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-419166809387377436</guid><pubDate>Wed, 18 Aug 2010 00:42:00 +0000</pubDate><atom:updated>2010-08-17T20:25:17.819-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>VSTS 2010 Visual Studio 2010 MSBuild BuildID Version Revision</category><title>Where's the Build Number, using MSBuild with VSTS 2010</title><description>I wanted to key the our assembly versions using the VSTS build number I quickly found the solution is not as simple as it seems. At first I thought this property would be a first class member of the IBuildDetail class making it easily accessible in the VSTS workflow but, it's not. After popping open the UpdateBuildNumberActivity I found the build number is actually extracted from the IBuildDetail.Uri. Use the format below in your MsBuild task to gain access to the BuildID and the SourceGetVersion. While the SourceGetVersion may return a sequential change set number (C123) it is not guaranteed to be numeric so it's probably not a good fit for the revision part of your version number. You may consider adding it to your AssemblyConfiguration attribute or AssemblyInformationalVersion attribute. Connecting the change set or source version to the assemblies generated may prove to be useful in troubleshooting version related issues later on.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;String.Format("/p:SkipInvalidConfigurations=true /p:BuildID=""{1}"" /p:SourceGetVersion=""{2}"" {0}", MSBuildArguments, LinkingUtilities.DecodeUri(BuildDetail.Uri.ToString()).ToolSpecificId, BuildDetail.SourceGetVersion)&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-419166809387377436?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2010/08/wheres-build-number-using-msbuild-with.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-6755066483935594426</guid><pubDate>Wed, 11 Aug 2010 21:18:00 +0000</pubDate><atom:updated>2010-08-11T14:36:41.156-07:00</atom:updated><title>More Time Saving Macros Who's Under Source Control</title><description>I am in the process of switching from Subversion to Teams Server source control. Unfortunately when merging project files the source control in teams is not applied causing build errors. Using my last macro as an example I now scan every file in the solution to see if it is in source control and correct if not. One could probably add the extra code to add the item to source control.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Public Module SourceControlScanner&lt;br /&gt;   Private Sub Write(ByVal name As String, ByVal message As String)&lt;br /&gt;       Dim output As Window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput)&lt;br /&gt;       Dim window As OutputWindow = output.Object&lt;br /&gt;       Dim pane As OutputWindowPane = window.OutputWindowPanes.Item(name)&lt;br /&gt;       pane.Activate()&lt;br /&gt;       pane.OutputString(message)&lt;br /&gt;       pane.OutputString(Environment.NewLine)&lt;br /&gt;   End Sub&lt;br /&gt;   Private Sub Scan(ByVal project As Project)&lt;br /&gt;       If Not project.ProjectItems Is Nothing Then&lt;br /&gt;           If TypeOf (project.Object) Is VSProject Then&lt;br /&gt;               Dim visualStudioProject As VSProject = DirectCast(project.Object, VSProject)&lt;br /&gt;               For Each item As ProjectItem In project.ProjectItems&lt;br /&gt;                   For index As Integer = 0 To item.FileCount&lt;br /&gt;                       Dim file As String = item.FileNames(index)&lt;br /&gt;                       If Not visualStudioProject.DTE.SourceControl.IsItemUnderSCC(file) Then&lt;br /&gt;                           Write("Debug", String.Concat(project.Name, " ", item.Name))&lt;br /&gt;                       End If&lt;br /&gt;                   Next&lt;br /&gt;               Next&lt;br /&gt;           End If&lt;br /&gt;           For Each childProjectItem As ProjectItem In project.ProjectItems&lt;br /&gt;               If Not childProjectItem.SubProject Is Nothing Then Scan(childProjectItem.SubProject)&lt;br /&gt;           Next&lt;br /&gt;       End If&lt;br /&gt;   End Sub&lt;br /&gt;   Public Sub CheckSourceControl()&lt;br /&gt;       For Each project As Project In DTE.Solution.Projects&lt;br /&gt;           Scan(project)&lt;br /&gt;       Next&lt;br /&gt;   End Sub&lt;br /&gt;End Module&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-6755066483935594426?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2010/08/more-time-saving-macros-whos-under.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-6127926964365564934</guid><pubDate>Thu, 29 Jul 2010 19:44:00 +0000</pubDate><atom:updated>2012-05-01T08:02:23.961-07:00</atom:updated><title>Hint Paths and The System.Reflection.CustomAttributeFormatException</title><description>With in my organization we use multiple branches and a centralized bin directory within each branch. All of our references are file based and not version specific. There are arguments for why this works or why it should not be done but this implementation has worked for our current architecture. &lt;br /&gt;Now lets say one day you come to work and start in a new branch and find the  System.Reflection.CustomAttributeFormatException after comping a new. And you begin asking your self how did I get here and what have I done this is not my beautiful house this is not my large automobile. After answering those questions and more colleague and I found someone added a rouge reference to a DLL in another branch. Initially this involved some meticulous evaluation of each project and its references. &lt;br /&gt;&lt;br /&gt;I offer you a magnet for your needle in the hay stack the code below can be pasted in to a visual studio macro to scan each project and make sure it is referencing the correct path. (Your paths may vary)&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Imports System&lt;br /&gt;Imports System.Diagnostics&lt;br /&gt;Imports EnvDTE&lt;br /&gt;Imports VSLangProj&lt;br /&gt;Imports System.Collections&lt;br /&gt;&lt;br /&gt;Public Module ReferenceScanner&lt;br /&gt;    Private Path As String&lt;br /&gt;    Private ExcludedPaths As ArrayList&lt;br /&gt;    Private Sub Scan(ByVal project As Project)&lt;br /&gt;        If Not project.ProjectItems Is Nothing Then&lt;br /&gt;            If TypeOf (project.Object) Is VSProject Then&lt;br /&gt;                Dim visualStudioProject As VSProject = DirectCast(project.Object, VSProject)&lt;br /&gt;                For Each reference As Reference In visualStudioProject.References&lt;br /&gt;                    Dim referencePath As String = reference.Path&lt;br /&gt;                    Dim exclude As Boolean = False&lt;br /&gt;                    For Each excludePath As String In ExcludedPaths&lt;br /&gt;                        exclude = referencePath.StartsWith(excludePath)&lt;br /&gt;                        If exclude Then Exit For&lt;br /&gt;                    Next&lt;br /&gt;                    If Not exclude And Not String.IsNullOrEmpty(reference.Path) Then&lt;br /&gt;                        If Not reference.Path.StartsWith(Path) Then&lt;br /&gt;                            Debug.Write(project.Name)&lt;br /&gt;                            Debug.Write(" ")&lt;br /&gt;                            Debug.WriteLine(reference.Path)&lt;br /&gt;                        End If&lt;br /&gt;&lt;br /&gt;                    End If&lt;br /&gt;                Next&lt;br /&gt;            End If&lt;br /&gt;            For Each childProjectItem As ProjectItem In project.ProjectItems&lt;br /&gt;                If Not childProjectItem.SubProject Is Nothing Then Scan(childProjectItem.SubProject)&lt;br /&gt;            Next&lt;br /&gt;        End If&lt;br /&gt;    End Sub&lt;br /&gt;    Public Sub CheckSolutionHintPaths()&lt;br /&gt;        If ExcludedPaths Is Nothing Then&lt;br /&gt;            ExcludedPaths = New ArrayList()&lt;br /&gt;            ExcludedPaths.Add("C:\Windows\Microsoft.NET\Framework\")&lt;br /&gt;            ExcludedPaths.Add("C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\")&lt;br /&gt;            ExcludedPaths.Add("D:\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies\")&lt;br /&gt;        End If&lt;br /&gt;&lt;br /&gt;        Path = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(DTE.Solution.FullName), "bin")&lt;br /&gt;        For Each project As Project In DTE.Solution.Projects&lt;br /&gt;            Scan(project)&lt;br /&gt;        Next&lt;br /&gt;    End Sub&lt;br /&gt;End Module&lt;/pre&gt;&lt;br /&gt;*Dont forget to replace the referenced dll after you have corrected your references&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-6127926964365564934?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2010/07/hint-path-hell-and-systemreflectioncust.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-7026693064303997533</guid><pubDate>Sat, 01 May 2010 22:33:00 +0000</pubDate><atom:updated>2010-08-11T14:37:24.319-07:00</atom:updated><title>Going Going Gone.. catch(T exception)</title><description>While writing some diagnostic code I got clever and tried to use a generic in a catch statement. After spending some time head scratching I came across this stackoverflow article &lt;a href="http://stackoverflow.com/questions/1577760/why-cant-i-catch-a-generic-exception-in-c"&gt;http://stackoverflow.com/questions/1577760/why-cant-i-catch-a-generic-exception-in-c&lt;br /&gt;&lt;/a&gt;&lt;div&gt;apparently while this code compiles without error it results in an uncaught exception. The article refers to a defect in the compiler which indicates it is version specific. A good work around is to use the following code block instead:&lt;br /&gt;&lt;pre&gt;catch(Exception exception) { if(exception is T) {//Your specialized code here;} }&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-7026693064303997533?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2010/05/going-going-gone-catcht-exception.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-1891341356639024084</guid><pubDate>Sun, 18 Apr 2010 16:29:00 +0000</pubDate><atom:updated>2010-04-25T13:55:25.290-07:00</atom:updated><title>RDP Spanning and Multi-Monitor Support</title><description>In older versions of windows that support RDP I have found it is almost impossible to use multi-monitor support across RDP as it was designed (/span). The inability to maximize to monitor boundaries on the local machine is a frustrating limitation. I have tested several configurations and thought I would share my hacktastic findings:&lt;div&gt;&lt;br /&gt;&lt;div&gt;SplitView&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.splitview.com/using-remote-desktop-with-dual-monitors-in-span-mode"&gt;http://www.splitview.com/using-remote-desktop-with-dual-monitors-in-span-mode&lt;/a&gt;&lt;/div&gt;&lt;div&gt;I installed the demo personal edition and could not get the boundaries to work properly. To be honest I felt 39$ was a little steep for what you would be getting.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Sizer&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.brianapps.net/sizer.html"&gt;http://www.brianapps.net/sizer.html&lt;/a&gt;&lt;/div&gt;&lt;div&gt;A good old tool from the 90's is a hidden gem unfortunately it is only 32-bit but this thing is an excellent and cheap alternative. Simply fire it up on your RDP host set your window sizes and positions and your off and running.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For Extra Credit-&lt;/div&gt;&lt;div&gt;If you hate browsing on your RDP host because it bogs down your RDP performance (flash ads mostly). Find a tool that allows you to set your client windows as "Always On Top" so you can use local applications over your spanned and maximized RDP session.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;UPDATE: This solution is primarily geared to those of us still using Vista or XP as either a client or host. Those of you lucky enough to have both windows 7 at both ends can use the multimon feature: &lt;span class="Apple-style-span"   style="  ;font-family:arial;font-size:small;"&gt;&lt;a href="http://blogs.msdn.com/rds/archive/2009/07/01/using-multiple-monitors-in-remote-desktop-session.aspx" target="_blank"&gt;http://blogs.msdn.com/rds/&lt;wbr&gt;archive/2009/07/01/using-&lt;wbr&gt;multiple-monitors-in-remote-&lt;wbr&gt;desktop-session.aspx&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-1891341356639024084?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2010/04/rdp-spanning-and-multi-monitor-support.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-3133692088898649329</guid><pubDate>Thu, 28 Jan 2010 18:13:00 +0000</pubDate><atom:updated>2010-01-28T10:23:14.957-08:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Service Installer</category><category domain='http://www.blogger.com/atom/ns#'>ServiceBase EventLog</category><category domain='http://www.blogger.com/atom/ns#'>Installation</category><category domain='http://www.blogger.com/atom/ns#'>Event Log</category><title>All Your .base</title><description>I encountered some issues with a .NET service installer embedded into an .MSI package today. If you have classes dependent upon service startup in your installer and the service fails to start you will often get some unexpected and often cryptic messages. It gets even worse if your messages are relating to event log messages that wont write because of permissions or other similar issues. One gotcha I am guilty of was using EventLog instead of base.EventLog. I also failed to set the event log location when calling the static version of the method calls. By using base.EventLog the ServiceBase class creates an event log source and applies all messages to the Application log. Do this and all event log messages are not belong to us.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-3133692088898649329?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2010/01/all-your-base.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-2064746828527215953</guid><pubDate>Tue, 26 Jan 2010 20:50:00 +0000</pubDate><atom:updated>2010-01-26T12:53:18.047-08:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>XSD</category><category domain='http://www.blogger.com/atom/ns#'>Validator</category><category domain='http://www.blogger.com/atom/ns#'>XML</category><category domain='http://www.blogger.com/atom/ns#'>.NET C#</category><title>Console XML/XSD Validation Application</title><description>&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Could not find a decent console application to validate an XML file against multiple XSD Schema Documents so I decided to write one and share for any who may need it.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;using System;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;using System.Collections.Generic;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;using System.Linq;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;using System.Text;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;using System.Xml;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;using System.IO;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;using System.Xml.Schema;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;namespace XmlValidator&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;class Program&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;static void Main(string[] args)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;int result = 0;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;string documentPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, args[0]);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;if (!File.Exists(documentPath)) throw new Exception(String.Format("The document '{0}' does not exist", documentPath));&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;List&lt;string&gt; schemaPaths = new List&lt;string&gt;();&lt;/string&gt;&lt;/string&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;foreach (string path in args.Skip(1))&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;string schemaPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, path);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;if (!File.Exists(schemaPath)) throw new Exception(String.Format("The schema document '{0}' does not exist", schemaPath));&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;schemaPaths.Add(schemaPath);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;using (Stream stream = File.Open(documentPath,FileMode.Open,FileAccess.Read,FileShare.ReadWrite))&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;XmlReaderSettings settings = new XmlReaderSettings();&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;settings.ProhibitDtd = false;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;settings.ValidationType = ValidationType.Schema;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;settings.ValidationFlags = XmlSchemaValidationFlags.ReportValidationWarnings;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;settings.ValidationEventHandler += new ValidationEventHandler(&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;     &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;delegate(object sender, ValidationEventArgs e)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;     &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;      &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;result = -1;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;      &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;Console.Write("Line:");&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;      &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;Console.Write(e.Exception.LineNumber);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;      &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;Console.Write(" Position:");&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;      &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;Console.Write(e.Exception.LinePosition);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;      &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;Console.Write(" ");&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;      &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;Console.Write(e.Severity.ToString("G"));&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;      &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;Console.Write(" ");&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;      &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;Console.WriteLine(e.Message);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;     &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;foreach (string path in schemaPaths) settings.Schemas.Add(XmlSchema.Read(XmlReader.Create(path), null));&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;stream.Position = 0;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;XmlReader validator = XmlReader.Create(stream, settings);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;while (validator.Read()) ;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;validator.Close();&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;if (result == 0) Console.WriteLine("Document is valid");&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;#if DEBUG&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;Console.ReadLine();&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;#endif&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;Environment.Exit(result);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-2064746828527215953?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2010/01/console-xmlxsd-validation-application.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-5899261483417215492</guid><pubDate>Tue, 15 Sep 2009 21:38:00 +0000</pubDate><atom:updated>2010-08-11T14:38:07.765-07:00</atom:updated><title>IIS7 64Bit Hang Dump.. The hard way</title><description>&lt;div&gt;&lt;br /&gt;    So I have done so many searches and have not been able to find a half decent way to get a dump when IIS7 running 64bit has hung. DebugDiag even the updated one might run on a 64bit machine but does not seem capable of generating a 64bit crash dump file. The documentation on this subject is pretty poor on the 64b aspect of IIS7 running asp.net. That being said here is how I solved the problem if anyone has a better solution I would love to hear it.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;    The best solution I have found is to install the debugging tools on the target machine. Then use the code below in a powershell script and run the script in your console session adjust the interval or the time out as needed for your circumstance.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$interval = 2;&lt;br /&gt;$timeout = 15;&lt;br /&gt;$url = 'http://www.mywebsite.com'&lt;br /&gt;$command =&lt;br /&gt;$client = New-Object Net.WebClient;&lt;br /&gt;$client.CachePolicy = New-Object Net.Cache.RequestCachePolicy([Net.Cache.RequestCacheLevel]::NoCacheNoStore);&lt;br /&gt;Write-Host "Begin Monitoring $url";&lt;br /&gt;$elapsed = $null;&lt;br /&gt;$interval = New-Object System.TimeSpan(0,0,0,$interval,0);&lt;br /&gt;do&lt;br /&gt;{&lt;br /&gt; Write-Host "Waiting for next test cycle in $interval"&lt;br /&gt; [System.Threading.Thread]::Sleep($interval);&lt;br /&gt; $started = [System.DateTime]::Now.Ticks;&lt;br /&gt; $client.QueryString['t'] = $started;&lt;br /&gt; $response = $client.DownloadString($url);&lt;br /&gt; $ended = [System.DateTime]::Now.Ticks;&lt;br /&gt; $elapsed = New-Object System.TimeSpan($ended - $started);&lt;br /&gt; Write-Host "$url completed in $elapsed"&lt;br /&gt;}&lt;br /&gt;while ($timeout -gt $elapsed.Seconds)&lt;br /&gt;if($timeout -lt $elapsed.Seconds)&lt;br /&gt;{&lt;br /&gt; $ended = [System.DateTime]::Now;&lt;br /&gt; Write-Host "Dumping All Worker Processes at $ended";&lt;br /&gt; &amp;amp;'C:\Program Files\Debugging Tools for Windows (x64)\dumphangw3wp.cmd'&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div&gt;Content of dumphangw3wp.cmd&lt;/div&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;cscript.exe "C:\Program Files\Debugging Tools for Windows (x64)\ADPlus.vbs" -hang -pn w3wp.exe -o "C:\Dump Files" -quiet&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-5899261483417215492?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2009/09/iis7-64bit-hang-dump-hard-way.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-5654208654696176656</guid><pubDate>Fri, 31 Jul 2009 02:55:00 +0000</pubDate><atom:updated>2009-07-30T20:22:46.931-07:00</atom:updated><title>Using a builder like pattern with MVC Helper Methods</title><description>&lt;div&gt;The Microsoft MVC framework is a powerful new technology but after some work I found the helper extension methods to be a little restrictive. While creating copious methods with overloads it dawned on me a string builder like pattern could be used&lt;/div&gt;&lt;div&gt; Here is a pseudo code example what was implemented.&lt;/div&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;//Example of builder class&lt;br /&gt;using System.Web.Mvc;&lt;br /&gt; public class InlineTagBuilder&lt;T&gt; : TagBuilder, IHelperBuilder&lt;br /&gt;  where T : InlineTagBuilder&lt;T&gt;&lt;br /&gt; {&lt;br /&gt;  public InlineTagBuilder(HtmlHelper helper, string tagName, TagRenderMode mode)&lt;br /&gt;   : base(tagName)&lt;br /&gt;  {&lt;br /&gt;&lt;br /&gt;   Helper = helper;&lt;br /&gt;   Mode = mode;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  protected TagRenderMode Mode { get; private set; }&lt;br /&gt;&lt;br /&gt;  public HtmlHelper Helper { get; private set; }&lt;br /&gt;&lt;br /&gt;  new public T AddCssClass(string value)&lt;br /&gt;  {&lt;br /&gt;   base.AddCssClass(value);&lt;br /&gt;   return (T)this;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  new public T MergeAttribute(string key, string value, bool replaceExisting)&lt;br /&gt;  {&lt;br /&gt;   base.MergeAttribute(key, value, replaceExisting);&lt;br /&gt;   return (T)this;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  new public T MergeAttribute(string key, string value)&lt;br /&gt;  {&lt;br /&gt;   base.MergeAttribute(key, value, false);&lt;br /&gt;   return (T)this;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  new public T MergeAttributes&lt;TKey, TValue&gt;(IDictionary&lt;TKey, TValue&gt; attributes, bool replaceExisting)&lt;br /&gt;  {&lt;br /&gt;   base.MergeAttributes&lt;TKey, TValue&gt;(attributes, replaceExisting);&lt;br /&gt;   return (T)this;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  new public T MergeAttributes&lt;TKey, TValue&gt;(IDictionary&lt;TKey, TValue&gt; attributes)&lt;br /&gt;  {&lt;br /&gt;   base.MergeAttributes&lt;TKey, TValue&gt;(attributes, false);&lt;br /&gt;   return (T)this;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  new public T SetInnerText(string innerText)&lt;br /&gt;  {&lt;br /&gt;   base.SetInnerText(innerText);&lt;br /&gt;   return (T)this;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public T AppendAttributeValue(string key, string right)&lt;br /&gt;  {&lt;br /&gt;   string left;&lt;br /&gt;   if (Attributes.TryGetValue(key, out left))&lt;br /&gt;   {&lt;br /&gt;    Attributes[key] = String.Concat(left, right);&lt;br /&gt;   }&lt;br /&gt;   else&lt;br /&gt;   {&lt;br /&gt;    Attributes.Add(key, right);&lt;br /&gt;   }&lt;br /&gt;   return (T)this;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public T InsertAttributeValue(string key, string left)&lt;br /&gt;  {&lt;br /&gt;   string right;&lt;br /&gt;   if (Attributes.TryGetValue(key, out right))&lt;br /&gt;   {&lt;br /&gt;    Attributes[key] = String.Concat(left, right);&lt;br /&gt;   }&lt;br /&gt;   else&lt;br /&gt;   {&lt;br /&gt;    Attributes.Add(key, left);&lt;br /&gt;   }&lt;br /&gt;   return (T)this;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public T AppendEvent(string name, string body)&lt;br /&gt;  {&lt;br /&gt;   return AppendAttributeValue(name, body);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public T InsertEvent(string name, string body)&lt;br /&gt;  {&lt;br /&gt;   return InsertAttributeValue(name, body);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public T AppendStyle(string value)&lt;br /&gt;  {&lt;br /&gt;   if (value != null &amp;&amp; !value.EndsWith(";"))&lt;br /&gt;   {&lt;br /&gt;    value = String.Concat(value, ';');&lt;br /&gt;   }&lt;br /&gt;   return AppendAttributeValue("style", value);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public T SetId(string id)&lt;br /&gt;  {&lt;br /&gt;   return MergeAttribute("id", id, true);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public T SetTitle(string title)&lt;br /&gt;  {&lt;br /&gt;   return MergeAttribute("title", title, true);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public T SetInnerHtml(string innerHtml)&lt;br /&gt;  {&lt;br /&gt;   base.InnerHtml = innerHtml;&lt;br /&gt;   return (T)this;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public static implicit operator string(InlineTagBuilder&lt;T&gt; builder)&lt;br /&gt;  {&lt;br /&gt;   return builder.ToString(builder.Mode);&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; public class AnchorTagBuilder : InlineTagBuilder&lt;AnchorTagBuilder&gt;&lt;br /&gt; {&lt;br /&gt;//Anchor Set Methods Here Each Method Returns This For Inline Stacking Of Method Calls...&lt;br /&gt;        }&lt;br /&gt;//Add extension class for easy access from the helper in the view&lt;br /&gt; public static class AnchorTagBuilderExtensions&lt;br /&gt; {&lt;br /&gt;  public static AnchorTagBuilder Anchor(this HtmlHelper helper)&lt;br /&gt;  {&lt;br /&gt;   return new AnchorTagBuilder(helper);&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;//Example of what the view would look like&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;%=Html.Anchor().MergeAttribute("href","http://www.microsoft.com").AddCssClass("footNote").AppendEvent("onclick","alert('Really Annoying Alert Box!')") %&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-5654208654696176656?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2009/07/using-builder-pattern-with-mvc-helper.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-6227618890204463877</guid><pubDate>Tue, 28 Jul 2009 22:45:00 +0000</pubDate><atom:updated>2009-07-28T15:52:32.218-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Administration</category><category domain='http://www.blogger.com/atom/ns#'>IIS</category><category domain='http://www.blogger.com/atom/ns#'>IIS7</category><category domain='http://www.blogger.com/atom/ns#'>Failed Request Tracing</category><title>IIS7 Failed Request Tracing Not Writing Logs</title><description>&lt;div&gt;Ran in to this today failed request tracing was enabled and showing up in the IIS Admin Console but no matter what I did the logs would not show up. It boils down to two different issues:&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;The folder you are sending the logs to must have permissions set the app pool writing to the folder must have full control or at least write permission to the folder.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;And this is the gotcha, make sure you have the module in the applicationHost.config&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;globalmodules&amp;gt;&lt;br /&gt;...&lt;br /&gt;          &amp;lt;add name="FailedRequestsTracingModule" image="%windir%\System32\inetsrv\iisfreb.dll" precondition="bitness64"&amp;gt;&amp;lt;/add&amp;gt;&lt;br /&gt;...&lt;br /&gt;&amp;lt;/globalmodules&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;Without that line in the config it will not log, there is nothing in the event log app log or www logs that will tell you its not there either.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-6227618890204463877?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2009/07/iis7-failed-request-tracing-not-writing.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-7490763999803025017</guid><pubDate>Thu, 23 Jul 2009 04:34:00 +0000</pubDate><atom:updated>2009-07-23T09:40:07.826-07:00</atom:updated><title>Locking Multithreaded Unit Tests for Sequential Access In Visual Studio</title><description>As I mentioned in a prior post getting Visual Studio Unit tests to execute single threaded is impossible unless you want to write a replacement to the unit test runner. I have several tests that use remoting and rely on a pre-defined channel. When executing things in parallel this causes socket already in use errors. Because each test is executed in an isolated app domain using a lock on a static object wont work either. I have heard you can lock during class setup and teardown this may work due to some locking semantics in the Runner library but for those of you wanting the benefits of setting up and tearing down using class inheritance from a different assembly good luck no dice. &lt;strike&gt;I have chosen a very old school solution simply write a file to the unit test directory and&lt;/strike&gt; use a mutex as a lock this works across multiple processes. &lt;strike&gt;Don't forget to test for the unexpected by protecting against an infinite loop&lt;/strike&gt; Use a timeout to ensure the mutex is not infinitely held waiting for a stalled process.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;  public int TimeoutInSeconds { get; set; }&lt;br /&gt;&lt;br /&gt;  public string Name { get; private set; }&lt;br /&gt;&lt;br /&gt;  private Mutex Mutex&lt;br /&gt;  {&lt;br /&gt;   get&lt;br /&gt;   {&lt;br /&gt;    if (_mutex == null)&lt;br /&gt;    {&lt;br /&gt;     _mutex = new Mutex(false, Name);&lt;br /&gt;    }&lt;br /&gt;    return _mutex;&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  private string LockFileName&lt;br /&gt;  {&lt;br /&gt;   get&lt;br /&gt;   {&lt;br /&gt;    return String.Concat(Name, ".lock");&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public override void Initialize(UnitTestBase test)&lt;br /&gt;  {&lt;br /&gt;   Mutex.WaitOne(new TimeSpan(0, 0, 0, TimeoutInSeconds, 0));&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public override void Cleanup(UnitTestBase test)&lt;br /&gt;  {&lt;br /&gt;   Mutex.ReleaseMutex();&lt;br /&gt;  }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre&gt;&lt;strike&gt;&lt;br /&gt;//Test Setup&lt;br /&gt;long ticks = DateTime.Now.Ticks;&lt;br /&gt;  while (File.Exists(LockFileName))&lt;br /&gt;  {&lt;br /&gt;   Thread.Sleep(100);&lt;br /&gt;   if (TimeoutInSeconds &gt; 0 &amp;amp;&amp;amp; new TimeSpan(ticks - DateTime.Now.Ticks).Seconds &gt;= TimeoutInSeconds)&lt;br /&gt;   {&lt;br /&gt;    throw new Exception(String.Format("Unable to obtain lock {0}", Name));&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt;  using (StreamWriter writer = File.CreateText(LockFileName))&lt;br /&gt;  {&lt;br /&gt;   writer.Write("Lock held by ");&lt;br /&gt;   writer.Write(test.GetType().FullName);&lt;br /&gt;  }&lt;br /&gt;//Teardown&lt;br /&gt;File.Delete(LockFileName);&lt;br /&gt;&lt;/pre&gt;&lt;/strike&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-7490763999803025017?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2009/07/locking-multithreaded-unit-tests-for.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-1355128966233474616</guid><pubDate>Tue, 21 Jul 2009 21:43:00 +0000</pubDate><atom:updated>2009-07-21T14:55:58.496-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Unit Testing</category><category domain='http://www.blogger.com/atom/ns#'>Slow</category><category domain='http://www.blogger.com/atom/ns#'>Debugging</category><category domain='http://www.blogger.com/atom/ns#'>Visual Studio</category><category domain='http://www.blogger.com/atom/ns#'>Performance</category><title>Using Setup Scripts in For Visual Studio Unit Tests</title><description>&lt;div&gt;I could not find much documentation on this so I thought I should post a quick overview of how to create setup scripts for Visual Studio. You specify the setup script in the testrunconfig file under "Setup and Cleanup Scripts" the script is relative to the solution file it applies to. When you run a unit test you will see a &lt;b&gt;qtsetup.bat&lt;/b&gt; in the &lt;pre&gt;TestResults\&amp;lt;TestName&amp;gt;&lt;/pre&gt; folder. Open the file and it will show you your script merged with the variables generated by the testing process very useful if you are looking for the Deployment Directory Path. The Setup Script is executed relative to the deployment dir folder or &lt;pre&gt;TestResults\&amp;lt;TestName&amp;gt;\Out&lt;/pre&gt; in most cases.&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;One drawback to using deployment items is you cannot use wild cards in the includes. In my case this was a pretty big problem because my binaries are all in one folder, upwards of 500 files. As a work around I created a cmd file and executed a file copy instead this saved a huge amount of time when executing a unit test.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-1355128966233474616?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2009/07/using-setup-scripts-in-for-visual.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-5237108732940384612</guid><pubDate>Tue, 21 Jul 2009 19:28:00 +0000</pubDate><atom:updated>2009-07-22T21:33:32.732-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>External Process Debugging</category><category domain='http://www.blogger.com/atom/ns#'>Unit Testing</category><category domain='http://www.blogger.com/atom/ns#'>Remoting</category><category domain='http://www.blogger.com/atom/ns#'>Unit Test</category><category domain='http://www.blogger.com/atom/ns#'>Debugging</category><category domain='http://www.blogger.com/atom/ns#'>Visual Studio</category><title>Debugging an external process through Microsoft Visual Studio Unit Test</title><description>&lt;div&gt;&lt;br /&gt;An update to this article while the code is useful I did not end up using this because I was unable to control the process from within the unit test. Visual studio operates each unit test in an isolated app domain which makes it difficult to instantiate processes across the test run cycle. See my next post on how I have solved this particularity annoying problem. I have been met with an obstacle nearly every step of the way with the Visual Studio Unit tests. Had I not been switching to Teams I would abandon the whole thing and go back to NUnit which was a much more flexible framework.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;Debugging a client server type model within Microsoft Visual Studio can be challenging when also trying to leverage the Microsoft Visual Studio Unit Test framework. The problem lies in the fact you cannot easily spin of a second process to host the server side communication and debug both processes at the same time. You will find that the debugger will only debug through the unit test or client side of the communication stack. After some research and testing I have found a way to launch and attach to a process within the unit test execution path without any extra foot work.&lt;/div&gt;&lt;div&gt;The following code will launch a process check to see if the code is within a debugging session then attempt to attach to that process. If you have been googleing you may have found that you can access the visual studio environment using:&lt;/div&gt;&lt;pre&gt;(EnvDTE._DTE)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE")&lt;/pre&gt;&lt;br /&gt;&lt;div&gt;This is not the droid you are looking for, While this returns an instance of visual studio it may not be the executing instance you need to attach the debugging session to. &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Thanks to Rick Strahl for publishing an &lt;a href="http://www.west-wind.com/Weblog/posts/7077.aspx"&gt;article &lt;/a&gt;with the right COM+ incantations to retrieve all active instances the DTE I made some modifications for my purposes and viola! Something that seems like it should be so simple turns out to be quite tricky. The message filter was taken directly from the MSDN site to resolve issues with RPC_E_CALL_REJECTED message. I also as a side note I was never able to debug throgh the property that returns the executing environment. This was due to re-entry, I was in a debug session at a break point while the other process was trying to attach to the current environment context which was returning as busy which is why you will get the RPC_E_CALL_REJECTED during debugging.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; public sealed class ExecuteAndAttachToBehaviorAttribute : TestFixtureBehaviorAttribute&lt;br /&gt; {&lt;br /&gt;  private static EnvDTE.DTE __executingDevelopmentToolsEnvironment;&lt;br /&gt;  private const uint S_OK = 0;&lt;br /&gt;&lt;br /&gt;  public ExecuteAndAttachToBehaviorAttribute()&lt;br /&gt;  {&lt;br /&gt;   WaitForProcessInMilliseconds = 0;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  #region Properties&lt;br /&gt;&lt;br /&gt;  /// &lt;summary&gt;&lt;br /&gt;  /// Path to the executable relative to the currently executing ApplicationBase path&lt;br /&gt;  /// &lt;/summary&gt;&lt;br /&gt;  public string Path { get; set; }&lt;br /&gt;&lt;br /&gt;  public int WaitForProcessInMilliseconds { get; set; }&lt;br /&gt;&lt;br /&gt;  private Process Process { get; set; }&lt;br /&gt;  &lt;br /&gt;  private EnvDTE.DTE ExecutingDevelopmentToolsEnvironment&lt;br /&gt;  {&lt;br /&gt;   get&lt;br /&gt;   {&lt;br /&gt;    UCOMIRunningObjectTable rot;&lt;br /&gt;    if (__executingDevelopmentToolsEnvironment == null &amp;&amp; GetRunningObjectTable(0, out rot) == S_OK)&lt;br /&gt;    {&lt;br /&gt;     UCOMIEnumMoniker enumMon;&lt;br /&gt;     rot.EnumRunning(out enumMon);&lt;br /&gt;     if (enumMon != null)&lt;br /&gt;     {&lt;br /&gt;      const int numMons = 100;&lt;br /&gt;      int Fetched = 0;&lt;br /&gt;      UCOMIMoniker[] aMons = new UCOMIMoniker[numMons];&lt;br /&gt;      enumMon.Next(numMons, aMons, out Fetched);&lt;br /&gt;      UCOMIBindCtx ctx;&lt;br /&gt;&lt;br /&gt;      if (CreateBindCtx(0, out ctx) == S_OK)&lt;br /&gt;      {&lt;br /&gt;       MessageFilter.Register();&lt;br /&gt;       System.Diagnostics.Process currentProcess = System.Diagnostics.Process.GetCurrentProcess();&lt;br /&gt;       for (int i = 0; i &lt; Fetched; i++)&lt;br /&gt;       {&lt;br /&gt;        object instance;&lt;br /&gt;        EnvDTE.DTE dte;&lt;br /&gt;        rot.GetObject(aMons[i], out instance);&lt;br /&gt;        dte = instance as EnvDTE.DTE;&lt;br /&gt;        if (dte != null)&lt;br /&gt;        {&lt;br /&gt;         foreach (EnvDTE.Process p in dte.Debugger.DebuggedProcesses)&lt;br /&gt;         {&lt;br /&gt;          if (p.ProcessID == currentProcess.Id)&lt;br /&gt;          {&lt;br /&gt;           __executingDevelopmentToolsEnvironment = dte;&lt;br /&gt;           break;&lt;br /&gt;          }&lt;br /&gt;         }&lt;br /&gt;         if (__executingDevelopmentToolsEnvironment != null)&lt;br /&gt;         {&lt;br /&gt;          break;&lt;br /&gt;         }&lt;br /&gt;        }&lt;br /&gt;       }&lt;br /&gt;       MessageFilter.Unregister();&lt;br /&gt;      }&lt;br /&gt;     }&lt;br /&gt;    }&lt;br /&gt;    return __executingDevelopmentToolsEnvironment;&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  #endregion&lt;br /&gt;&lt;br /&gt;  #region Methods&lt;br /&gt;&lt;br /&gt;  [DllImport("ole32.dll", EntryPoint = "GetRunningObjectTable")]&lt;br /&gt;  private static extern uint GetRunningObjectTable(uint res, out UCOMIRunningObjectTable ROT);&lt;br /&gt;&lt;br /&gt;  [DllImport("ole32.dll", EntryPoint = "CreateBindCtx")]&lt;br /&gt;  private static extern uint CreateBindCtx(uint res, out UCOMIBindCtx ctx);&lt;br /&gt;&lt;br /&gt;  private void Process_ErrorDataReceived(object sender, DataReceivedEventArgs e)&lt;br /&gt;  {&lt;br /&gt;   System.Diagnostics.Debug.WriteLine(String.Format("Unable to launch {0} the following error information was returned from the process:\r\n{1}", Path, e.Data));&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public override void Setup()&lt;br /&gt;  {&lt;br /&gt;   Process = new Process();&lt;br /&gt;   Process.StartInfo = new ProcessStartInfo(Path);&lt;br /&gt;   Process.Start();&lt;br /&gt;   Process.ErrorDataReceived += new DataReceivedEventHandler(Process_ErrorDataReceived);&lt;br /&gt;#if DEBUG&lt;br /&gt;   if (System.Diagnostics.Debugger.IsAttached)&lt;br /&gt;   {&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;     if (WaitForProcessInMilliseconds &gt; 0)&lt;br /&gt;     {&lt;br /&gt;      Thread.Sleep(WaitForProcessInMilliseconds);&lt;br /&gt;     }&lt;br /&gt;     if (ExecutingDevelopmentToolsEnvironment == null)&lt;br /&gt;      throw new Exception("Unable to locate a valid instance of Visual Studio 2008, unable to attach using the current debugger instance.");&lt;br /&gt;     bool attached = false;&lt;br /&gt;     foreach (EnvDTE.Process process in ExecutingDevelopmentToolsEnvironment.Debugger.LocalProcesses)&lt;br /&gt;     {&lt;br /&gt;      if (process.ProcessID == Process.Id)&lt;br /&gt;      {&lt;br /&gt;       process.Attach();&lt;br /&gt;       attached = true;&lt;br /&gt;      }&lt;br /&gt;     }&lt;br /&gt;     if (!attached)&lt;br /&gt;      throw new Exception(String.Format("Unable to locate process id {0}, attach failed to complete successfully", Process.Id));&lt;br /&gt;    }&lt;br /&gt;    catch (Exception exception)&lt;br /&gt;    {&lt;br /&gt;     System.Diagnostics.Debug.WriteLine(String.Format("Unable to attach debugger to '{0}' the following exception was generated:\r\n{1}", Path, exception.ToString()));&lt;br /&gt;     System.Diagnostics.Debugger.Launch();&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;#endif&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public override void TearDown()&lt;br /&gt;  {&lt;br /&gt;   try&lt;br /&gt;   {&lt;br /&gt;    Process.Kill();&lt;br /&gt;    Process.Dispose();&lt;br /&gt;   }&lt;br /&gt;   catch (Exception exception)&lt;br /&gt;   {&lt;br /&gt;    System.Diagnostics.Debug.WriteLine(String.Format("Unable to kill {0} the following error information was returned:\r\n{1}", Path, exception.ToString()));&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  #endregion&lt;br /&gt;&lt;br /&gt;  private class MessageFilter : IOleMessageFilter&lt;br /&gt;  {&lt;br /&gt;   public static void Register()&lt;br /&gt;   {&lt;br /&gt;    IOleMessageFilter newFilter = new MessageFilter();&lt;br /&gt;    IOleMessageFilter oldFilter = null;&lt;br /&gt;    CoRegisterMessageFilter(newFilter, out oldFilter);&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   public static void Unregister()&lt;br /&gt;   {&lt;br /&gt;    IOleMessageFilter oldFilter = null;&lt;br /&gt;    CoRegisterMessageFilter(null, out oldFilter);&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   int IOleMessageFilter.HandleInComingCall(int dwCallType, System.IntPtr hTaskCaller, int dwTickCount, System.IntPtr lpInterfaceInfo)&lt;br /&gt;   {&lt;br /&gt;    return 0;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   int IOleMessageFilter.RetryRejectedCall(System.IntPtr hTaskCallee, int dwTickCount, int dwRejectType)&lt;br /&gt;   {&lt;br /&gt;    if (dwRejectType == 2)&lt;br /&gt;    {&lt;br /&gt;     return 99;&lt;br /&gt;    }&lt;br /&gt;    return -1;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   int IOleMessageFilter.MessagePending(System.IntPtr hTaskCallee,int dwTickCount, int dwPendingType)&lt;br /&gt;   {&lt;br /&gt;    return 2;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   [DllImport("Ole32.dll")]&lt;br /&gt;   private static extern int&lt;br /&gt;     CoRegisterMessageFilter(IOleMessageFilter newFilter, out IOleMessageFilter oldFilter);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  [ComImport(), Guid("00000016-0000-0000-C000-000000000046"),&lt;br /&gt;  InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]&lt;br /&gt;  interface IOleMessageFilter&lt;br /&gt;  {&lt;br /&gt;   [PreserveSig]&lt;br /&gt;   int HandleInComingCall(&lt;br /&gt;    int dwCallType,&lt;br /&gt;    IntPtr hTaskCaller,&lt;br /&gt;    int dwTickCount,&lt;br /&gt;    IntPtr lpInterfaceInfo);&lt;br /&gt;&lt;br /&gt;   [PreserveSig]&lt;br /&gt;   int RetryRejectedCall(&lt;br /&gt;    IntPtr hTaskCallee,&lt;br /&gt;    int dwTickCount,&lt;br /&gt;    int dwRejectType);&lt;br /&gt;&lt;br /&gt;   [PreserveSig]&lt;br /&gt;   int MessagePending(&lt;br /&gt;    IntPtr hTaskCallee,&lt;br /&gt;    int dwTickCount,&lt;br /&gt;    int dwPendingType);&lt;br /&gt;  }&lt;br /&gt; }&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-5237108732940384612?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2009/07/debugging-external-process-through.html</link><author>noreply@blogger.com (AbstractLabs)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-4423400943969518521.post-4323877751126754499</guid><pubDate>Wed, 24 Jun 2009 20:32:00 +0000</pubDate><atom:updated>2009-06-24T13:54:27.871-07:00</atom:updated><title>Unable to delete/modify Registry Key Access Is Denied</title><description>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_MHt6xYs7toU/SkKSTk-VhLI/AAAAAAAAAAM/FwdMAht6yVA/s1600-h/aid.jpg"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 320px; height: 130px;" src="http://4.bp.blogspot.com/_MHt6xYs7toU/SkKSTk-VhLI/AAAAAAAAAAM/FwdMAht6yVA/s320/aid.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5351000172309873842" /&gt;&lt;/a&gt;&lt;br /&gt;     Ran in to this one today spent an hour or two googling and proding for the answer. Essentially you are getting this message because the owner of the key is not you and has denied permission or has not given permission to you. The fix is very simple and should be obvious to those of you familiar with the NTFS file permission scheme. Just right click on the key above go to advanced reset the owner permission on child objects click ok (you may still get an error however) this will grant you control to the child element from above. From there you should be able to delete/modify the key normally.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4423400943969518521-4323877751126754499?l=blog.abstractlabs.net' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.abstractlabs.net/2009/06/unable-to-deletemodify-registry-key.html</link><author>noreply@blogger.com (AbstractLabs)</author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_MHt6xYs7toU/SkKSTk-VhLI/AAAAAAAAAAM/FwdMAht6yVA/s72-c/aid.jpg' height='72' width='72'/></item></channel></rss>
