Problem loading Castle.Core in 1.2

Oct 6, 2010 at 11:47 AM

I'm running in to a problem; StatLight loads up, and immediately throws a ReflectionTypeLoadException:

 

********************* ReflectionTypeLoadException **************************

Begin Loader Exception Messages *****

- Could not load file or assembly 'Castle.Core, Version=2.5.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. The system cannot find the file specified.

***** End Loader Exception Messages *****

 

The tests do all run after that point, however anything that requires a mocked interface fails, presumably because Castle.Core isn't around to produce it.

Any clues as to what I'm doing wrong? I've got a reference in my Silverlight test project to Castle.Core-Silverlight, and using Reflector I can see that it does contain Castle.Core.

I can't even begin to think how I can try to work out what is wrong, so any suggestions for how I can investigate this would be appreciated.

Coordinator
Oct 6, 2010 at 3:18 PM
Edited Oct 6, 2010 at 3:18 PM

Hello

To see if I could reproduce your issue here's what I did.

  1. Created a new silverlight test project
  2. Downloaded and added a reference to the Moq project (and it's Castle.Core assembly)
    1. Note: In windows explorer I had to right click on the assembly file and select Properties -> and then click the "Unblock" to allow my solution to compile.
  3. I created a simple moq example (http://codepaste.net/re7xxv)
  4. Built the project and executed StatLight against the xap

It all worked fine (with one passing test).

Here's a couple things you should take a look at.

1. In the latest build of Moq they are also using a newer version of Castle.Core. In your post above you call out "Castle.Core-Silverlight" however, in the latest Moq build it's called just "Castle.Core"(.dll).
2. Do the tests run if you "F5" the project?
3. Check the version number of the assembly that is in your test xap file.

Let me know what you find out. Thanks

Oct 6, 2010 at 4:15 PM

Well, now I'm thoroughly confused!

I've got references to Moq.Silverlight.dll, as well as Castle.Core-Silverlight and Castle.DynamicProxy-Silverlight.

I've tried adding in the Silverlight-less versions of the dlls, and I get an error saying that I can't add it as it wasn't built against the Silverlight runtime.

I've got version 4.0.10827.0 of both Moq dlls.

If I run the project via VS2010, then it runs and runs all the tests. I do get some tests failing.

However, if I look at Moq.Silverlight.dll in Reflector, and it has Castle.Core.dll in the list of references, and if I click on it, it is unable to find the dll, so there's definitely something screwy going on with my setup!

Cheers for looking into it, it must be something we've done here. I'll let you know if we work it out!

Coordinator
Oct 6, 2010 at 5:07 PM

If you go to the moq home page

http://code.google.com/p/moq/

Click on the new 4.0.... download Moq.4.0.10827.zip http://code.google.com/p/moq/downloads/detail?name=Moq.4.0.10827.zip

In that zip file is a build of Silverlight (which is what I used in my test).

Hope this helps.

 

 

Oct 14, 2010 at 1:41 PM

Sorry, I was being an idiot! Someone else had deleted the Castle.Core.dll from our solution. That's why it wasn't finding it!

Coordinator
Oct 14, 2010 at 3:59 PM

Good to hear it's resolved. 

Happy testing...