I am using VS2013 community edition, SQLite and created Test project using MSTestFramework where I am referring MoqRT framework for creating mock objects.
But while creating mock objects I am getting an Error as follows,
Unhandled baking exception: --> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.DllNotFoundException: Unable to load DLL 'sqlite3': This operation is only valid in the context of an application container. (Exception from HRESULT: 0x8007109A)
at SQLite.SQLite3.Open(String filename, IntPtr& db)
at SQLite.SQLiteConnection..ctor(String databasePath)
at MoqRT.Baking.BakingController.GetDatabase()
at MoqRT.Baking.BakingController..ctor(String testAssembly, String appxPath, String bakingPath)
at MoqRT.MoqRTRuntime.InitializeBaking(String testAssembly, String appxPath, String bakingPath)
--- End of inner exception stack trace ---
Server stack trace:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at MoqRT.Baking.BakingWorkItem.Run(BakingContext context) in d:\Kierron Matte\Projects\Mercury\R & D\Unit Testing\MoqRT-master\MoqRT.Baker\Controller\BakingWorkItem.cs:line 35
at MoqRT.Baking.BakingPoke.RunWorkItem(BakingController owner, WorkItem item) in d:\Kierron Matte\Projects\Mercury\R & D\Unit Testing\MoqRT-master\MoqRT.Baker\Controller\BakingPoke.cs:line 36
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at MoqRT.Baking.IBakingPoke.RunWorkItem(BakingController owner, WorkItem item)
at MoqRT.Baking.BakingRunner.ThreadEntryPoint() in d:\Kierron Matte\Projects\Mercury\R & D\Unit Testing\MoqRT-master\MoqRT.Baker\Controller\BakingRunner.cs:line 55
I had referred the project and steps from GitHub "/mbrit/moqrt" but not able to create MoqRT.Baked.dll.
I have referred the following files in my test project,
I have also added the image for your reference. Thanks in advance. Unhandled Exception while Creating MoqRT.Baked.dll
I have resolved this issue by removing additional SQLite (For Windows RunTime) reference from my Test Project which was not similar as used by MoqRT version (SQLite3.dll).
User contributions licensed under CC BY-SA 3.0