February 2008 - Posts

Why wont you just work....
Monday, February 25, 2008 8:32 AM

In a previous post on some problems I had with VS2005 and unit testing where running unit tests always gave me this:


I reported that uninstalling and re-installing the test components of Visual Studio fixed it up. Well I am getting the exact same behaviour with VS2008 now. So, I thought I would uninstall the unit test component of VS2008, then re-install it, and all would be good.

Not quite, uninstalling it, then re-installing it did nothing. On further examination, the tools didn't actually uninstall. Currently, I have uninstalled the entire Team test tools selection as you can see below.


However, I still have all the functionality to run unit tests in VS2008! So not only can I not run unit tests, I cannot even uninstall anything!


Please..... why wont you just work? I have better things to do with my time....

For anyone interested in the details, it has issues trying to load the Microsoft.VisualStudio.QualityTools.Common.dll assembly as shown by the exception text below;

Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.Common, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

Now this (and all the Quality tools assemblies) are located in the PrivateAssemblies folder, just like they are on a colleagues machine, and yet they cannot be found.

Update: I got jack of it not working after multiple attempts at uninstalling and re-installing the test components, and simply copied all the Microsoft.VisualStudio.QualityTools.* assemblies from the PrivateAssemblies folder into the ...\Common7\IDE folder. It is now working as expected.

by Glav | 2 comment(s)
Filed under: ,
WCF & ASP.NET Role Provider
Friday, February 8, 2008 3:08 PM

So I was talking to Shea Strickland a relatively new starter in readify who is doing some WCF work and asked  about the role provider support in WCF. He pointed me to an article by Dominick Baier who mentioned that the RoleProviderPrincipal in WCF will actually cause a database call each time an IsInRole check is performed.

After some experimentation, this was confirmed by myself to be absolutely true. If a service request comes in, and during the course of that request, you make 3 IsInRole checks (perhaps at various layers of the domain model for example), then the database will get 3 requests to execute a stored proc to check the users role.

By contract, the ASP.NET RolePrincipal will get all the users roles when the first IsInRole check is performed, and then subsequent role checks will not hit the database at all, but rather check against the roles that are in memory.

I was somewhat disappointed by this as it meant that potentially, a lot of extra DB work is being performed, and not exactly what I would call best practice. Luckily, WCF is pretty easy to extend, and again, with the help of an article by Dominick Baier, I created a custom authorisation policy (implements IAuthorizationPolicy) which could be plugged into WCF, and use the standard ASP.NET RolePrincipal, thus getting the behaviour we are after.

To that end, I have created a small library with the authorisation policy code ready for you to download and use.

Simply download the library here, then make a change to your configuration file as shown below.


I would consider this a pretty common requirement if you are using the ASP.NET Role Providers in WCF, so this is why I have made this available. In addition, its a pretty small piece of code, but its still not that easy to discern via just spelunking around WCF (as Dominick already mentioned).

So hopefully this is useful for others.

by Glav | 5 comment(s)
Filed under: , ,
ASP.NET, CSS & Control Adapters
Monday, February 4, 2008 9:06 PM

I thought I'd pass on some link love to Damian Edwards, the resident readify CSS god. Here recently did an RDN presentation on using CSS effectively with ASP.NET and the first of a series of articles on that very subject can be found here.

its a great article and well worth your time to read, especially if you want to make ASP.NET are good CSS citizen.

by Glav | with no comments
Filed under: , , ,
More Posts

This Blog