Error before running tests: FileNotFoundException / Dimebrain

Jul 14, 2011 at 3:08 PM

I'm getting an unhandled exception when trying to run any of my Silverlight unit tests from ReSharper.

Message: Could not load file or assembly 'Dimebrain.Web.Silverlight.Serialization, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

Full stack trace: System.IO.FileNotFoundException was unhandled by user code  Message=Could not load file or assembly 'Dimebrain.Web.Silverlight.Serialization, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.  StackTrace:       at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)       at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)       at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)       at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)       at System.Reflection.CustomAttribute.IsCustomAttributeDefined(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable)       at System.Reflection.CustomAttribute.IsCustomAttributeDefined(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType)       at System.Reflection.CustomAttribute.IsDefined(RuntimeType type, RuntimeType caType, Boolean inherit)       at System.RuntimeType.IsDefined(Type attributeType, Boolean inherit)       at Microsoft.Silverlight.Testing.Harness.ReflectionUtility.GetTypesWithAttribute(Assembly assembly, Type decoratingAttribute)       at Microsoft.Silverlight.Testing.UnitTesting.Metadata.VisualStudio.UnitTestFrameworkAssembly.GetTestClasses()       at Microsoft.Silverlight.Testing.UnitTesting.Metadata.UnitTestProviders.GetAssemblyProvider(ITestHarness harness, Assembly testAssembly)       at Microsoft.Silverlight.Testing.UnitTesting.Metadata.UnitTestProviders.GetAssemblyWrapper(ITestHarness harness, Assembly testAssembly)       at Microsoft.Silverlight.Testing.UnitTesting.Harness.UnitTestHarness.EnqueueTestAssembly(Assembly assembly, TestRunFilter runFilter)       at AgUnit.Runner.Infrastructure.Execution.Vstt.AgUnitVsttTestHarness.Create(ITestLogger logger, IEnumerable`1 testAssemblies)       at AgUnit.Runner.TestFrontend.Run(IEnumerable`1 testAssemblies, ITestLogger[] testLoggers)       at AgUnit.Runner.Infrastructure.RemoteTestFrontend.Run(String remoteRunMessage)  InnerException: 

I'm using Resharper 5.1 and am using version ... Any guidance would be greatly appreciated.



Jul 14, 2011 at 6:42 PM

Hi Brian,

Can you make sure your test project has a reference to your "Dimebrain.Web.Silverlight.Serialization" project/assembly.
Also make sure "Copy Local" is set to TRUE, this way it's included in the .xap file.

Let me know if you still encounter issues.



Jul 14, 2011 at 6:46 PM

I can't find the Dimebrain.Web.Silverlight.Serialization assembly anywhere.  Is it supposed to come bundled with AgUnit, ReSharper, or something else?




Jul 14, 2011 at 6:50 PM

I have never heard of it, I guess it's something your project is referencing (maybe indirectly through a library ?).

Jul 14, 2011 at 7:01 PM

Googling on "Dimebrain" reveals "Dimebrain.Tweetsharp". Are you using that in your project ?

Jul 14, 2011 at 7:03 PM

The only external assembly i'm using is Moq.  The only thing I can think of is if something got registered in the GAC that's causing me issues.  I can probably take it from here, but thanks for looking.



Jul 14, 2011 at 7:07 PM

You can try opening up the .xap file or your test project with a zip tool (7-zip, winrar, ...) and see which files are included. That might give you a clue.
Reflector can also help you out with finding hidden references. 

Jul 15, 2011 at 3:24 AM

Yeah, it was referenced by SharpLibZip which we are using for something else.  It wasn't being used, but it looks like when the assembly was loaded, it tried loading all referenced assemblies anyway.  We just abstracted out that part so that it got injected at runtime.