Licensing exception with Ivonna the Typemock add-in (and any other add-ins I suspect)

Like a good developer I have been trying to run Visual Studio with least privilege; with Windows 7 this seems to work well. My main account is not an administrator, but Windows prompts me for elevated rights when needed. I have been developing happily with Visual Studio and Typemock without any need for extra rights.

However, when I have been doing some testing using Ivonna, the Typemock add-in, I hit a problem. When I tried to create an Ivonna.Framework.TestSession() I got a Licensing.LicenseException: This copy has expired. Which it hadn’t as I have a fully licensed product.

I had got so use to not needing elevated privilege I did not consider it to be the problem; so I contacted Sm-Art and Typemock support. The answer was simply to run Visual Studio with administrator privileges (right click on the short cut). Once this is done the licensing exception goes away as Typemock has enough rights to look in the right bit of the registry to access the add-in license. I have suggested that if possible this requirement needs to be addressed.

The other alternative is to grant your non administrator account more rights in the registry. On a 64bit development box it seems you need to a Read-Write access to HKEY_LOCAL_MACHINE\SOFTWARE\TypeMock and HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\TypeMock

System.Web.Abstractions missing on a ASP.NET web site

I recently re-enabled feature on a ASP.NET site. This feature (a set of pages) had been running OK about six months ago for an initial pilot project but was disabled until now until a decision was made to develop the feature fully. In intervening time the web site had other modification and had been rebuilt (it was targeted at .NET 3.5) without issue.

When I re-enabled the feature (renamed a .ASPX file) I got the error

Could not load file or assembly 'System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Now this surprised me, I had not change the .NET version targeting or changed development environment. In the end I fixed it by copying up the missing DLL to the bin directory. I had tried adding the following to the web.config to no effect

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
   <dependentAssembly>
    <assemblyIdentity name="System.Web.Abstractions" publicKeyToken="31BF3856AD364E35"/>
    <bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="0.0.0.0"/>
   </dependentAssembly>
  </assemblyBinding>
</runtime>
</configuration>

On think a bit more I think the issue must have been caused by:

  • I may have upgraded to .NET to 3.5. SP1 in the time frame (but I thought I did it earlier)
  • I have installed MVC on my development PC, and most other posts that mention this issue also mention MVC, usually beta versions.

EIther way it is fixed now

Alt.Net ‘In the north’ – wrapping it all up

Thanks to everyone who was able to attend the Alt.net ‘In the North’ conference today; and also to our sponsors. The event could not happened without you all.

As promised here is the list of blogs, books etc. we had on the whiteboard.

Books
Bridging the Communication Gap: Specification by Example and Agile Acceptance Testing Gojko Adzic
User Stories Applied: For Agile Software Development (Addison Wesley Signature Series) by Mike Cohn
Agile Estimating and Planning by Mike Cohn
Crystal Clear: A Human-Powered Methodology for Small Teams by Alistair Cockburn
Domain-driven Design: Tackling Complexity in the Heart of Software by Eric Evans
Sketching User Experiences: Getting the Design Right and the Right Design by Bill Buxton

Blogs
http://weblogs.asp.net/scottgu/ (Scott Guthrie)
http://www.hanselman.com/blog/ (Scott Hanselman)
http://ayende.com/ (Oren Eini)
http://mattberseth.com/ (Matt Berseth)
http://oakleafblog.blogspot.com/ (Roger Jennings)

Events
http://openspacecode.com – Coding events in London, next one 30th May
http://www.developerdayscotland.com/ – Free community conference in Glasgow 2nd May
http://www.agileyorkshire.org/ – Agile Yorkshire user group meets in Leeds every 2nd Wednesday in month
http://www.blackmarble.co.uk/events – Various free events in Leeds/Bradford area

Tools
http://www.hanselman.com/blog/ScottHanselmans2007UltimateDeveloperAndPowerUsersToolListForWindows.aspx – Tool list
http://www.balsamiq.com/products/mockups/desktop – UI Sketch tool
www.openquarters.org (coming soon) the MVC CMS that Anthony demonstrated at the conference
and a digital camera to capture your whiteboard drawings

I think that is all, thanks again to you all for making it such an rewarding event.

Technorati Tags:

Team Build, Code Coverage and MVC

I have been working on some automated build and testing for a project based on the Microsoft MVC framework. The build was working fine, and test were being run, but I was not seeing any code coverage data in the build summary in Visual Studio for the builds done by the Team Build box. However if I ran the test suite locally on a development PC the coverage data was there. Looking on the Team Build drop location I could find the data.coverage file in the TestResults\<guid>\In\<build user> folder, but it was 84Kb in size, which I learnt means ‘contains no data’.

After a good deal of hunting I found a pointer to the answer the OZTFS forum. The problem is that as the MVC project is a web project, and it build a _PublishedWebsites folder and puts the assemblies into this. In effect the code coverage is just looking in the wrong place.

The fix is as follows:

  • Make sure you have suitable TestRunConfig1.testrunconfig file in your solution
  • Open this file in the VS IDE and make sure code coverage is enabled for the assemblies you want (and if your assemblies are signed that the re-sign key is set)
  • Open you tfsbuild.proj file for the automated team build and make sure you have a testing block similar to the block below, change the path to the RunConfigFile as required.

<!--  
TESTING Set this flag to enable/disable running tests as a post-compilation build step.
-->
<RunTest>true</RunTest>
<!--
CODE ANALYSIS Set this property to enable/disable running code analysis. Valid values for this property are
Default, Always and Never.
Default - Perform code analysis as per the individual project settings
Always - Always perform code analysis irrespective of project settings
Never - Never perform code analysis irrespective of project settings
-->
<RunCodeAnalysis>Default</RunCodeAnalysis>

<!--
CODE COVERAGE Set the test run configuration
-->
<RunConfigFile>$(SolutionRoot)\MyWebSolution\TestRunConfig1.testrunconfig</RunConfigFile>



  • If you test this locally you should get code coverage results, but if you run the build on a Team Build box the code coverage section in the test report will show "No coverage result"
  • Now the important bit – open the TestRunConfig1.testrunconfig file in Notepad and add an extra block to the <regular> code coverage section to additionally point to the assembly(s) in the _PublishedWebsites structure (you could also use the VS IDE on the build box to add the file if you wanted, but this will warn over an assembly being added twice). When complete the XML file should look similar to the one below


<?xml version="1.0" encoding="UTF-8"?>
<TestRunConfiguration name="TestRunConfig1" id="b6360bec-8278-4773-a931-f22bfab2c57f" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2006">
<Description>This is a default test run configuration for a local test run.</Description>
<CodeCoverage enabled="true" keyFile="MyWebsite\ProjectKey.snk">
<AspNet>
<AspNetCodeCoverageItem id="88655819-3261-43ac-b2d8-2d3aa1aabaef" name="MyWebsite" applicationRoot="/" url="http://localhost:0/" />
</AspNet>
<Regular>
<CodeCoverageItem binaryFile="C:\builds\MyWebsite\CIBuild\Binaries\Release\_PublishedWebsites\MyWebsite\bin\MyWebsite.dll" pdbFile="C:\builds\MyWebsite\CIBuild\Binaries\Release\_PublishedWebsites\MyWebsite\bin\MyWebsite.pdb" instrumentInPlace="true" />
</Regular>
</CodeCoverage>
<TestTypeSpecific>
<WebTestRunConfiguration testTypeId="4e7599fa-5ecb-43e9-a887-cd63cf72d207">
<Browser name="Internet Explorer 7.0">
<Headers>
<Header name="User-Agent" value="Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)" />
<Header name="Accept" value="*/*" />
<Header name="Accept-Language" value="{{$IEAcceptLanguage}}" />
<Header name="Accept-Encoding" value="GZIP" />
</Headers>
</Browser>
<Network Name="LAN" BandwidthInKbps="0" />
</WebTestRunConfiguration>
</TestTypeSpecific>
</TestRunConfiguration>



  • Once this is done you can run the tests locally or on the build machine and in both cases MSTest manages to find the assembly to test the code coverage on and reports the results.

Holiday is when you catch up…..

I got round to listening to the latest Radio TFS podcast today whist our for a run, Adopting Team System with Steve Borg. If you are looking at adopting TFS or even just critically looking at your development life cycle with a view to improving (irrespective of the tools you use), then this podcast is well worth the time to listen to. It actually covers a lot of the points I was discussing at the Agile Yorkshire user group this week in my session of Crystal Clear. By now I would usually have put my slide stack up for all to download, but in this case, as my session was a book review in essence I would like you to read the original Crystal Clear by Alistair Cockburn.

In my opinion, the key point they both raise is the that it is important to have a process that provides:

  • Safety – provides a framework that means the project can safely be delivered
  • Efficiency – development should be in an efficient manner
  • Habitable – that the team can live with the process (if they can’t the process will be avoided/subverted)

Or to put it another way (and quoting here from the Crystal Clear book) “a little methodology does a lot of good, after that weight is costly”

A point raised at the user group in the chat after my session was that of how to get senior people (such as CEO, CFO etc) to buy into the ‘new’ development process (a critical factor for success). Too often it is heard “I don’t care if you are agile or not, I just want it delivered” and no support is provided beyond the actual coding team from the business. A good discussion of this type of problem is in Gojko Adzic’s book Bridging the Communication Gap: Specification by Example and Agile Acceptance Testing. This is written for non software developers and discusses how to make sure that the whole business is involved in the development process, thus enabling the project to deliver what the business really needs not what people think they need. I would say this book is an essential for anyone involved in the software specifications process – and that should be everyone in an agile project!