<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Peter Johnson's Blog</title><link>http://weblogs.asp.net/pjohnson/default.aspx</link><description>ASP.NET and other technologies</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>MVC's Html.DropDownList and "There is no ViewData item of type 'IEnumerable&lt;SelectListItem&gt;' that has the key '...'</title><link>http://weblogs.asp.net/pjohnson/archive/2012/10/26/mvc-s-html-dropdownlist-and-quot-there-is-no-viewdata-item-of-type-ienumerable-lt-selectlistitem-gt-that-has-the-key.aspx</link><pubDate>Fri, 26 Oct 2012 16:30:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:9220096</guid><dc:creator>pjohnson</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/pjohnson/rsscomments.aspx?PostID=9220096</wfw:commentRss><comments>http://weblogs.asp.net/pjohnson/archive/2012/10/26/mvc-s-html-dropdownlist-and-quot-there-is-no-viewdata-item-of-type-ienumerable-lt-selectlistitem-gt-that-has-the-key.aspx#comments</comments><description>
&lt;p&gt;ASP.NET MVC's HtmlHelper extension methods take out a lot of the HTML-by-hand drudgery to which MVC re-introduced us former WebForms programmers. Another thing to which MVC re-introduced us is poor documentation, after the excellent documentation for most of the rest of ASP.NET and the .NET Framework which I now realize I'd taken for granted.&lt;/p&gt;
&lt;p&gt;I'd come to regard using HtmlHelper methods instead of writing HTML by hand as a best practice. When I upgraded a project from MVC 3 to MVC 4, several hidden fields with boolean values broke, because MVC 3 called ToString() on those values implicitly, and MVC 4 threw an exception until you called ToString() explicitly. Fields that used HtmlHelper weren't affected. I then went through dozens of views and manually replaced hidden inputs that had been coded by hand with Html.Hidden calls.&lt;br&gt;&lt;/p&gt;
&lt;p&gt;So for a dropdown list I was rendering on the initial page as empty, then populating via JavaScript after an AJAX call, I tried to use a HtmlHelper method:&lt;/p&gt;

&lt;p style="font: small Courier New;"&gt;@Html.DropDownList("myDropdown")&lt;/p&gt;

&lt;p&gt;which threw an exception:&lt;/p&gt;

&lt;p style="font: small Courier New;"&gt;System.InvalidOperationException: There is no ViewData item of type 'IEnumerable&amp;lt;SelectListItem&amp;gt;' that has the key 'myDropdown'.&lt;/p&gt;

&lt;p&gt;That's funny--I made no indication I wanted to use ViewData. Why was it looking there? Just render an empty select list for me. When I populated the list with items, it worked, but I didn't want to do that:&lt;/p&gt;

&lt;p style="font: small Courier New;"&gt;@Html.DropDownList("myDropdown", new List&amp;lt;SelectListItem&amp;gt;() { new SelectListItem() { Text = "", Value = "" } })&lt;/p&gt;

&lt;p&gt;I removed this dummy item in JavaScript after the AJAX call, so this worked fine, but I shouldn't have to give it a list with a dummy item when what I really want is an empty select.&lt;br&gt;&lt;/p&gt;
&lt;p&gt;A bit of research with &lt;a href="http://www.jetbrains.com/decompiler/" mce_href="http://www.jetbrains.com/decompiler/"&gt;JetBrains dotPeek&lt;/a&gt; (&lt;a href="http://www.hanselman.com/blog/ScottHanselmans2011UltimateDeveloperAndPowerUsersToolListForWindows.aspx" mce_href="http://www.hanselman.com/blog/ScottHanselmans2011UltimateDeveloperAndPowerUsersToolListForWindows.aspx"&gt;helpfully recommended by Scott Hanselman&lt;/a&gt;) revealed the problem. &lt;b&gt;Html.DropDownList requires some sort of data to render or it throws an error.&lt;/b&gt; &lt;a href="http://msdn.microsoft.com/en-us/library/dd492948.aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd492948.aspx"&gt;The documentation hints at this&lt;/a&gt; but doesn't make it very clear. Behind the scenes, it checks if you've provided the DropDownList method any data. If you haven't, it looks in ViewData. If it's not there, you get the exception above.&lt;/p&gt;
&lt;p&gt;In my case, the helper wasn't doing much for me anyway, so I reverted to writing the HTML by hand (I ain't scared), and amended my best practice: When an HTML control has an associated HtmlHelper method and you're populating that control with data on the initial view, use the HtmlHelper method instead of writing by hand.&lt;br&gt;&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=9220096" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/pjohnson/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/MVC/default.aspx">MVC</category></item><item><title>How to create a new WCF/MVC/jQuery application from scratch</title><link>http://weblogs.asp.net/pjohnson/archive/2012/09/22/how-to-create-a-new-jquery-mvc-wcf-application-from-scratch.aspx</link><pubDate>Sat, 22 Sep 2012 05:18:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8332059</guid><dc:creator>pjohnson</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/pjohnson/rsscomments.aspx?PostID=8332059</wfw:commentRss><comments>http://weblogs.asp.net/pjohnson/archive/2012/09/22/how-to-create-a-new-jquery-mvc-wcf-application-from-scratch.aspx#comments</comments><description>&lt;p&gt;As a corporate developer by trade, I don't get much opportunity to create from-the-ground-up web sites; usually it's tweaks, fixes, and new functionality to existing sites. And with hobby sites, I often don't find the challenges I run into with enterprise systems; usually it's starting from Visual Studio's boilerplate project and adding whatever functionality I want to play around with, rarely deploying outside my own machine. So my experience creating a new enterprise-level site was a bit dated, and the technologies to do so have come a long way, and are much more ready to go out of the box. My intention with this post isn't so much to provide any groundbreaking insights, but to just tie together a lot of information in one place to make it easy to create a new site from scratch.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Architecture&lt;/b&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;One site I created earlier this year had an MVC 3 front end and a WCF 4-driven service layer. Using Visual Studio 2010, these project types are easy enough to add to a new solution. I created a third Class Library project to store common functionality the front end and services layers both needed to access, for example, the DataContract classes that the front end uses to call services in the service layer. By keeping DataContract classes in a separate project, I avoided the need for the front end to have an assembly/project reference directly to the services code, a bit cleaner and more flexible of an SOA implementation.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Consuming the service&lt;/b&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;Even by this point, VS has given you a lot. You have a working web site and a working service, neither of which do much but are great starting points. To wire up the front end and the services, I needed to create proxy classes and WCF client configuration information. I decided to use the SvcUtil.exe utility provided as part of the Windows SDK, which you should have installed if you installed VS. VS also provides an Add Service Reference command since the .NET 1.x ASMX days, which I've never really liked; it creates several .cs/.disco/etc. files, some of which contained hardcoded URL's, adding duplicate files (*1.cs, *2.cs, etc.) without doing a good job of cleaning up after itself. I've found SvcUtil much cleaner, as it outputs one C# file (containing several proxy classes) and a config file with settings, and it's easier to use to regenerate the proxy classes when the service changes, and to then maintain all your configuration in one place (your Web.config, instead of the Service Reference files). I provided it a reference to a copy of my common assembly so it doesn't try to recreate the data contract classes, had it use the type List&amp;lt;T&amp;gt; for collections, and modified the output files' names and .NET namespace, ending up with a command like:&lt;/p&gt;

&lt;p style="font: small Courier New;"&gt;svcutil.exe /l:cs /o:MyService.cs /config:MyService.config /r:MySite.Common.dll /ct:System.Collections.Generic.List`1 /n:*,MySite.Web.ServiceProxies http://localhost:59999/MyService.svc&lt;/p&gt;

&lt;p&gt;I took the generated MyService.cs file and drop it in the web project, under a ServiceProxies folder, matching the namespace and keeping it separate from classes I coded manually. Integrating the config file took a little more work, but only needed to be done once as these settings didn't often change. A great thing Microsoft improved with WCF 4 is configuration; namely, you can use all the default settings and not have to specify them explicitly in your config file. Unfortunately, SvcUtil doesn't generate its config file this way. If you just copy &amp;amp; paste MyService.config's contents into your front end's Web.config, you'll copy a lot of settings you don't need, plus this will get unwieldy if you add more services in the future, each with its own custom binding. Really, as the only mandatory settings are the endpoint's ABC's (address, binding, and contract) you can get away with just this:&lt;/p&gt;

&lt;p style="font: small Courier New;"&gt;&amp;lt;system.serviceModel&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;client&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;endpoint address="http://localhost:59999/MyService.svc" binding="wsHttpBinding" contract="MySite.Web.ServiceProxies.IMyService" /&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;/client&amp;gt;&lt;br&gt;&amp;lt;/system.serviceModel&amp;gt;&lt;/p&gt;

&lt;p&gt;By default, the services project uses basicHttpBinding. As you can see, I switched it to wsHttpBinding, a more modern standard. Using something like netTcpBinding would probably be faster and more efficient since the client &amp;amp; service are both written in .NET, but it requires additional server setup and open ports, whereas switching to wsHttpBinding is much simpler.&lt;/p&gt;

&lt;p&gt;From an MVC controller action method, I instantiated the client, and invoked the method for my operation. As with any object that implements IDisposable, I wrapped it in C#'s using() statement, a tidy construct that ensures Dispose gets called no matter what, even if an exception occurs. Unfortunately there are problems with that, as WCF's ClientBase&amp;lt;TChannel&amp;gt; class doesn't &lt;a href="http://msdn.microsoft.com/en-us/library/b1yfkh5e.aspx" title="Implementing Finalize and Dispose to Clean Up Unmanaged Resources" mce_href="http://msdn.microsoft.com/en-us/library/b1yfkh5e.aspx"&gt;implement Dispose according to Microsoft's own usage guidelines&lt;/a&gt;. I took an approach similar to &lt;a href="http://www.technologytoolbox.com/blog/jjameson/archive/2010/03/18/avoiding-problems-with-the-using-statement-and-wcf-service-proxies.aspx" title="Technology Toolbox: Avoiding Problems with the Using Statement and WCF Service Proxies" mce_href="http://www.technologytoolbox.com/blog/jjameson/archive/2010/03/18/avoiding-problems-with-the-using-statement-and-wcf-service-proxies.aspx"&gt;Technology Toolbox's fix&lt;/a&gt;, except using partial classes instead of a wrapper class to extend the SvcUtil-generated proxy, making the fix more seamless from the controller's perspective, and theoretically,&amp;nbsp;less code I have to change if and when&amp;nbsp;Microsoft fixes this behavior.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;User interface&lt;/b&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;The MVC 3 project template includes jQuery and some other common JavaScript libraries by default. I updated the ones I used to the latest versions using NuGet, available in VS via the Tools&amp;nbsp;&amp;gt; Library Package Manager &amp;gt; Manage NuGet Packages for Solution... &amp;gt; Updates. I also used this dialog to remove packages I wasn't using. Given that it's smart enough to know the difference between the .js and .min.js files, I was hoping it would be smart enough to know which to include during build and publish operations, but this doesn't seem to be the case. I ended up using &lt;a href="http://getcassette.net/" title="Cassette | Asset bundling for .NET web apps" mce_href="http://getcassette.net/"&gt;Cassette&lt;/a&gt; to perform the minification and bundling of my JavaScript and CSS files; &lt;a href="http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification" title="ASP.NET MVC 4: Bundling and Minification" mce_href="http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification"&gt;ASP.NET 4.5 includes this functionality out of the box&lt;/a&gt;.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;The web client to web server link via jQuery was easy enough. In&amp;nbsp;my JavaScript function, unobtrusively wired up to a button's click event, I called &lt;a href="http://api.jquery.com/jQuery.ajax/" title="jQuery API: jQuery.ajax()" mce_href="http://api.jquery.com/jQuery.ajax/"&gt;$.ajax&lt;/a&gt;, corresponding to an action method that returns a JsonResult, accomplished by passing my model class to the Controller.Json() method, which jQuery helpfully translates from JSON to a JavaScript object.&lt;/p&gt;&lt;p&gt;$.ajax calls weren't perfectly straightforward. I tried using the simpler $.post method instead, but ran into trouble without specifying the contentType parameter, which $.post doesn't have. The url parameter is simple enough, though for flexibility in how the site is deployed, I used MVC's &lt;a href="http://msdn.microsoft.com/en-us/library/dd492874.aspx" title="MSDN: UrlHelper.Action Method (System.Web.Mvc)" mce_href="http://msdn.microsoft.com/en-us/library/dd492874.aspx"&gt;Url.Action&lt;/a&gt; method to get the URL, then sent this to JavaScript in a JavaScript string variable. If the request needed input data, I used the &lt;a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/JSON/stringify" title="Mozilla Developer Network: stringify" mce_href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/JSON/stringify"&gt;JSON.stringify function&lt;/a&gt; to convert a JavaScript object with the parameters into a JSON string, which MVC then parses into strongly-typed C# parameters. I also specified "json" for dataType, and "application/json; charset=utf-8" for contentType. For success and error, I provided my success and error handling functions, though success is a bit hairier. "Success" in this context indicates whether the HTTP request succeeds, not whether what you wanted the AJAX call to do on the web server was successful. For example, if you make an AJAX call to retrieve a piece of data, the success handler will be invoked for any 200 OK response, and the error handler will be invoked for failed requests, e.g. a 404 Not Found (if the server rejected the URL you provided in the url parameter) or 500 Internal Server Error (e.g. if your C# code threw an exception that wasn't caught). If an exception was caught and handled, or if the data requested wasn't found, this would likely go through the success handler, which would need to do further examination to verify it did in fact get back the data for which it asked. I discuss this more in the next section.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Logging and exception handling&lt;/b&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;At this point, I had a working application. If I ran into any errors or unexpected behavior, debugging was easy enough, but of course that's not an option on public web servers. &lt;a href="http://msdn.microsoft.com/en-us/library/ff632023.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ff632023.aspx"&gt;Microsoft Enterprise Library 5.0&lt;/a&gt; filled this gap nicely, with its Logging and Exception Handling functionality. First I installed Enterprise Library; NuGet as outlined above is probably the best way to do so.&amp;nbsp;I needed a total of&amp;nbsp;three assembly&amp;nbsp;references--Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, and Microsoft.Practices.EnterpriseLibrary.Logging. VS links with the handy&amp;nbsp;Enterprise Library 5.0 Configuration Console, accessible by right-clicking your Web.config and choosing&amp;nbsp;Edit Enterprise Library V5 Configuration. In this console, under Logging Settings, I set up a Rolling Flat File Trace Listener to write to log files but not let them get too large, using a Text Formatter with a simpler template than that provided by default. Logging to a different (or additional) destination is easy enough, but a flat file suited my needs.&amp;nbsp;At this point, I verified it wrote as expected by calling the Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write method from my C# code.&lt;/p&gt;

&lt;p&gt;With those settings verified, I went on to wire up Exception Handling with Logging. Back in the EntLib Configuration Console, under Exception Handling, I used a LoggingExceptionHandler, setting its Logging Category to the category I already had configured in the Logging Settings. Then, from code (e.g. a controller's OnException method, or any action method's catch block), I called the Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.HandleException method, providing the exception and the exception policy name I had configured in the Exception Handling Settings.&lt;/p&gt;

&lt;p&gt;Before I got this configured correctly, when I tried it out, nothing was logged. In working with .NET, I'm used to seeing an exception if something doesn't work or isn't set up correctly, but instead working with these EntLib modules reminds me more of JavaScript (before the "use strict" v5 days)--it just does nothing and leaves you to figure out why, I presume due in part to the listener pattern Microsoft followed with the Enterprise Library. First, I verified logging worked on its own. Then, verifying/correcting where each piece wires up to the next resolved my problem. Your C# code calls into the Exception Handling module, referencing the policy you pass the HandleException method; that policy's configuration&amp;nbsp;contains a LoggingExceptionHandler that references a logCategory; that logCategory should be added in the loggingConfiguration's categorySources section; that category references a listener; that listener should be added in the loggingConfiguration's listeners section, which specifies the name of the log file.&lt;/p&gt;

&lt;p&gt;One final note on error handling, as the proper way to handle WCF and MVC errors is a whole other very lengthy discussion. For AJAX calls to MVC action methods, depending on your configuration, an exception thrown here will result in ASP.NET'S Yellow Screen Of Death being sent back as a response, which is at best unnecessarily and uselessly verbose, and at worst a security risk as the internals of your application are exposed to potential hackers. I mitigated this by overriding my controller's OnException method, passing the exception off to the Exception Handling module as above. I created an ErrorModel class with as few properties as possible (e.g. an Error string), sending as little information to the client as 
possible, to both maximize bandwidth and mitigate risk. I then return an ErrorModel in JSON format for AJAX requests:&lt;/p&gt;
&lt;p style="font: small Courier New;"&gt;if (filterContext.HttpContext.Request.IsAjaxRequest())&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; filterContext.Result = Json(new ErrorModel(...));&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; filterContext.ExceptionHandled = true;&lt;br&gt;} &lt;br&gt;&lt;/p&gt;
&lt;p&gt;My $.ajax calls from the browser get a valid 200 OK response and go into the success handler. Before assuming everything is OK, I check if it's an ErrorModel or a model containing what I requested. If it's an ErrorModel, or null, I pass it to my error handler. If the client needs to handle different errors differently, ErrorModel can contain a flag, error code, string, etc. to differentiate, but again, sending as little information back as possible is ideal.&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;As any experienced ASP.NET developer knows, this is a far cry from where ASP.NET started when I began working with it 11 years ago. WCF services are far more powerful than ASMX ones, MVC is in many ways cleaner and certainly more unit test-friendly than Web Forms (if you don't&amp;nbsp;consider the code/markup commingling you're doing again), the Enterprise Library makes error handling and logging almost entirely configuration-driven,&amp;nbsp;AJAX makes a responsive UI more feasible, and&amp;nbsp;jQuery makes JavaScript coding much less painful. It doesn't take much work to get a functional, maintainable, flexible application, though having it actually do something useful is a whole other matter.&lt;br&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8332059" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/pjohnson/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/MVC/default.aspx">MVC</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/WCF/default.aspx">WCF</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/jQuery/default.aspx">jQuery</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/Enterprise+Library/default.aspx">Enterprise Library</category></item><item><title>Oracle 64-bit assembly throws BadImageFormatException when running unit tests</title><link>http://weblogs.asp.net/pjohnson/archive/2012/09/21/oracle-64-bit-assembly-throws-badimageformatexception-when-running-unit-tests.aspx</link><pubDate>Fri, 21 Sep 2012 16:04:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8960290</guid><dc:creator>pjohnson</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/pjohnson/rsscomments.aspx?PostID=8960290</wfw:commentRss><comments>http://weblogs.asp.net/pjohnson/archive/2012/09/21/oracle-64-bit-assembly-throws-badimageformatexception-when-running-unit-tests.aspx#comments</comments><description>&lt;p&gt;We recently upgraded to the 64-bit Oracle client. Since then, Visual Studio 2010 unit tests that hit the database (I know, unit tests shouldn't hit the database--they're not perfect) all fail with this error message:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;Test method MyProject.Test.SomeTest threw exception: &lt;br&gt;System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---&amp;gt; System.BadImageFormatException: Could not load file or assembly 'Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. An attempt was made to load a program with an incorrect format.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;I resolved this by &lt;a href="http://msdn.microsoft.com/en-us/library/ee782531%28v=vs.100%29.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ee782531%28v=vs.100%29.aspx"&gt;changing the test settings to run tests in 64-bit&lt;/a&gt;. From the Test menu, go to Edit Test Settings, and pick your settings file. Go to Hosts, and change the "Run tests in 32 bit or 64 bit process" dropdown to "Run tests in 64 bit process on 64 bit machine". Now your tests should run.&lt;/p&gt;&lt;p&gt;This fix makes me a little nervous. Visual Studio 2010 and earlier seem to change that file for no apparent reason, add more settings files, etc. If you're not paying attention, you could have TestSettings1.testsettings through TestSettings99.testsettings sitting there and never notice the difference. So it's worth making a note of how to change it in case you have to redo it, and being vigilant about files VS tries to add.&lt;/p&gt;&lt;p&gt;I'm not entirely clear on why this was even a problem. Isn't that the point of an MSIL assembly, that it's not specific to the hardware it runs on? An IL disassembler can open the Oracle.DataAccess.dll in question, and in its Runtime property, I see the value "v4.0.30319 / x64". So I guess the assembly was specifically build to target 64-bit platforms only, possibly due to a 64-bit-specific difference in the external Oracle client upon which it depends. Most other assemblies, especially in the .NET Framework, list "msil", and a couple list "x86". So I guess this is another entry in the long list of ways Oracle refuses to play nice with Windows and .NET.&lt;/p&gt;&lt;p&gt;If this doesn't solve your problem, you can read &lt;a href="http://stackoverflow.com/questions/9202988/badimageformatexception-when-anycpu-test-assembly-implements-interface-from-x64" mce_href="http://stackoverflow.com/questions/9202988/badimageformatexception-when-anycpu-test-assembly-implements-interface-from-x64"&gt;others' research into this error&lt;/a&gt;, and &lt;a href="http://msdn.microsoft.com/en-us/library/ee782531.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ee782531.aspx"&gt;where to change the same test setting in Visual Studio 2012&lt;/a&gt;.&lt;br&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8960290" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/pjohnson/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/Unit+Testing/default.aspx">Unit Testing</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/Oracle/default.aspx">Oracle</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/64-bit/default.aspx">64-bit</category></item><item><title>MVC 4 and the App_Start folder</title><link>http://weblogs.asp.net/pjohnson/archive/2012/09/07/mvc-4-and-the-app-start-folder.aspx</link><pubDate>Fri, 07 Sep 2012 21:04:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8899679</guid><dc:creator>pjohnson</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/pjohnson/rsscomments.aspx?PostID=8899679</wfw:commentRss><comments>http://weblogs.asp.net/pjohnson/archive/2012/09/07/mvc-4-and-the-app-start-folder.aspx#comments</comments><description>&lt;p&gt;I've been delving into &lt;a href="http://www.asp.net/mvc/mvc4" mce_href="http://www.asp.net/mvc/mvc4"&gt;ASP.NET MVC 4&lt;/a&gt; a little since its release last month. One thing I was chomping at the bit to explore was its &lt;a href="http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification" mce_href="http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification"&gt;bundling and minification&lt;/a&gt; functionality, for which I'd previously used &lt;a href="http://getcassette.net/" mce_href="http://getcassette.net/"&gt;Cassette&lt;/a&gt;, and been fairly happy with it. MVC 4's functionality seems very similar to Cassette's; the latter's CassetteConfiguration class matches the former's BundleConfig class, specified in a new directory called App_Start.&lt;/p&gt;&lt;p&gt;At first glance, this seems like another special ASP.NET folder, like App_Data, App_GlobalResources, App_LocalResources, and App_Browsers. But Visual Studio 2010's lack of knowledge about it (no Solution Explorer option to add the folder, nor a fancy icon for it) made me suspicious. I found the MVC 4 project template has five classes there--AuthConfig, BundleConfig, FilterConfig, RouteConfig, and WebApiConfig. Each of these is called explicitly in Global.asax's Application_Start method. Why create separate classes, each with a single static method? Maybe they anticipate a lot more code being added there for large applications, but for small ones, it seems like overkill. (And they seem hastily implemented--some declared as static and some not, in the base namespace instead of 
an App_Start/AppStart one.) Even for a large application I work on with a substantial amount of code in Global.asax.cs, a RouteConfig might be warranted, but the other classes would remain tiny.&lt;br&gt;&lt;/p&gt;&lt;p&gt;More importantly, it appears App_Start has no special magic like the other folders--it's just convention. I found it first &lt;a href="http://blog.davidebbo.com/2011/02/appstart-folder-convention-for-nuget.html" mce_href="http://blog.davidebbo.com/2011/02/appstart-folder-convention-for-nuget.html"&gt;described in the MVC 3 timeframe by Microsoft architect David Ebbo, for the benefit of NuGet and WebActivator&lt;/a&gt;; apparently some packages will add their own classes to that directory as well. One of the first appears to be Ninject, as most mentions of that folder mention it, and there's not much information elsewhere about this new folder.&lt;br&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8899679" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/pjohnson/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/MVC/default.aspx">MVC</category></item><item><title>Unity throws SynchronizationLockException while debugging</title><link>http://weblogs.asp.net/pjohnson/archive/2012/04/13/unity-throws-synchronizationlockexception-while-debugging.aspx</link><pubDate>Fri, 13 Apr 2012 23:43:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8389592</guid><dc:creator>pjohnson</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;I've found &lt;a href="http://msdn.microsoft.com/en-us/library/dd203101.aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd203101.aspx"&gt;Unity&lt;/a&gt; to be a great resource for writing unit-testable code, and tests targeting it. Sadly, not all those unit tests work perfectly the first time (TDD notwithstanding), and sometimes it's not even immediately apparent why they're failing. So I use Visual Studio's debugger. I then see SynchronizationLockExceptions thrown by Unity calls, when I never did while running the code without debugging. I hit F5 to continue past these distractions, the line that had the exception appears to have completed normally, and I continue on to what I was trying to debug in the first place.&lt;br&gt;&lt;br&gt;In settings where Unity isn't used extensively, this is just one amongst a handful of annoyances in a tool (Visual Studio) that overall makes my work life much, much easier and more enjoyable. But in larger projects, it can be maddening. Finally it bugged me enough where it was worth researching it.&lt;/p&gt;&lt;p&gt;Amongst the first and most helpful Google results was, of course, at &lt;a href="http://stackoverflow.com/questions/2873767/can-unity-be-made-to-not-throw-synchronizationlockexception-all-the-time" mce_href="http://stackoverflow.com/questions/2873767/can-unity-be-made-to-not-throw-synchronizationlockexception-all-the-time"&gt;Stack Overflow&lt;/a&gt;. The first couple answers were extensive but seemed a bit more involved than I could pull off at this stage in the product's lifecycle. A bit more digging showed that the &lt;a href="http://unity.codeplex.com/workitem/7206?ProjectName=unity" mce_href="http://unity.codeplex.com/workitem/7206?ProjectName=unity"&gt;Microsoft team knows about this bug&lt;/a&gt; but hasn't prioritized it into any released build yet. SO users &lt;a href="http://stackoverflow.com/users/500562/jaster" mce_href="http://stackoverflow.com/users/500562/jaster"&gt;jaster&lt;/a&gt; and &lt;a href="http://stackoverflow.com/users/367601/alex-g" mce_href="http://stackoverflow.com/users/367601/alex-g"&gt;alex-g&lt;/a&gt; proposed workarounds that relieved my pain--just go to Debug|Exceptions..., find the SynchronizationLockException, and uncheck it. As others warned, this will skip over SynchronizationLockExceptions in &lt;i&gt;your&lt;/i&gt; code that you &lt;i&gt;want&lt;/i&gt; to catch, but that wasn't a concern for me in this case. Thanks, guys; I've used that dialog before, but it's been so long I'd forgotten about it.&lt;br&gt;&lt;/p&gt;&lt;p&gt;Now if I could just do the same for Microsoft.CSharp.RuntimeBinder.RuntimeBinderException... Until then, F5 it is. &lt;br&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8389592" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/pjohnson/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/Enterprise+Library/default.aspx">Enterprise Library</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/Unity/default.aspx">Unity</category></item><item><title>MVC's IgnoreRoute syntax</title><link>http://weblogs.asp.net/pjohnson/archive/2010/11/11/mvc-s-ignoreroute-syntax.aspx</link><pubDate>Thu, 11 Nov 2010 22:15:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7640752</guid><dc:creator>pjohnson</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/pjohnson/rsscomments.aspx?PostID=7640752</wfw:commentRss><comments>http://weblogs.asp.net/pjohnson/archive/2010/11/11/mvc-s-ignoreroute-syntax.aspx#comments</comments><description>&lt;p&gt;I've had an excuse to mess around with custom route ignoring code in ASP.NET MVC, and am surprised how poorly the IgnoreRoute extension method on RouteCollection (technically RouteCollectionExtensions, but also RouteCollection.Add, and RouteCollection.Ignore which was added in .NET 4) is documented, both in the official docs by Microsoft, and various bloggers and forum participants who have been using it, some for years.&lt;/p&gt;
&lt;p&gt;We all know these work. The first is in Microsoft code; it and the second are about the only examples out there:&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;routes.IgnoreRoute("{resource}.axd/{*pathInfo}");&lt;br&gt;routes.Ignore("{*allaspx}", new {allaspx=@".*\.aspx(/.*)?"});&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;I understand the first ignores .axd requests regardless of what comes after the .axd part, and the second uses a regex custom constraint for more control over what's blocked. But why is pathInfo a special name that we don't have to define? What other special names could we use without defining? What does .* mean in a regex, if that really is a regex? . is exactly one instance, and * is zero or more instances, so putting them together doesn't make sense to me.&lt;/p&gt;&lt;p&gt;&lt;a href="http://haacked.com/archive/2008/07/14/make-routing-ignore-requests-for-a-file-extension.aspx" title="Haacked: Make Routing Ignore Requests For A File Extension" mce_href="http://haacked.com/archive/2008/07/14/make-routing-ignore-requests-for-a-file-extension.aspx"&gt;Phil Haack provides this equally syntactically confusing example&lt;/a&gt; to prevent favicon.ico requests from going through routing:&lt;/p&gt;&lt;p&gt;&lt;font face="Courier New" size="2"&gt;routes.IgnoreRoute("{*favicon}", new {favicon=@"(.*/)?favicon.ico(/.*)?"});&lt;/font&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;I also tried these in my code:&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;routes.IgnoreRoute("myroute");&lt;br&gt;routes.IgnoreRoute("myroute/{*pathInfo}");&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;The first with URL's that ended in /myroute, and /myroute/whatever, but not /myroute/whatever?stuff=23. The second blocked all three of those, but not /somethingelse?stuff=myroute. Why does this work without putting the constant "myroute" in {} like the resource.axd example above? Is resource really a constant in that example, or just a placeholder for which we could have used any name? Do string constants need curly brace delimiters in some cases and not others? &lt;a href="http://stevesmithblog.com/blog/ignoreroute-in-asp-net-routing-is-order-dependent/" title="Steve Smith: IgnoreRoute in ASP.NET Routing is Order Dependent" mce_href="http://stevesmithblog.com/blog/ignoreroute-in-asp-net-routing-is-order-dependent/"&gt;An example I found on Steve Smith's blog&lt;/a&gt; and on others shows the same thing:&lt;/p&gt;&lt;p&gt;&lt;font face="Courier New" size="2"&gt;routes.IgnoreRoute("{Content}/{*pathInfo}");&lt;br&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;This prevents any requests to the standard Content folder from going through routing. Why the curly braces? &lt;br&gt;&lt;/p&gt;&lt;p&gt;Just to keep things interesting, when I tried to type my IgnoreRoute call above, I accidentally left out the slash:&lt;/p&gt;&lt;p&gt;&lt;font face="Courier New" size="2"&gt;routes.IgnoreRoute("myroute{*pathInfo}");&lt;/font&gt;
&lt;/p&gt;&lt;p&gt;which threw "System.ArgumentException: A path segment that contains more than one section, such as a literal section or a parameter, cannot contain a catch-all parameter." OK, so no slash means more than one section, and including a slash means it's only one section?&lt;/p&gt;Has anyone else had more luck using this method, or found any way to go about it other than trial and error?&lt;br&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7640752" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/pjohnson/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/MVC/default.aspx">MVC</category></item><item><title>SQL Server 2005/2008's TRY/CATCH and constraint error handling</title><link>http://weblogs.asp.net/pjohnson/archive/2010/10/04/sql-server-2005-2008-s-try-catch-and-constraint-error-handling.aspx</link><pubDate>Mon, 04 Oct 2010 19:05:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7623441</guid><dc:creator>pjohnson</dc:creator><slash:comments>2</slash:comments><description>&lt;p mce_keep="true"&gt;I was thrilled that T-SQL finally got the TRY/CATCH construct that many object-oriented languages have had for ages. I had been writing error handling code like this:&lt;/p&gt;
&lt;hr&gt;

&lt;p&gt;&lt;font face="Courier New" size="2"&gt;BEGIN TRANSACTION TransactionName&lt;br&gt;&lt;br&gt;...&lt;br&gt;&lt;br&gt;-- Core of the script - 2 lines of error handling for every line of DDL code&lt;br&gt;ALTER TABLE dbo.MyChildTable DROP CONSTRAINT FK_MyChildTable_MyParentTableID&lt;br&gt;IF (@@ERROR &amp;lt;&amp;gt; 0)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;GOTO RollbackAndQuit&lt;br&gt;&lt;br&gt;...&lt;br&gt;&lt;br&gt;COMMIT TRANSACTION TransactionName&lt;br&gt;GOTO EndScript&lt;br&gt;&lt;br&gt;-- Centralized error handling for the whole script&lt;br&gt;RollbackAndQuit:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ROLLBACK TRANSACTION TransactionName&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;RAISERROR('Error doing stuff on table MyChildTable.', 16, 1)&lt;br&gt;&lt;br&gt;EndScript:&lt;br&gt;&lt;br&gt;GO&lt;br&gt;&lt;/font&gt;&lt;/p&gt;
&lt;hr&gt;

&lt;p mce_keep="true"&gt;...which gets pretty ugly when you have a script that does 5-10 or more such operations and it has to check for an error after every one. With TRY/CATCH, the above becomes:&lt;/p&gt;
&lt;hr&gt;
&lt;font face="Courier New" size="2"&gt;BEGIN TRANSACTION TransactionName;&lt;br&gt;&lt;br&gt;BEGIN TRY&lt;br&gt;&lt;br&gt;...&lt;br&gt;&lt;br&gt;-- Core of the script - no additional error handling code per line of DDL code&lt;br&gt;ALTER TABLE dbo.MyChildTable DROP CONSTRAINT FK_MyChildTable_MyParentTableID;&lt;br&gt;&lt;br&gt;...&lt;br&gt;&lt;br&gt;COMMIT TRANSACTION TransactionName;&lt;br&gt;&lt;br&gt;END TRY&lt;br&gt;&lt;br&gt;-- Centralized error handling for the whole script&lt;br&gt;BEGIN CATCH&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ROLLBACK TRANSACTION TransactionName;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;DECLARE @ErrorMessage NVARCHAR(4000) = 'Error creating table dbo.MyChildTable. Original error, line [' + CONVERT(VARCHAR(5), ERROR_LINE()) + ']: ' + ERROR_MESSAGE();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;DECLARE @ErrorSeverity INT = ERROR_SEVERITY();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;DECLARE @ErrorState INT = CASE ERROR_STATE() WHEN 0 THEN 1 ELSE ERROR_STATE() END;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;RAISERROR (@ErrorMessage, @ErrorSeverity, @ErrorState)&lt;br&gt;END CATCH;&lt;br&gt;&lt;br&gt;GO&lt;br&gt;&lt;/font&gt;
&lt;hr&gt;

&lt;p mce_keep="true"&gt;Much cleaner in the body of the script; we have to do more work in the CATCH (wouldn't it be nice if T-SQL had a THROW statement like C# to rethrow the exact same error that was caught?), but the&amp;nbsp;core of the script that makes DDL changes&amp;nbsp;is cleaner and more readable. The only serious downside I've found so far is when dropping a constraint, and you get a message like this without TRY/CATCH:&lt;/p&gt;
&lt;hr&gt;
&lt;font face="Courier New" size="2"&gt;Msg 3728, Level 16, State 1, Line 1&lt;br&gt;'FK_MyChildTable_MyParentTableID' is not a constraint.&lt;br&gt;Msg 3727, Level 16, State 0, Line 1&lt;br&gt;Could not drop constraint. See previous errors.&lt;br&gt;&lt;/font&gt;
&lt;hr&gt;

&lt;p mce_keep="true"&gt;(In this case I'd check for the constraint before trying to drop it; this is just for illustration. One I've seen more often is trying to drop a&amp;nbsp;primary key&amp;nbsp;and recreate it on a parent table when there are foreign keys on child tables that reference the parent.)&lt;/p&gt;
&lt;p mce_keep="true"&gt;TRY/CATCH&amp;nbsp;shortens&amp;nbsp;the above error to only "Could not drop constraint. See previous errors." with no previous errors shown.&amp;nbsp;Now, some research will reveal why it couldn't drop the constraint, but TRY/CATCH is supposed to make error handling easier and more straightforward, not more obscure. The "See previous errors"&amp;nbsp;line has always&amp;nbsp;struck me as a lazy error message--I bet there's a story amongst seasoned SQL Server developers at Microsoft as to why this throws two error messages instead of one--so I imagine the real problem is in that dual error message more than the TRY/CATCH construct itself as it's implemented in T-SQL.&lt;/p&gt;
&lt;p mce_keep="true"&gt;If anyone has a slick way to get that initial Msg 3728 part of the error, I'm all ears; I've seen several folks&amp;nbsp;ask this question and not one answer yet.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7623441" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/pjohnson/archive/tags/SQL+Server+2008/default.aspx">SQL Server 2008</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/Error+Handling/default.aspx">Error Handling</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/SQL+Server+2005/default.aspx">SQL Server 2005</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/SQL+Server/default.aspx">SQL Server</category></item><item><title>Windows Workflow Foundation (WF) and things I wish were more intuitive</title><link>http://weblogs.asp.net/pjohnson/archive/2010/05/26/windows-workflow-foundation-wf-and-things-i-wish-were-more-intuitive.aspx</link><pubDate>Wed, 26 May 2010 21:29:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7506998</guid><dc:creator>pjohnson</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/pjohnson/rsscomments.aspx?PostID=7506998</wfw:commentRss><comments>http://weblogs.asp.net/pjohnson/archive/2010/05/26/windows-workflow-foundation-wf-and-things-i-wish-were-more-intuitive.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;I've&amp;nbsp;started using Windows Workflow Foundation, and so far ran into a few things that aren't incredibly obvious. Microsoft did a good job of providing a ton of samples, which is handy because you need them to get anywhere with WF. The docs are thin, so I've been bouncing between samples and downloadable labs to figure out how to implement various activities in a workflow.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Code separation or not? You can create a workflow and activity in Visual Studio&amp;nbsp;with or without code separation, i.e. just a .cs "Component" style object with a Designer.cs file, or a .xoml XML markup file with code behind (beside?) it. Absence any obvious advantage to one or the other, I used code separation for workflows and any complex custom activities, and without code separation for custom activities that just inherit from the Activity class and thus don't have anything special in the designer. So far, so good.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Workflow Activity Library project type - What's the point of this separate project type? So far I don't see&amp;nbsp;much advantage to keeping your custom activities in a separate project. I prefer to have as few projects as needed (and no fewer). The Designer's Toolbox window seems to find&amp;nbsp;your custom activities&amp;nbsp;just fine no matter where they are, and the debugging experience doesn't seem to be any different.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Designer Properties&amp;nbsp;- This is about the designer, and not specific to WF, but nevertheless something that's hindered me a lot more in WF than in Windows Forms or elsewhere. The Properties window does a good job of showing you property values when you hover the mouse over the values. But they don't do the same to find out what a control's type is. So maybe if I named all my activities "x1" and "x2" instead of helpful self-documenting names like&amp;nbsp;"listenForStatusUpdate", then I could easily see enough of the type to determine what it is, but any names longer than those and all I get of the type&amp;nbsp;is "System.Workflow.Act" or "System.Workflow.Compone". Even hitting the dropdown doesn't expand any wider, like the debugger quick watch&amp;nbsp;"smart tag" popups do when you scroll through members. The only way I've found around this in VS 2008 is to widen the Properties dialog, losing precious designer real estate, then shrink it back down when you're done to see what you were doing. Really?&lt;/P&gt;
&lt;P mce_keep="true"&gt;WF Designer - This is about the designer, and I believe &lt;EM&gt;is&lt;/EM&gt; specific to WF. I should be able to edit the XML in a .xoml file, or drag and drop using the designer. With WPF (at least in VS 2010 Ultimate), these are side by side, and changes to one instantly update the other. With WF, I have to right-click on the .xoml file, choose Open With, and pick XML Editor to edit the text. It looks like this is one way where WF didn't get the same attention WPF got during .NET Fx 3.0 development.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Service - In the WF world, this is&amp;nbsp;simply a&amp;nbsp;class that talks to the workflow about&amp;nbsp;things outside the workflow, not to be confused with how the term "service" is used in every other context I've seen in the Windows and .NET world, i.e. an executable that waits for events or requests from a client&amp;nbsp;and services them (Windows service, web service, WCF service, etc.).&lt;/P&gt;
&lt;P mce_keep="true"&gt;ListenActivity - Such a great concept, yet so unintuitive. It seems you need at least two branches (EventDrivenActivity instances), one for your positive condition and one for a timeout. The positive condition has a HandleExternalEventActivity, and the timeout has a DelayActivity followed by however you want to handle the delay, e.g. a ThrowActivity. The timeout is simple enough;&amp;nbsp;wiring up the HandleExternalEventActivity is where things get fun. You need to create a service (see above), and&amp;nbsp;an interface for that service (this seems more complex than should be necessary--why not have activities just wire to a service directly?). And you need to create&amp;nbsp;a custom EventArgs class that inherits from ExternalDataEventArgs--you can't create an ExternalDataEventArgs event handler directly, even if you don't need to add any more information to the event args,&amp;nbsp;despite ExternalDataEventArgs not being marked as an abstract class, nor a compiler error nor warning nor any other indication that you're doing something wrong, until you run it and find that it always times out and get to check every place mentioned here to see why. Your interface and service need an event that consumes your custom EventArgs class, and a method to fire that event, but creating the EventArgs by passing in null for the sender parameter--if you pass in this, as one normally does when firing events, for some reason the HandleExternalEventActivity won't see that the event has fired. Then you need to call that method from somewhere. Then you get to hope that you did everything just right, or that you can step through code in the debugger before your Delay timeout expires. Yes, it's as much fun as it sounds.&lt;/P&gt;
&lt;P mce_keep="true"&gt;TransactionScopeActivity - I had the bright idea of putting one in as a placeholder, then filling in the database updates later. That caused this error:&lt;/P&gt;
&lt;HR&gt;
&lt;FONT face="Courier New" size=2&gt;The workflow hosting environment does not have a persistence service as required by an operation on the workflow instance "[GUID]".&lt;BR&gt;&lt;/FONT&gt;
&lt;HR&gt;

&lt;P mce_keep="true"&gt;...which is about as helpful as "Object reference not set to an instance of an object" and even more fun to debug. Google led me to &lt;A class="" title="Trouble with WebService and Persistence" href="http://social.msdn.microsoft.com/forums/en-US/windowsworkflowfoundation/thread/ec7c7852-efcd-4880-a445-9e866faab601/" mce_href="http://social.msdn.microsoft.com/forums/en-US/windowsworkflowfoundation/thread/ec7c7852-efcd-4880-a445-9e866faab601/"&gt;this Microsoft Forums hit&lt;/A&gt;, and from there I figured out it didn't like that&amp;nbsp;the activity had no children. Again, a Validator on TransactionScopeActivity would have pointed this out to me at design time, rather than handing me a nearly useless error at runtime.&amp;nbsp;Easily enough, I disabled the activity and that fixed it.&lt;/P&gt;
&lt;P mce_keep="true"&gt;I still see huge potential in my work where WF could make things easier and more flexible, but there are some seriously rough edges at the moment. Maybe I'm just spoiled by how much easier and more intuitive&amp;nbsp;development elsewhere in the .NET Framework is.&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7506998" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/pjohnson/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/WF/default.aspx">WF</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/WWF/default.aspx">WWF</category></item><item><title>Migrating from VS 2005 to VS 2008</title><link>http://weblogs.asp.net/pjohnson/archive/2009/12/02/migrating-from-vs-2005-to-vs-2008.aspx</link><pubDate>Wed, 02 Dec 2009 17:03:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7268781</guid><dc:creator>pjohnson</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/pjohnson/rsscomments.aspx?PostID=7268781</wfw:commentRss><comments>http://weblogs.asp.net/pjohnson/archive/2009/12/02/migrating-from-vs-2005-to-vs-2008.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;I&amp;nbsp;recently helped migrate a ton of code from Visual Studio 2005 to 2008, and .NET 2.0 to 3.5. Most of it went very smoothly; it touches every .sln, .csproj, and .Designer.cs file, and puts a bunch of junk in Web.Configs, but rarely encountered errors. One thing I didn't expect was that even for a project running in VS 2008 but targeting .NET Framework 2.0, it will still use the v3.5 C# compiler. As such, it does behave a bit differently than the 2.0 compiler, even when targeting the 2.0 Framework.&lt;/P&gt;
&lt;P mce_keep="true"&gt;One piece of code used an internal custom EventArgs class, that was consumed via a public delegate. This code compiled fine using the 2.0 C# compiler,&amp;nbsp;but the 3.5 compiler&amp;nbsp;threw this error:&lt;/P&gt;
&lt;HR&gt;
&lt;FONT face="Courier New" size=2&gt;error CS0059: Inconsistent accessibility: parameter type 'MyApp.Namespace.MyEventArgs' is less accessible than delegate 'MyApp.Namespace.MyEventHandler'&lt;BR&gt;&lt;/FONT&gt;
&lt;HR&gt;

&lt;P mce_keep="true"&gt;It's a goofy situation, the error makes perfect sense, and it was easy to correct (I made both internal), but I expected VS 2008 would use the compiler to match whatever the target .NET Framework version was. I wouldn't have expected any compilation errors it didn't have before conversion, not until I changed the targeted Framework version.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Another funny error happened around code analysis. Code analysis ran fine in VS 2005, but in VS 2008, it threw this error (compilation error, not a code analysis warning):&lt;/P&gt;
&lt;HR&gt;
&lt;FONT face="Courier New" size=2&gt;Running Code Analysis...&lt;BR&gt;C:\Program Files\Microsoft Visual Studio 9.0\Team Tools\Static Analysis Tools\FxCop\FxCopCmd.exe /outputCulture:1033 /out:"bin\Debug\MyApp.Namespace.MyProject.dll.CodeAnalysisLog.xml" /file:"bin\Debug\MyApp.Namespace.MyProject.dll" /directory:"C:\MyStuff\MyApp.Namespace.MyProject\bin\Debug" /directory:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727" /directory:"..\..\..\Lib" /rule:"C:\Program Files\Microsoft Visual Studio 9.0\Team Tools\Static Analysis Tools\FxCop\Rules" &lt;STRONG&gt;/ruleid:-Microsoft.Design#CA1012 /ruleid:-Microsoft.Design#CA2210 ...&lt;/STRONG&gt; /searchgac /ignoreinvalidtargets /forceoutput /successfile /ignoregeneratedcode /saveMessagesToReport:Active /targetframeworkversion:v2.0 /timeout:120 MSBUILD : error : Invalid settings passed to CodeAnalysis task. See output window for details.&lt;BR&gt;Code Analysis Complete -- 1 error(s), 0 warning(s)&lt;BR&gt;Done building project "MyApp.Namespace.MyProject.csproj" -- FAILED.&lt;BR&gt;&lt;/FONT&gt;
&lt;HR&gt;

&lt;P mce_keep="true"&gt;I especially like the "See output window for details," which 1. screams of a Visual Studio hack as it is, and 2. doesn't actually give me any more details in this particular case, though Google tells me that other people do get more information in the output window.&lt;/P&gt;
&lt;P mce_keep="true"&gt;I noticed Debug and Release modes both had code analysis enabled (I think switching Framework versions&amp;nbsp;swapped them on me and I accidentally enabled it in Release mode), and Release mode wasn't erroring out but Debug was. I looked at the difference in the&amp;nbsp;csproj file, and in the FxCopCmd.exe calls, and the key seemed to be the /ruleid parameters (bolded), of which there were a ton in Debug but not Release. Presumably this is because I disabled some of the rules in the project properties, so I tried enabling them all. The&amp;nbsp;number&amp;nbsp;of /ruleid params went down, but it still gave the same error. The Code Analysis tab in project properties looked the same between Debug and Release.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Finally I unloaded the project, edited the csproj file (I'm glad I found out how to do this within VS, instead of exiting VS and editing it in Notepad), and removed this line, which was present in the Debug PropertyGroup element&amp;nbsp;but not the Release one:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;lt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;CodeAnalysisRules&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;-Microsoft.Design#CA1012;-Microsoft.Design#CA2210...&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&amp;lt;/&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;CodeAnalysisRules&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;Code analysis then ran successfully. I imagine this solution isn't ideal for everyone, if you want to enable/disable particular rules, and it's not ideal for us long-term, but it did allow us to keep code analysis enabled without the build failing.&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7268781" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/pjohnson/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/Team+System/default.aspx">Team System</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/Code+Analysis/default.aspx">Code Analysis</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/TFS/default.aspx">TFS</category></item><item><title>Windows 7 rocks!</title><link>http://weblogs.asp.net/pjohnson/archive/2009/12/01/windows-7-rocks.aspx</link><pubDate>Wed, 02 Dec 2009 00:19:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7268283</guid><dc:creator>pjohnson</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/pjohnson/rsscomments.aspx?PostID=7268283</wfw:commentRss><comments>http://weblogs.asp.net/pjohnson/archive/2009/12/01/windows-7-rocks.aspx#comments</comments><description>&lt;P&gt;I bought my current PC almost three years ago. I've had my own PC for 15 years or so, and, aside from my first desktop and a laptop I only use when traveling, that was the only time I've bought a whole PC, rather than buying parts and assembling my own (a Frankenputer as former coworkers affectionately referred to them). Like many of my colleagues who work in Microsoft technologies, I looked into buying a Dell, and they had a fine deal, and more importantly, they had finally started selling AMD processors, which I can proudly say without qualification is the &lt;U&gt;only&lt;/U&gt; CPU in &lt;U&gt;any&lt;/U&gt; computer I've owned. I configured one with a dual core, 64-bit processor, and all sorts of new technologies I'd never heard of but were (and appear to still be) the latest and the greatest. ("What's SATA? We use PCI for video again?" I asked myself.)&lt;/P&gt;
&lt;P&gt;Windows Vista had RTM'd and was weeks from retail availability, and my PC included a deal to upgrade once Microsoft let Dell send upgrade discs. My PC had a rather small (160 GB, I think) hard drive, which I intended to replace with a 500 GB or so once Vista came out, installing it there fresh instead of trying to upgrade Windows--Windows upgrades have never worked so well for me, whereas fresh installs are fine. Then I heard all the complaining about Vista, and decided to hold off. I ran low on space before Vista SP1 came out, so got that second hard drive anyway and kept my photos there. From then on, Windows XP Professional worked "well enough" so I stuck with it.&lt;/P&gt;
&lt;P&gt;Things got bad a couple months before Windows 7 came out. First, Norton AntiVirus misbehaved. To be fair, the program was about 6-7 years old; I kept it around because it seemed to work well enough, I got it free as a student, and virus definition upgrades were free. Then I noticed the dates on the definitions went from a few days ago, to the middle of 1999. It still changed every week, and still found upgrades, so I'm guessing it was just a bug in how it displayed the definitions date, but still made me nervous, as did the prospect of uninstalling old and installing new virus scanners.&lt;BR&gt;&lt;/P&gt;
&lt;P&gt;Roxio was the next to act up. After Microsoft paved the way with Windows Update, suddenly every software manufacturer was convinced their product was just as important to check at least every week for updates, and the updates, just as urgent. Eventually I got Apple to quit bugging me to install Bonjour and Safari, but I couldn't get Roxio (or, perhaps more accurately, InstallShield Update Manager which came with Roxio) to quit prompting me to check for updates on the 0 products I had told it to check. I googled and finally found a tool I could use to uninstall that piece of it, without uninstalling Roxio, on InstallShield's support site.&lt;/P&gt;
&lt;P&gt;&lt;I&gt;That&lt;/I&gt; was a mistake. It stopped prompting me, but added about 3 minutes from when Windows comes up after I start my PC, until my computer was usable, and in the meantime, Norton was disabled, Windows Firewall was disabled, and programs wouldn't start. Add to this a nagging problem where my SD/CompactFlash card reader thinks it's USB 1.x intermittently, and the ugly way Windows Search was grafted onto Windows XP, and the fact that XP (and earlier versions of Windows--not sure about 7 yet) just slows down after a couple years, and I knew it was time to upgrade once Windows 7 came out.&lt;BR&gt;&lt;/P&gt;
&lt;P&gt;The more I learned about Windows 7 (and, to be fair, much of it was new in Vista and largely unchanged in 7, but I'd barely ever used Vista), the more I liked it. The way search worked much faster, more efficiently, and was integrated into everything, even the Start Menu (no more reorganizing each program's 20 or so icons so I could find the ones I actually wanted! no more sorting alphabetically every time I install a new program!)...&amp;nbsp;An &lt;A class="" title="AddictiveTips: Windows 7 Explorer: What's New?" href="http://www.addictivetips.com/windows-tips/windows-7-explorer-whats-new/" mce_href="http://www.addictivetips.com/windows-tips/windows-7-explorer-whats-new/"&gt;overhauled Windows Explorer&lt;/A&gt; including a new&amp;nbsp;&lt;A class="" title="AddictiveTips: What Is Windows 7 Libraries And How To Use It" href="http://www.addictivetips.com/windows-tips/what-is-windows-7-libraries-and-how-to-use-it/" mce_href="http://www.addictivetips.com/windows-tips/what-is-windows-7-libraries-and-how-to-use-it/"&gt;Libraries feature&lt;/A&gt; (not in Vista) that didn't force you to keep everything in your profile for Windows to like it... and finally getting to install 4 GB of memory and take advantage of my 64-bit processor!&lt;/P&gt;
&lt;P&gt;After Microsoft decided one day the long-activated Windows XP installation on my laptop was no longer valid, with no explanation why, I wasn't going to chance them deciding the same thing on my main PC, so I broke down and got the full version of Windows 7. I opted for Home Premium after finding little difference between Home Premium and Professional that I cared about, since Home Premium should be able to run IIS, and if it can't, Visual Studio 2008's web server should be enough for what I need on this PC. I installed it not quite a month ago, replacing NAV and Ad-Aware with the new free and highly-rated &lt;A title="Virus, Spyware &amp;amp; Malware Protection | Microsoft Security Essentials" href="http://www.microsoft.com/Security_Essentials/" mce_href="http://www.microsoft.com/Security_Essentials/"&gt;Microsoft Security Essentials&lt;/A&gt;, and Roxio with--well, either what's built into Windows 7 or my favorite CD ripper &lt;A href="http://www.poikosoft.com/" mce_href="http://www.poikosoft.com/"&gt;Easy CD-DA Extractor&lt;/A&gt;, and it's great. I can work the way I want to, customize things as much as I need (you're close, iPhone, but not quite there), and boy is Aero pretty. I'm a sucker for eye candy (I &lt;I&gt;do&lt;/I&gt; have an iPhone).&lt;/P&gt;
&lt;P&gt;The search works great. I was leery about using Windows Search (installed against your will by Office 2007) or Google Desktop Search (must be unchecked in order to not install with every Adobe program and tons of others) add-ons for Windows XP; that sort of thing just seems like too core a functionality to get some freebie add-on to handle. Windows XP's built-in search might suck, but it usually found what I wanted, and didn't take &lt;I&gt;too&lt;/I&gt; long. Sure enough, Windows 7 search works instantly, and if you copy over a ton of files it hasn't indexed, as I did when I wiped my hard drive to install 7 then copied back from my backup, it might not find everything right away, but it will after it spends a few minutes indexing them. And, as advertised, it doesn't slow me down while I'm using the PC; I haven't heard my hard drive crank once while I've been writing this long post. By default, it only indexes in your Libraries, and MS suggests anything you want indexed, you put in a Library. That put me off at first--what if I need to search for a system file or something?--but really, the vast majority of stuff I search for slots fine in either the Documents, Music, or Pictures Libraries. Moving from XP to 7 takes some adjustment, but I gave it a chance, and I'm quite happy with it. And if I do ever need to do a search for a certain DLL, it's easy enough to add folders to the list of what's indexed. I don't even have to dig into Administrative Tools and various Control Panel applets and System Tools folders, wondering where Microsoft has hidden that options screen in &lt;I&gt;this&lt;/I&gt; version, thanks to the Start Menu search feature. I just click the Windows key, type "index", and it's the first option:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://weblogs.asp.net/blogs/pjohnson/StartMenuSearch.png"&gt;&lt;IMG src="http://weblogs.asp.net/blogs/pjohnson/StartMenuSearch.png" border=0&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just like searching on the web, the content is what matters; its physical location is now much less important. You just type in a word or two and it figures out what you want, no matter where it is.&lt;/P&gt;
&lt;P&gt;Another great and long-overdue improvement is the Windows Explorer dialogs for long-running file operations--deleting, copying, moving. It gives you more of the path, and best of all, an accurate estimate of how long it will take, and the rate at which it's copying files! No more operations where it takes 45 seconds for the first part and 23987105 minutes for the last part.&lt;/P&gt;
&lt;P&gt;The most annoying thing I've found so far is based on principle, and not any difference I've observed. Occasionally, programs crash. Two that I use often, Mozilla Firefox and &lt;A title="IrfanView image viewer" href="http://www.irfanview.com/" mce_href="http://www.irfanview.com/"&gt;IrfanView&lt;/A&gt;, have each crashed once. (Amusingly, both when they tried to start up the Apple QuickTime plug-in; I have a few things to say about my iTunes migration experience, but that'll have to wait for another post.) But once is all it takes in Windows 7, before Program Compatibility Assistant (PCA) kicks in and applies some sort of mysterious sanctions to the offender.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://weblogs.asp.net/blogs/pjohnson/FirefoxPCA.png"&gt;&lt;IMG src="http://weblogs.asp.net/blogs/pjohnson/FirefoxPCA.png" border=0&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obviously I was curious about what those "settings" it applied were, and how to grant amnesty for first-time offenses. That link has &lt;A title="Program Compatibility Assistant: frequently asked questions" href="http://windows.microsoft.com/en-US/windows7/Program-Compatibility-Assistant-frequently-asked-questions" mce_href="http://windows.microsoft.com/en-US/windows7/Program-Compatibility-Assistant-frequently-asked-questions"&gt;a help article with those exact questions&lt;/A&gt;. And the answer? "It depends," and "go to TechNet and teach yourself about group policy," respectively. (In their words, "Adjustments to program compatibility features can be made by using Group Policy. For advanced information on how to use Group Policy, go to the &lt;A title="TechNet home, and you're on your own!" href="http://go.microsoft.com/fwlink/?LinkId=66683" mce_href="http://go.microsoft.com/fwlink/?LinkId=66683"&gt;Microsoft website for IT professionals&lt;/A&gt;.") Seriously? A little more googling and I found out that you can dig into it, or &lt;A title="Turn Off Program Compatibility Assistant - MAXIMUMpcguides" href="http://maximumpcguides.com/windows-7/turn-off-program-compatibility-assistant/" mce_href="http://maximumpcguides.com/windows-7/turn-off-program-compatibility-assistant/"&gt;disable PCA altogether, using Group Policy Editor&lt;/A&gt;, which... doesn't come with Home Premium. So it sounds like my only choice is manually editing the registry. I can't even find out what PCA changed about how those programs run; a few articles allude to ominous performance degradations in order to ensure stability. Windows 7 addresses so many things that bugged me about XP and earlier versions; it's a shame they dropped the ball on this one. To be fair, it seems that this is how Vista functioned, and Windows 7 didn't make it worse, but didn't improve it, either.&lt;/P&gt;
&lt;P&gt;But, to summarize, I'm thrilled with Windows 7, and with 64-bit computing, though I'm a little surprised more programs aren't 64-bit (Firefox and Flash Player, I'm looking at you). Oh well--we had the same problem switching from 16-bit to 32-bit, but I'm glad enough software and hardware is there, that I can upgrade and work just fine until the rest of it makes it.&lt;BR&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7268283" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/pjohnson/archive/tags/Vista/default.aspx">Vista</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/Windows+7/default.aspx">Windows 7</category></item><item><title>TFS deleted files still show up in Source Control Explorer</title><link>http://weblogs.asp.net/pjohnson/archive/2009/12/01/tfs-deleted-files-still-show-up-in-source-control-explorer.aspx</link><pubDate>Wed, 02 Dec 2009 00:02:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7268274</guid><dc:creator>pjohnson</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/pjohnson/rsscomments.aspx?PostID=7268274</wfw:commentRss><comments>http://weblogs.asp.net/pjohnson/archive/2009/12/01/tfs-deleted-files-still-show-up-in-source-control-explorer.aspx#comments</comments><description>&lt;p&gt;One problem I've had in Team Foundation Server since Visual Studio 2005 and still in VS 2008 is when items are deleted by someone else, they still show up in Source Control Explorer, with a gray folder with a red X icon, even with "Show deleted items in the Source Control Explorer" unchecked in VS's Options dialog. Sometimes getting latest of the parent clears things up, but other times it doesn't, even with Get Specific Version with both Overwrite boxes checked to force a get. In this case, the only option I've found is to delete my workspace and recreate it, which means checking in &lt;i&gt;everything&lt;/i&gt; beforehand, and getting latest of my working branches afterwards. It's a pain, but as &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/tfsversioncontrol/thread/3168c733-7c16-499b-adaf-07d0b212a972" title="Visual Studio Team System Forums - Get latest (even with force) won't remove deleted files from my source control explorer" mce_href="http://social.msdn.microsoft.com/Forums/en-US/tfsversioncontrol/thread/3168c733-7c16-499b-adaf-07d0b212a972"&gt;specified here and approved by a Microsoft employee&lt;/a&gt;, that may be your only option until it's fixed--fingers crossed for VS 2010. (We won't get into the other things for which my fingers have been crossed since I first used TFS in 2005, things that VSS did just fine, such as rollback, check in changes and keep checked out, and search.)&lt;/p&gt;&lt;p&gt;Anyone have any better solutions? Deleting and recreating your workspace seems a bit drastic.&lt;br&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7268274" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/pjohnson/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/Team+System/default.aspx">Team System</category></item><item><title> VS 2008 and .NET 3.5 Beta 2 released, with Go Live</title><link>http://weblogs.asp.net/pjohnson/archive/2007/07/26/vs-2008-and-net-3-5-beta-2-released-with-go-live.aspx</link><pubDate>Thu, 26 Jul 2007 21:18:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:3288029</guid><dc:creator>pjohnson</dc:creator><slash:comments>4</slash:comments><description>&lt;p&gt;It's official! In one of the first of a few dozen posts you'll read about it, Scott Guthrie announces &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/07/26/vs-2008-and-net-3-5-beta-2-released.aspx" mce_href="http://weblogs.asp.net/scottgu/archive/2007/07/26/vs-2008-and-net-3-5-beta-2-released.aspx"&gt;Visual Studio 2008 and the .NET Framework 3.5 Beta 2 have been released&lt;/a&gt;.&lt;br&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=3288029" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/pjohnson/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Microsoft Sandcastle</title><link>http://weblogs.asp.net/pjohnson/archive/2007/07/03/microsoft-sandcastle.aspx</link><pubDate>Tue, 03 Jul 2007 16:27:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:3007498</guid><dc:creator>pjohnson</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;In working with my company's offshore developers, I was tasked with providing them documentation on a set of class libraries we use in our applications. In the .NET 1.0/1.1 time frame, we used &lt;a href="http://ndoc.sourceforge.net/" mce_href="http://ndoc.sourceforge.net/"&gt;NDoc&lt;/a&gt;, which, sadly, &lt;a href="http://weblogs.asp.net/bhouse/archive/2006/07/26/NDoc-2.0-_2D00_-R.I.P.aspx" title="Brenton House: NDoc 2.0 - R.I.P" mce_href="http://weblogs.asp.net/bhouse/archive/2006/07/26/NDoc-2.0-_2D00_-R.I.P.aspx"&gt;passed away last year&lt;/a&gt;, to turn the XML comments output by the C# compiler into CHM help files. After a bit of googling and a &lt;a href="http://www.doxygen.org/" title="Doxygen" mce_href="http://www.doxygen.org/"&gt;false start&lt;/a&gt;, I discovered Sandcastle, which Microsoft &lt;a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=517576&amp;amp;SiteID=1" title="MSDN Forums: Documentation Compiler - Sandcastle" mce_href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=517576&amp;amp;SiteID=1"&gt;uses to build the .NET Framework documentation itself&lt;/a&gt;. I also discovered from the &lt;a href="http://blogs.msdn.com/sandcastle/" mce_href="http://blogs.msdn.com/sandcastle/"&gt;Sandcastle blog&lt;/a&gt; that it takes &lt;a href="http://blogs.msdn.com/sandcastle/archive/2006/07/29/682398.aspx" title="Sandcastle Blog: Creating a Chm build using Sandcastle" mce_href="http://blogs.msdn.com/sandcastle/archive/2006/07/29/682398.aspx"&gt;a whole mess of manual steps to use&lt;/a&gt;, which appeared daunting at first glance, and, being a programmer, I was looking for an easier (lazier) way.&lt;/p&gt;&lt;p&gt;From the &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=E82EA71D-DA89-42EE-A715-696E3A4873B2&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?familyid=E82EA71D-DA89-42EE-A715-696E3A4873B2&amp;amp;displaylang=en"&gt;official Sandcastle download page&lt;/a&gt;, I found the &lt;a href="http://www.sandcastledocs.com/Wiki%20Pages/Home.aspx" mce_href="http://www.sandcastledocs.com/Wiki%20Pages/Home.aspx"&gt;Sandcastle Wiki&lt;/a&gt;, and from there, an NDoc-like, Visual Studio-like GUI for it creatively titled &lt;a href="http://www.codeplex.com/SHFB" mce_href="http://www.codeplex.com/SHFB"&gt;Sandcastle Help File Builder&lt;/a&gt;. Setting up a SHFB project and getting the documentation to compile, and then to look/behave almost exactly like I envisioned, was simple at this point.&lt;/p&gt;&lt;p&gt;Overall, I'm pretty impressed how easy it was to discover this and find resources to use it--a lot easier than it used to be to fill a component/tool need that Microsoft claims to address (some of the data access pieces in the Visual InterDev 6.0 time frame come to mind). Really, the hardest part was getting the Google terms right!&lt;/p&gt;&lt;p&gt;Again, you can &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=E82EA71D-DA89-42EE-A715-696E3A4873B2&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?familyid=E82EA71D-DA89-42EE-A715-696E3A4873B2&amp;amp;displaylang=en"&gt;download Sandcastle here&lt;/a&gt;. The latest version is the June 2007 CTP (Community Technology Preview, which you probably already know means it's pre-release), released a couple weeks ago.&lt;br&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=3007498" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/pjohnson/archive/tags/General+Software+Development/default.aspx">General Software Development</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/Sandcastle/default.aspx">Sandcastle</category></item><item><title>HTTP modules - subdirectories and private variables</title><link>http://weblogs.asp.net/pjohnson/archive/2007/03/02/http-modules-subdirectories-and-private-variables.aspx</link><pubDate>Fri, 02 Mar 2007 21:29:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:1871475</guid><dc:creator>pjohnson</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/pjohnson/rsscomments.aspx?PostID=1871475</wfw:commentRss><comments>http://weblogs.asp.net/pjohnson/archive/2007/03/02/http-modules-subdirectories-and-private-variables.aspx#comments</comments><description>&lt;p&gt;I recently finished (for now--there&amp;#39;s always more to do) one of the more complex HTTP modules I&amp;#39;ve worked on. I have an application first written in the ASP.NET 1.0 beta 2 time frame that&amp;#39;s since been upgraded to 1.0, 1.1, and now 2.0. It had a lot of custom authentication and error handling code in global.asax, and for general architecture and server management purposes, I wanted to move this code into separate HTTP modules. I ran into a couple gotchas I wanted to document.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Lesson 1: You can&amp;#39;t disable an HTTP module for a subdirectory.&lt;/strong&gt; I wanted to remove the HTTP module for one subdirectory using the &amp;lt;location&amp;gt; configuration element, and while it let me put it in my web.config fine and never threw an error a la &amp;quot;It is an error to use a section registered as allowDefinition=&amp;#39;MachineToApplication&amp;#39; beyond application level.&amp;nbsp; This error can be caused by a virtual directory not being configured as an application in IIS.&amp;quot;, when I ran it, it went into the module&amp;#39;s code as if that config section wasn&amp;#39;t there.&lt;/p&gt;&lt;p&gt;&lt;a href="http://weblogs.asp.net/scottgu/" title="ScottGu&amp;#39;s Blog"&gt;Scott Guthrie&lt;/a&gt; explained to me why: &amp;quot;HttpModules are application specific. When an application starts up, a number of HttpApplication&amp;#39;s get configured (one for each logical thread that will execute in the application), and HttpModules are created and assigned to them. That is why you need to configure them at the application root (or higher) level in config. This enables much better pooling of resources.&amp;quot; He pointed out that other HTTP modules in ASP.NET handle this with custom configuration sections, which is more work than I was looking at doing for this release.&lt;/p&gt;&lt;p&gt;An exception to this rule is if that subdirectory itself is configured
as an IIS application, but in many cases (including mine), this is more
trouble than it&amp;#39;s worth, limiting what user controls it can see,
requiring its own bin directory... and if you&amp;#39;re going to do all that,
it&amp;#39;s probably going to need its own web.config file anyway. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Lesson 2: You shouldn&amp;#39;t use private member variables in an HTTP module.&lt;/strong&gt; I&amp;#39;ve been an ASP.NET programmer long enough that I thought I could figure out whether member variables were safe or not. I could argue for it either way, and I wasn&amp;#39;t feeling ambitious enough to wade through all that code in Reflector. I finally found &lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.httpapplication.aspx" title="HttpApplication Class (System.Web)"&gt;official documentation for the HttpApplication&lt;/a&gt; class that said, &amp;quot;One instance of the HttpApplication class is used to process many requests in its lifetime; however, it can process only one request at a time. Thus, member variables can be used to store per-request data.&amp;quot; So it made sense that if an HTTP module is wired to a particular HttpApplication instance, the same rule would apply, and member variables would be safe in HTTP modules as well.&lt;/p&gt;&lt;p&gt;Again,&amp;nbsp; Scott helped me out by advising me against member variables: &amp;quot;If you have an async operation occur during the request, I believe ASP.NET might switch the HttpModule to another thread to execute. That is my worry with storing local variables. It might work in your dev environment, but generate different results under high-load on a server.&amp;quot; And no one needs any more &amp;quot;works great in dev and QA but not production&amp;quot; sorts of issues. He advised storing such things in HttpContext.Items instead, but in my case, the data was so cheap to calculate and consumed rarely enough that I decided to just have a method to calculate it every time. Interestingly, by switching from global.asax (where member variables were fine) to an HTTP module, I took a step back in this department, but overall it was the right move and the way I would have written the app from the beginning had I been more familiar and experienced with ASP.NET.&lt;br /&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=1871475" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/pjohnson/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>ASPInsiders Summit 2006 - C# 3.0 and LINQ</title><link>http://weblogs.asp.net/pjohnson/archive/2007/01/16/aspinsiders-summit-2006-c-3-0-and-linq.aspx</link><pubDate>Tue, 16 Jan 2007 21:19:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:1419216</guid><dc:creator>pjohnson</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/pjohnson/rsscomments.aspx?PostID=1419216</wfw:commentRss><comments>http://weblogs.asp.net/pjohnson/archive/2007/01/16/aspinsiders-summit-2006-c-3-0-and-linq.aspx#comments</comments><description>&lt;p&gt;C# 3.0 (not to be confused with the confusingly-named &lt;a href="http://www.netfx3.com/"&gt;.NET Framework 3.0&lt;/a&gt;, which includes C# 2.0, not C# 3.0) was the most exciting thing discussed at the ASPInsiders Summit. When I first learned a bit about &lt;a href="http://msdn2.microsoft.com/en-us/netframework/aa904594.aspx" title="Microsoft: The LINQ Project"&gt;LINQ&lt;/a&gt; at the 2005 summit, I didn&amp;#39;t really get what was so great about taking some mangled SQL syntax and duct-taping it onto the language. Given a few hours for &lt;a href="http://en.wikipedia.org/wiki/Anders_Hejlsberg" title="Wikipedia: Anders Hejlsberg"&gt;Anders Hejlsberg&lt;/a&gt;, the lead architect of C#, to explain LINQ, how it came to be, how it works behind the scenes, and why it&amp;#39;s a Good Thing, I changed my mind. He and Scott Guthrie sold me on LINQ (at least, as much as I could be until it&amp;#39;s released and I can play with it first-hand).&lt;br /&gt; &lt;/p&gt;&lt;p&gt;Most of the big changes in C# 3.0 were driven by LINQ, which is why I&amp;#39;m talking about them in conjunction. But this doesn&amp;#39;t mean they&amp;#39;re LINQ-specific; I can think of a ton of cases independent of LINQ where this stuff will be useful. It reminds me of when &amp;quot;XML web services&amp;quot; was repeated in every lecture, article, blog post, knowledge base article, and whitepaper from Microsoft that talked about the .NET Framework when it first came out, as if that was the main thing anyone would use the framework for. Though I&amp;#39;ve done a ton of .NET programming, I think &lt;em&gt;maybe&lt;/em&gt; 1% of has had &lt;em&gt;anything&lt;/em&gt; to do with web services. Thankfully, only few seem to have been fooled by that and adoption took off anyway.&lt;/p&gt;&lt;p&gt;But back to C# 3.0&amp;#39;s new features. These are explained in more depth and with more examples on the &lt;a href="http://msdn2.microsoft.com/en-us/netframework/aa904594.aspx"&gt;LINQ Project site&lt;/a&gt;, so check out the overview there for more information--no need for me to duplicate all that.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Local variable type inference&lt;/strong&gt; (or, &amp;quot;No, it&amp;#39;s OK, the var keyword isn&amp;#39;t evil anymore&amp;quot;). Former ASP programmers like me instinctively shudder when we see the keyword &amp;quot;var&amp;quot;, and recoil a bit when we hear it&amp;#39;s being introduced to C#. But this has nothing to do with late binding or strong typing--this is just something to allow programmers to be just a little lazier. The basic idea is if you have a long type like &lt;span style="font-size: 8pt; font-family: 'Courier New'"&gt;Dictionary&amp;lt;int, MyCoolButLongType&amp;gt;&lt;/span&gt; you&amp;#39;re newing up on the right, you don&amp;#39;t have to type all that on the left since the compiler already knows what type it is.&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 8pt; font-family: 'Courier New'"&gt;int i = 5;&lt;br /&gt;
Dictionary&amp;lt;int, Order&amp;gt; orders = new Dictionary&amp;lt;int, Order&amp;gt;();&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 8pt; font-family: 'Courier New'"&gt;&lt;/span&gt;is 100% equivalent to:&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana"&gt;&lt;/span&gt;&lt;span style="font-size: 8pt; font-family: 'Courier New'"&gt;var i = 5;&lt;br /&gt;
var orders = new Dictionary&amp;lt;int, Order&amp;gt;();&lt;/span&gt;&lt;/p&gt;&lt;p&gt;The variable &lt;span style="font-size: 8pt; font-family: 'Courier New'"&gt;orders&lt;/span&gt; still has the same type of &lt;span style="font-size: 8pt; font-family: 'Courier New'"&gt;Dictionary&amp;lt;int, Order&amp;gt;&lt;/span&gt; it does in the first example. It&amp;#39;ll still behave the same as it did, you&amp;#39;ll still get the same Visual Studio IntelliSense you did, and the IL will be the same. Var is &lt;em&gt;not&lt;/em&gt; variant here--it&amp;#39;s &amp;quot;I&amp;#39;m lazy so let the compiler figure it out.&amp;quot;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Extension methods.&lt;/strong&gt; This allows you to &amp;quot;add&amp;quot; your own methods to types you can&amp;#39;t otherwise change yourself, e.g. in the .NET Framework or third-party libraries. So if you&amp;#39;ve always wanted a string.FooBar() method, just write it as an extension method, include its namespace, and you&amp;#39;ve got your string.FooBar() method. Everyone&amp;#39;s got a pet peeve this can address--some method they wish the framework provided, a string or numeric operation. Now it&amp;#39;s yours, whatever you want, however you want it to work.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Lambda expressions.&lt;/strong&gt; This is another feature for laziness/concision, making it easier to write a function inline than you could with C# 2.0&amp;#39;s anonymous methods.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 8pt; font-family: 'Courier New'"&gt;List&amp;lt;Customer&amp;gt; customers =
GetCustomerList();&lt;br /&gt;
List&amp;lt;Customer&amp;gt; locals = customers.FindAll(c =&amp;gt; c.State == &amp;quot;KY&amp;quot;);&lt;/span&gt; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;reads as &amp;quot;Find all c such that c.State equals Kentucky&amp;quot;. The compiler infers that the return type of this lambda expression is boolean, due to the comparison operator ==.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Object initializers.&lt;/strong&gt; This is one of the (few) good things about VBA (Visual Basic for Applications), the version of VB included with the Microsoft Office products and a platform on which I unfortunately found myself doing a lot programming several years ago. Using the new keyword to create an instance of an object, you can now specify initial values for public properties and fields.&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 8pt; font-family: 'Courier New'"&gt;Person value = new Person { Name = &amp;quot;Chris Smith&amp;quot;, Age = 31 };&lt;/span&gt;&lt;/p&gt;&lt;p&gt;creates a new Person instance, setting its Person.Name and Person.Age properties.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Query expressions.&lt;/strong&gt; This is what LINQ looks like on the surface. An example statement using a query expression on the right side:&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 8pt; font-family: 'Courier New'"&gt;var customerQuery = &lt;/span&gt;&lt;span style="font-size: 8pt; font-family: 'Courier New'"&gt;&lt;/span&gt;&lt;span style="font-size: 8pt; font-family: 'Courier New'"&gt;from c in customers&lt;br /&gt;
where c.State == &amp;quot;WA&amp;quot;&lt;br /&gt;
select new {c.Name, c.Phone};&lt;/span&gt;&lt;/p&gt;&lt;p&gt;where customers is a custom collection, like &lt;span style="font-size: 8pt; font-family: 'Courier New'"&gt;List&amp;lt;Customer&amp;gt;&lt;/span&gt;. One of the biggest questions I had is why in the world they took the SQL SELECT..FROM..WHERE syntax we all know and &amp;quot;love&amp;quot; and jumbled it up. Fortunately, Anders addressed this, saying Microsoft considered implementing LINQ syntax it in the same order as SQL, but really, SQL doesn&amp;#39;t make sense. When you execute a SQL query, it starts with FROM and WHERE (table/index scans), then goes to SELECT, just like these query expressions in C#. C# doing it this way both helps get IntelliSense and is more forward-looking (what makes sense if we were designing this from scratch, and giving ourselves the option to expand it later) than backward-looking (how&amp;#39;s it been done before; what are people used to). It looks weird the first time to those of us used to seeing SQL, but it makes sense after you get past that hump.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Expression trees.&lt;/strong&gt; The .NET Framework (and C#) will have expression trees and expression parsing built in. So for example, you can give it a string, and it will build a tree of Expression objects behind the scenes to represent it. Anyone who&amp;#39;s written their own search or query syntax can imagine how powerful this could be.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;So look again at the above query expression. The C# compiler rewrites it as:&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 8pt; font-family: 'Courier New'"&gt;var customerQuery = &lt;/span&gt;&lt;span style="font-size: 8pt; font-family: 'Courier New'"&gt;customers.Where(c =&amp;gt; c.State == &amp;ldquo;WA&amp;rdquo;).Select(c
=&amp;gt; new {c.Name, c.Phone});&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Now you can see how all this begins to tie together: A query expression gets expanded into a more verbose and less readable statement using extension methods (&lt;span style="font-size: 8pt; font-family: 'Courier New'"&gt;List&amp;lt;Customer&amp;gt;&lt;/span&gt; doesn&amp;#39;t have a native Where method) and lambda expressions. The lambda expressions get parsed into expression trees and return &lt;strong&gt;anonymous types&lt;/strong&gt; (the return value of the Select lambda expression). We reference the results of the query expression with a local variable using type inference (we can&amp;#39;t determine the return type of the query expression, and with type inference it doesn&amp;#39;t matter--nevertheless it&amp;#39;s still strongly typed). It&amp;#39;s the &lt;a href="http://www.imdb.com/title/tt0110357/" title="IMDb: Lion King (1994)"&gt;circle of life&lt;/a&gt;!&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Hopefully I&amp;#39;m explaining this clear enough that some of you can understand why at this point I was getting very impressed. Keep in mind all this compiler magic doesn&amp;#39;t come at any efficiency/performance hit at runtime.&lt;/p&gt;&lt;p&gt;In case this syntax isn&amp;#39;t enough to sell you on LINQ, here are a few more objective reasons. With just ADO.NET today, you have queries as quoted strings, parameters loosely bound, and results loosely typed, and the compiler can&amp;#39;t help check code; LINQ helps in that classes describe data, the query is natural part of the language instead of a string, and the compiler provides IntelliSense and compile-time checking--it&amp;#39;s entirely strongly typed in C# and VB. Another reason is that LINQ can be used to query against objects, DataSets, SQL data sources, XML out of the box using an extensible provider-driven model like those you find in .NET 2.0 today. And it has paging built-in, not specific to SQL Server.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Again, check out the &lt;a href="http://msdn.microsoft.com/library/en-us/dndotnet/html/linqprojectovw.asp" title="MSDN: LINQ Project Overview"&gt;LINQ Project Overview&lt;/a&gt; if you want more information, including a more detailed look at the
features I mentioned and a few I skipped over.&lt;br /&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=1419216" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/pjohnson/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/ASPInsiders2006/default.aspx">ASPInsiders2006</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/Events/default.aspx">Events</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/ASPInsiders/default.aspx">ASPInsiders</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/pjohnson/archive/tags/LINQ/default.aspx">LINQ</category></item></channel></rss>