Tag: Development

Visual Studio 2013 Test Explorer improvement request

As much as I like the slightly improved Test Explorer in Visual Studio 2013, there’s plenty of room for improvement. I use it for unit testing (obviously), but I also create vast numbers of integration tests, particular for functionality that processes data, and here it would be nice with the following improvements:

  1. Update the header of a group (Time [Long] in the image below) with the number of finished tests, say 4/1 if 1 out of 4 tests has finished executing.
  2. Update the minutes for long running tests, so the minutes shown next to a test isn’t shown only when it is finished, but also when running.



Windows 8.1, Internet Explorer 11, SharePoint, DataSheet View

I upgraded to Windows 8.1 (64-bit) and I love it, even with some of the minor flaws already mentioned in other blog entries, but I started getting the dreaded issue with not being able to view a SharePoint 2010 list in DataSheet view. Even worse is that I know how to fix it, or at least I thought I did…

The issue didn’t start right after upgrading to Win 8.1, but a few days after. Now, after repairing my previous fix, http://office.microsoft.com/en-us/sharepoint-server-help/use-datasheet-view-in-64-bit-office-2010-HA101882420.aspx, I still had the issue. However, I accidentally added the SharePoint development site to the compatibility view list, and things started working again. It turns out that there is a check box in the Compatibility View Settings dialog box, Display intranet sites in Compability View, that I must have cleared prior to the error happening. Hmm, only wasted a good day on this…

The Web Application Project … is configured to use IIS. Unable to access the IIS metabase. You do not have sufficient privilege to access IIS web sites on your machine.

I just moved a Visual Studio solution containing a Web Application project from a Windows 7 based dev box to a Windows 8 based dev box, and in line with recommended security guidelines, I try to avoid running Visual Studio (2012 in this case) as an admin. However, in this case, the solution is to run VS as an administrator. Sigh… I do Wonder though as to why VS would need admin access to IIS. I’m sure there is a plausible explanation, but I just don’t see it.

System.ArgumentNullException: Value cannot be null. Parameter name: principal

I am working on my Dynamic Data website, or rather web application, in VS 2012 RC, and after reading Dynamic Data Unleashed, http://www.amazon.com/ASP-NET-Dynamic-Data-Unleashed-Oleg/dp/0672335654/ref=sr_1_1?ie=UTF8&qid=1342425509&sr=8-1&keywords=dynamic+data, I picked up a few nice tricks, including how to secure your data at the entity level. So, I copied some of the sample code across to my solution, and once everything was building nicely, I started testing the new bits. First access to an entity worked just fine, but any other attempt to access the same entity or any other entity for that resulted in this error:

System.ArgumentNullException: Value cannot be null. Parameter name: principal

Rather annoying, since the sample code worked just fine. It turns out that the methods for checking if the current user is allowed to read a specific entity received a principal that was null. Here is the signature of one of the methods:

public override bool CanRead(IPrincipal principal)

The method is called from another method that checks if a column should be scaffolded/shown to the current user.

private bool IsScaffoldable(MetaColumn column)

This method was calling the CanRead method passing HttpContext.Current.User. This works just fine when you use the ASP.NET Development Server when testing inside Visual Studio. However, if you use IIS Express, it does not work; the error described is consistent. So, I tried the full IIS, but the same thing happened.

It turns out that the issue is with the Integrated pipeline mode, which is new to IIS 7 and later. HttpContext.Current isn’t always available, as you can find more evidence of by Bing’ing it. The solution in my case was to use Thread.CurrentPrincipal instead.

Invalid Animation definition for TargetControlID=”…”: The ‘Animations’ start tag on line x position x does not match the end tag of ‘OnHide’. Line x, position x.

I was adding filters (grabbed from “Dynamic Data Steve’s” website here, http://csharpbits.notaclue.net/2010/11/five-cool-filters-for-dynamic-data-4.html) to my Dynamic Data website and the Autocomplete filter makes use of the AJAX Control Toolkit, http://ajaxcontroltoolkit.codeplex.com/. Steve has done a fantastic job over the years with customizing many aspects of Dynamic Data, so I was a little sad to see that I got this error Invalid Animation definition for TargetControlID=”…”: The ‘Animations’ start tag on line x position x does not match the end tag of ‘OnHide’. Line x, position x., when trying to view a table/entity in the ListDetails view. After quite a thorough investigation, it turned out it was because of the presence of the VisualStudioDesignTime key you can add to your appSettings element in web.config.
     VisualStudioDesignTime:Enabled" value="true" />
It is used by the new Page Inspector, which you can find information about here, http://blogs.msdn.com/b/webdevtools/archive/2011/09/22/page-inspector-for-visual-studio-11-developer-preview.aspx. Remove the add element/tag and the error goes away.


After updating to Visual Studio 2012 RC, I now get the error whether or not the VisualStudioDesignTime:Enabled key is present or not. However, if I remove the 4 comments within the opening and closing ajaxToolkit:AutoCompleteExtender tags, everything works just fine, even with the VisualStudioDesignTime:Enabled key present. 🙂

Visual Studio 2012 – XAML-like event handler generation

When creating a new WebForm in ASP.NET by using Visual Studio 11, I noticed that a context menu is displayed, once you type in the = (equal sign) after the event name in Source view. It is this context menu that contains the item Create New Event. If you then press Tab, the event handler method is automatically generated in the code-behind file. I like it, after having used with XAML and particularly Silverlight development. 🙂

No key property values were found during an update or delete operation. Check to ensure that key properties specified as binding expressions are available to the data source.

I was working on a Dynamic Data website and everything was working great. Then I decided to add some of the features from a standard ASP.NET Web Application project, including the CSS and Login functionality to the Dynamic Data project. This worked well too. Then I reworked the routing to use the ListDetails.aspx view only, and after a while I started getting this error, No key property values were found during an update or delete operation. Check to ensure that key properties specified as binding expressions are available to the data source., but only for some tables. Obviously, the first thing to check was the Entity Framework model, to see what those tables had in common and what they didn’t have in common with the other tables. I just could not find anything there. I got the error when doing an inline update in the GridView on the ListDetails view, not if I used the FormView for updating, so I scrapped the idea of the data model being at fault. I then also found that the Select functionality in the Gridview control did not update the FormView control with the selected row, which it did previously. Now I was on to something; the view state had been turned off on the ContentPlaceHolder control in the master page. I’m not entirely sure how this caused the error, but once it was turned back on, everything worked as expected.

Visual Studio 2012 Beta – Generate Local Resource error

When using the Generate Local Resource functionality (available from the Tools menu) in Visual Studio 11 Beta, it only works for a single Web Form. For subsequent Web Forms, the menu item is grayed out in Design mode and missing in Source mode. This seems to be a Beta error, as you can close and reopen Visual Studio 11, and regain the functionality. A little trivial, but it works. 🙂