Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Tests failing when using MVVMLight PCL
dotnetprofessional
#1 Posted : Tuesday, March 4, 2014 7:26:37 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/4/2014(UTC)
Posts: 7
Location: United States of America

Thanks: 2 times
Was thanked: 1 time(s) in 1 post(s)
I'm currently using the following for my tests:

MVVMLight PCL (Portable Class Library version)
MSpec
NSubstitute

When tests run that include the following line of code in my ViewModels (Portable Class library referenced by Spec project)

if (this.IsInDesignMode)
{
// Set some properties
}

It will fail with the following exception:

System.IO.FileLoadException: Could not load file or assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) ---> System.IO.FileLoadException: The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
--- End of inner exception stack trace ---

Removing this line allows the tests to pass without failure. The reason I'm posting here though is because if I use ReSharpers test runner I don't get this exception, so it would seem to be an issue with the NCrunch test runner specifically.

At the moment, I'm forced to use the ReSharper test runner for these tests which reduces where I can use NCrunch significantly.

Any help with resolving this issue would be greatly appreciated.

Thanks
Garry Mc
Remco
#2 Posted : Tuesday, March 4, 2014 9:56:56 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi Garry -

Thanks for sharing this issue.

To help me best establish what is happening here, would you be able to try placing your solution into compability mode? I'm wondering if any specific configuration setting in here will help to resolve the issue.


Cheers,

Remco
dotnetprofessional
#3 Posted : Wednesday, March 5, 2014 11:46:42 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/4/2014(UTC)
Posts: 7
Location: United States of America

Thanks: 2 times
Was thanked: 1 time(s) in 1 post(s)
Remco;5466 wrote:
Hi Garry -

Thanks for sharing this issue.

To help me best establish what is happening here, would you be able to try placing your solution into compability mode? I'm wondering if any specific configuration setting in here will help to resolve the issue.


Cheers,

Remco


Thanks for the quick response, however I'm still getting the same issue once I changed all the settings. To help with your investigates I've created a repro which you can find here:

http://1drv.ms/1jSMd7I

Please let me know if you need any further information.

Thanks.
Remco
#4 Posted : Thursday, March 6, 2014 4:12:35 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
dotnetprofessional
#5 Posted : Thursday, March 6, 2014 7:49:14 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/4/2014(UTC)
Posts: 7
Location: United States of America

Thanks: 2 times
Was thanked: 1 time(s) in 1 post(s)
Brilliant, its working!! Truly appreciate your quick turn around time, this will be a big help.

Thanks again!
Garry Mc
Remco
#6 Posted : Thursday, March 6, 2014 10:03:18 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Excellent! Thanks!
Jhallenb
#7 Posted : Friday, June 7, 2019 9:44:43 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/7/2019(UTC)
Posts: 2
Location: Sweden

Thanks: 1 times
Remco, I see the very same problem not using Ncrunch but MVVM Light in a big project with many dependencies.
I need to track it down.

Since you have solved the very same problem for Ncrunch, may I ask you to describe what was causing this issue in NCrunch and what you did to resolve it? That would help me a lot I think.
Remco
#8 Posted : Friday, June 7, 2019 11:42:23 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
I'm not sure if the solution implemented for NCrunch would apply in your situation, but I can summarise the change for you.

In its runtime environment, NCrunch hooks the AppDomain AssemblyResolve event and implements custom search logic to find assemblies using its own knowledge of where they are likely to be stored on the system. The code change to fix this issue involved making the resolution handler much broader in its search for dependencies. In your situation, such a change could probably be considered a hack, but likely a very powerful one.
1 user thanked Remco for this useful post.
Jhallenb on 6/8/2019(UTC)
Jhallenb
#9 Posted : Saturday, June 8, 2019 8:01:22 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/7/2019(UTC)
Posts: 2
Location: Sweden

Thanks: 1 times
Thanks
Our application is also resolving assemblies dynamically from different sources. MVVM Light is included as a part of a plugin.
The dependencies of MVVMLight like System.Component dll files are also used by the SW and are loaded by it instead. Maybe that is causing the issue then. Thanks this gives me a good starting point.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.060 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download