How to waste half a day getting R# to run unit tests…

by Mikael Henriksson 10. December 2009 14:11

Today I feel like the most retarded guy on planet earth. I have just wasted half a day trying to get R# to run my unit tests. The tests simply does not even start so they don’t fail either. 
A check of the output window shows that there is a possible chance of a FileNotFoundException which I thought was bullshit. I had a look at the settings for R# Unit Test and no there was nothing that I could do to make it work. Since I AM a smart guy usually (I am just feeling a bit stupid today) I decided to make all exceptions throw so that I could at least find some sort of trace or hint of where the problem actually occurs.

Ctrl+Alt+E takes you to the Visual Studio exceptions settings where I turn everything to throw and then I start debugging the unit tests. After a good few clicks some interesting exceptions shows up. It’s a FileNotFoundException and it looks like this:

System.IO.FileNotFoundException occurred
  Message="Could not load file or assembly 'file:///D:\\Apps\\NUnit 2.5.2\\bin\\net-2.0\\lib\\nunit.core.dll' or one of its dependencies. The system cannot find the file specified."
  Source="mscorlib"
  FileName="file:///D:\\Apps\\NUnit 2.5.2\\bin\\net-2.0\\lib\\nunit.core.dll"
  FusionLog="=== Pre-bind state information ===
  LOG: User = MOBILENORDIC\\mikael
  LOG: Where-ref bind. Location = D:\\Apps\\NUnit 2.5.2\\bin\\net-2.0\\lib\\nunit.core.dll
  LOG: Appbase = file:///D:/Projects/****.IntegrationTests/bin/Debug
  LOG: Initial PrivatePath = NULL
  Calling assembly : (Unknown).===
  LOG: This bind starts in LoadFrom load context.
  WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
  LOG: Using application configuration file: D:/Projects/****.IntegrationTests\\bin\\Debug\\*.IntegrationTests.dll.config
  LOG: Using machine configuration file from C:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\config\\machine.config.
  LOG: Attempting download of new URL file:///D:/Apps/NUnit 2.5.2/bin/net-2.0/lib/nunit.core.dll."
  StackTrace:
       at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
       at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
       at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
       at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, StackCrawlMark& stackMark)
       at System.Reflection.Assembly.LoadFrom(String assemblyFile)
       at JetBrains.ReSharper.UnitTestProvider.nUnit.NUnitTaskRunner.ExecuteRecursive(TaskExecutionNode node) in c:\Agent\work\cc29ccea5bf569df\src\UnitTestProvider.nUnit\src\NUnitTaskRunner.cs:line 103
  InnerException: 

Well interesting, it turned out that it was actually me being stupid. I was positive this had nothing to do with R# but the level of retardness does not stop here! I go back to the R# settings and look for somewhere to change the path to nunit but can’t find anything so I rename my d:\apps\nunit folder to match the one I couldn’t find and try again and now my unit tests run perfectly. I decided the bloody thing had messed with me for the last time! Going back to the settings for Unit Tests in R# I am faced with the following picture:

resharper_unit_test_settings

Now where the heck is that darn setting??? I open up the resharper.user file in notepad2 and search for nunit and at the bottom I found this:

  <UnitTestRunnerNUnit>
    <NUnitInstallDir>D:\Apps\NUnit 2.5.2\bin\net-2.0</NUnitInstallDir>
    <UseAddins>Always</UseAddins>
    <UseSpecifiedNUnit>True</UseSpecifiedNUnit>
  </UnitTestRunnerNUnit>

Now I can change this to the folder where it is REALLY located and that is great when it hits me. I remember changing this in resharper for some stupid reason and I also remember that I did so within the Resharper Unit Test section of the options. While navigating back and clicking on nunit I am looking at the following picture:

resharper_nunit_settings

 

Either I am mentally retarded or that part of the ReSharper options is so pick your choice.

Tags: ,

FAIL | R# | Testing

System.Runtime.Serialization.DataContractAttribute' does not contain a definition for 'IsReference

by Mikael Henriksson 27. January 2009 18:59

This is indeed not the brightest thing that could happen to your .NET framework installation and the cause of the problem seems to be installing Expression Studio and probably the 2.0 version of Blend. The frustrating part of it all is that when you get this problem there is probably like for me only one solution. You can't reference the Assembly that is in the GAC anymore. You need to pick browse every time you need System.Runtime.Serialization.dll.

I had a look at the file on my private computer where the problems started. the version that is in the GAC for me is an old version from january 2008 but on my work-computer the version is dated 30th of june 2008.

There is no easy way of replacing that january version but this is what I did. I searched for Runtime.Serialization.dll on my troubled computer and just browsed to one of those files from within Visual Studio 2008.

 

Problem solved, no more System.Runtime.Serialization.DataContractAttribute' does not contain a definition for 'IsReference anymore.

This is something you need to adress at microsoft. No installation should overwrite newer versions of ANY dll please!

Tags:

FAIL

How do I install Bluetooth in Windows 2008 Server x64?

by Mikael Henriksson 27. January 2009 18:59

I had problems with this and the reason is obvious. You should not use any type of wireless on a server operating system. I do however like many other use Windows 2008 Server x64 on my laptop for development and work. It is far superior to Vista x64. You get all these goodies that is not available from scratch in Vista, like Hyper-V, domain management tools etc.

One of the main reasons I use a laptop is to get rid of as much wires and cables as is possible. That's why I like bluetooth for syncing my mobile. Hey I am only a confused programmer. Can't expect me to keep all things I need to do in my head. I need all that "head-space" for more important things, like keeping c#, generics, asp.net, entity framework, dynamics, wpf and more. Since the twisted x64 drivers would not install on my computer it was time for some serious googlin'. Stumbled upon a couple of really lame articles before I found a real masterpiece by Gil Kirkpatrick. Don't ask me where this guy got it from though. It's all really simple and I'll just give you my changed files in a zip file in the end.

To keep it a bit shorter than he did you only need to:

  1. Install your freaking x64 drivers
  2. Restart computer
  3. Copy some files from C:\Windows\System32\DriverStore\FileRepository to a directory of your choice like... C:\BT (most of them start with bth, btw and btv)
  4. Change all occurances of NTamd64...1 to NTamd64...3 (one of those -"Don't ask" 's)
  5. Turn Bluetooth on
  6. Go in to device manager, update drivers point to the directory you chose to keep the copies.
  7. Repeat for all other unknown bluetooth devices.

Have fun with your bluetooth devices!

I'm blue(tooth) la da di la da da

Tags:

FAIL

About the author

Life architect specialized in programming