Using the CodeRush Test Runner with Platform Specific Libraries

by hugodahl 13. August 2012 00:57

An issue appeared today for a co-worker, who was getting failing unit tests on one of our components, when the tests were being run from the CodeRush Test Runner. By the way, have I mentioned my love for CodeRush + Refactor? No? Well I do, to the point where I have a work license as well as a personal, paid for out of my own pocket, license! Unfortunately, he was getting an error whenever he ran the tests against the library, which we know has been working without issue for years. Not only that, but when he checked the build history on our build box, there was no report of failing tests. That reminds me, you ARE running your unit test suite in your Continuous Integration environment, right? Right?


He then mentioned the error he was getting, which is a BadImageFormatException getting thrown. That immediately connected two dots in my head, and I verified my suspicions. I was right, as it turns out, our image processing library is compiled against a .Net wrapper against a platform specific DLL targeting the x64 platform. It turns out, his CodeRush test runner was running in 32 bit mode. The fix was a simple one, where he simply had to tell CodeRush to run in x64 mode if the target platform was AnyCPU. The option is fairly obvious, if you know where to look.


Coderush Test RunnerIn order to enable it, bring up the CodeRush options (DevExpress menu –> Options or Ctrl+Alt+Shift+O for the keyboard inclined), expand the "Unit Testing" option folder on the left, and select the "Test Runner" sub-item. In the main window, about half way down, you will see a checkbox marked as "Execute in x64 mode if active configuration is AnyCPU". Check that, click Ok, and you’re set!


It is important to note that the only time this will cause an issue, if you have a library that is explicitly targeting a specific platform. If all of your libraries are targeting AnyCPU, you will not run into a problem, though you probably want to run your tests to where you are targeting both platforms, in case you notice any discrepancies, run into overflows, type incompatibilities, etc. In our case, we have an C++ image processing library that was compiled and linked to target the x64 platform, and as such, will only run in 64 bit mode.


Unit Testing | Tips and Tricks

Using OData from Objective-C - Fixing the odatagen NSRangeException bug

by hugodahl 9. July 2011 14:10

Lately, I've been working on getting a small sample project up and running on the iOS platform, and using an OData endpoint for external data access. Fortunately, the OData site is an incredibly useful resource for a vast array of information, from both the publisher and consumer perspective. There is even an office Microsoft OData helper project for Objective-C which lives over on Codeplex.

Part of this toolkit is an incredibly indispensible tool, which in its simplest form, can generate your entity classes (.h and .m files) from the OData Metadata. So in theory, if you wanted to generate the entities for the Netflix catalog API, all you need to do is call it as such:
./odatagen /uri= /out=~/Projects/MyNetflixApp


Tags: , , ,

Objective-C | odata

Book Review - The Art of Unit Testing: With Examples in .Net

by hugodahl 4. July 2011 10:00
Title The Art of Unit Testing: With Examples in .Net
Author(s) Roy Osherove (blog)
Rating 5 / 5
Release Date May 2009
Publisher Manning Publications
Book Site
Publisher’s support site Manning Sandbox
Book Support Site

I first started reading Roy Osherove’s “The Art of Unit Testing” over a year ago, as my team was ramping up design and development of a new application to be written, in its entirety, in new technology (.Net framework 4.0, WPF, EF 4.0, etc). So new in fact, that when we started development, there was no “4.0” released, it was still at the Beta 2 stage. Also, since we were to be the first truly “agile” (scrum) team, we knew we had a lot of eyes on us, both from above as well as from fellow developers. By “truly agile” we were fairly close to textbook. We all worked in the same environment (shared room), including 3 developers (with one added for a 1.5 month stint to make up lacking capacity), manager/scrum master as well as QA. We had a CI environment which was setup and maintained. We had a scrum board, or boards, which were large 24” x 36” post-its or a wall when needed, filled with user stories, tasks, backlog, all diligently written and managed on post-it notes.

Tags: ,

Books | Unit Testing

Quick, Handy-Dandy 1Password (Mac) Shortcut

by hugodahl 23. December 2010 02:16

Here’s a quick little handy shortcut for Agile Web Solutions1Password product on the Mac.

In the past, when I needed to get information about a credit card or a password for an account I have stored in 1Password, I would take the long route of either editing the item, selecting the field, then either read or copy/paste the value, or simply use the “Copy” option found when hovering your mouse over the secret field.

However, I recently accidentally ran into the following trick, should you need to see the information that is masked, when running the full application (not the browser plugins), such as passwords, PIN, CCV, etc, do the following.


1Password - Secrect information masked

  1. Select the item you want to see from your Vault, be it login, wallet item, etc.
  2. Note the super-secret information is masked from view with dots, as in the example depicted above.
  3. Press and hold the “Option” key, and the secret information will be revealed, as in the example below.


1Password - Secrect information unmasked


That’s it! Very simple, but oh so effective and handy when dealing with a situation where you can’t use 1Password to auto-fill the information, either on a website that doesn’t play nice, or over the phone. Maybe auto-fill over the phone will be a feature in version 4!

Tags: , , ,

Application | Tips and Tricks

Using Platform Specific Libraries from a Platform Agnostic Project

by hugodahl 24. November 2010 03:14

Scenario: You are writing an application or library which targets the "AnyCPU" platform, but reference an external library (such as LeadTools) which are platform specific (x86/32 bit, x64/64 bit)

This situation is handled in several places, as there is no one unifying solution which applies to all phases of development.

During the Development Process

Storing the references

Create one folder for each supported platform. These can be placed either in a central location, or a subfolder of the solution/project. Best practice is to name the folder after the target platform. While this is by no means required, it is strongly recommended and urged.

  • x86
  • AMD64
  • IA64 (very rate, not covered in this article, but the same steps apply and will work)

Folder Structure.PNG

Initial project creation and adding references

Add the references to the project through Visual Studio as you typically would. Choose the binaries which are applicable for the platform which are presently using.

Tags: ,

C# | HOWTO | Tips and Tricks


<<  December 2014  >>

View posts in large calendar

Month List