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

Notification

Icon
Error

NCrunch should scan the sut's binary dir for DLLs
mrt181
#1 Posted : Tuesday, May 31, 2011 11:04:13 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/31/2011(UTC)
Posts: 4
Location: Germany

Thanks: 1 times
Hello,

i have written some code that determines at runtime which objects it should instantiate. I am also able to add new classes at runtime by adding new dlls to the projects binary output directory.

Code:
public static AbstractBase<T> Create<T>() where T : class
{
    string implementationTypeName = ConfigurationManager.AppSettings["Class"];
    string assemblyName = ConfigurationManager.AppSettings["Assembly"];
    string typeParmaterName = typeof(T).ToString();
    
    string typeName = string.Format("{0}`1[[{1}]], {2}", implementationTypeName, typeParmaterName, assemblyName);
    
    Type type = Type.GetType(typeName, true);
    
    // Singleton used in implementation
    var instance = type.GetProperty("Instance").GetValue(null, null)
    
    return new Base<T>((IImplementation<T>)instance);
}


Quote:
*** Assembly Binder Log Entry (31.05.2011 @ 13:16:15) ***

The operation failed.
Bind result: hr = 0x80070002. Das System kann die angegebene Datei nicht finden.

Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Programme\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2010\nCrunch.TaskRunner40.x86.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = GROUP\r892107
LOG: DisplayName = RWEST.Trading.WeatherDashboard.CacheManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///B:/Temp/4172/62/bin/debug
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = nCrunch.TestRunner_141f3976b0d7453083b0e2bf2bf34e3e
Calling assembly : Base.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///B:/Temp/4172/62/bin/debug/Base.DLL.
LOG: Attempting download of new URL file:///B:/Temp/4172/62/bin/debug/Base/Base.DLL.
LOG: Attempting download of new URL file:///B:/Temp/4172/62/bin/debug/Base.EXE.
LOG: Attempting download of new URL file:///B:/Temp/4172/62/bin/debug/Base/Base.EXE.
LOG: All probing URLs attempted and failed.


To make my unit test go green i have to copy the implementation DLL to the tests binary output directory.

Unfortunately NCrunch only checks its temp paths for the specified assembly.
Remco
#2 Posted : Tuesday, May 31, 2011 12:10:45 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
Hi Mrt181,

Have you tried using the CopyReferencedAssembliesToWorkspace configuration option? Let me know if this solves the issue for you.
mrt181
#3 Posted : Tuesday, May 31, 2011 1:24:25 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/31/2011(UTC)
Posts: 4
Location: Germany

Thanks: 1 times
I have made a mistake. My Implementation references my Abstraction. Therefore my Abstraction can't reference my Implementation, (circular reference). That is great because the Abstraction shouldn't be aware of concrete implementations.
Because of this i have to add the implementation DLLs manually to my Abstraction project.
My Test can reference both, so after adding the implementation reference to the Test everything works.

Sorry for bothering you.
Remco
#4 Posted : Tuesday, May 31, 2011 4:54:26 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
Not a problem. I'm glad to hear it's working well! :)
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.034 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download