Cannot create HttpServer from a test run by ReSharperhttp://forums.asp.net/t/1776337.aspx/1?Cannot+create+HttpServer+from+a+test+run+by+ReSharperSat, 03 Mar 2012 16:26:28 -050017763374862153http://forums.asp.net/p/1776337/4862153.aspx/1?Cannot+create+HttpServer+from+a+test+run+by+ReSharperCannot create HttpServer from a test run by ReSharper <p>Hello,</p> <p>when I try to run mspec test via ReSharper which executes this code:</p> <pre class="prettyprint">new HttpServer();</pre> <p>I get the exception below. If I copy ReSharper dlls to the test folder (bin\Release) - everything works as expected. What would be the reason of the exception?&nbsp;</p> <p>Thanks!</p> <p>System.IO.FileNotFoundException: Could not load file or assembly 'JetBrains.ReSharper.Psi, Version=6.0.2202.688, Culture=neutral, PublicKeyToken=1010a0d8d6380325' or one of its dependencies. The system cannot find the file specified.</p> <p></p> &lt;div class=&quot;stacktrace&quot;&gt;at <span><span color="#00008b" style="color:#00008b"><span color="#00008b" style="color:#00008b"><span color="#00008b" style="color:#00008b">System</span>.Reflection</span>.RuntimeAssembly</span></span><span color="#008b8b" style="color:#008b8b">.GetExportedTypes</span>(<span color="#00008b" style="color:#00008b">RuntimeAssembly</span> <span color="#000000" style="color:#000000">assembly</span>, <span color="#00008b" style="color:#00008b"> ObjectHandleOnStack</span> <span color="#000000" style="color:#000000">retTypes</span>)<br> at <span class="normalLinkEmuLink"><span color="#00008b" style="color:#00008b">System.Reflection.RuntimeAssembly</span></span>.<span><span color="#008b8b" style="color:#008b8b">GetExportedTypes</span></span>()<br> at <span class="normalLinkEmuLink"><span color="#00008b" style="color:#00008b">System.Web.Http.Dispatcher.HttpControllerTypeCacheUtil</span></span>.<span class="normalLinkEmuLink"><span color="#008b8b" style="color:#008b8b">FilterTypesInAssemblies</span></span>(<span color="#00008b" style="color:#00008b"><span class="normalLinkEmuLink"><span color="#00008b" style="color:#00008b">IBuildManager</span></span></span> <span color="#000000" style="color:#000000">buildManager</span>, <span color="#00008b" style="color:#00008b"> <span><span color="#00008b" style="color:#00008b">Predicate`1</span></span></span> <span color="#000000" style="color:#000000">predicate</span>)<br> at <span class="normalLinkEmuLink"><span color="#00008b" style="color:#00008b">System.Web.Http.Dispatcher.HttpControllerTypeCacheUtil</span></span>.<span class="normalLinkEmuLink"><span color="#008b8b" style="color:#008b8b">GetFilteredTypesFromAssemblies</span></span>(<span color="#00008b" style="color:#00008b"><span><span color="#00008b" style="color:#00008b">String</span></span></span> <span color="#000000" style="color:#000000">cacheName</span>, <span color="#00008b" style="color:#00008b"> <span><span color="#00008b" style="color:#00008b">Predicate`1</span></span></span> <span color="#000000" style="color:#000000">predicate</span>, <span color="#00008b" style="color:#00008b"> <span><span color="#00008b" style="color:#00008b">IBuildManager</span></span></span> <span color="#000000" style="color:#000000">buildManager</span>)<br> at <span class="normalLinkEmuLink"><span color="#00008b" style="color:#00008b">System.Web.Http.Dispatcher.HttpControllerTypeCache</span></span>.<span class="normalLinkEmuLink"><span color="#008b8b" style="color:#008b8b">InitializeCache</span></span>()<br> at <span class="normalLinkEmuLink"><span color="#00008b" style="color:#00008b">System.Web.Http.Dispatcher.HttpControllerTypeCache</span></span>.<span><span color="#008b8b" style="color:#008b8b">.ctor</span></span>(<span color="#00008b" style="color:#00008b"><span class="normalLinkEmuLink"><span color="#00008b" style="color:#00008b">HttpConfiguration</span></span></span> <span color="#000000" style="color:#000000">configuration</span>)<br> at <span class="normalLinkEmuLink"><span color="#00008b" style="color:#00008b">System.Web.Http.Dispatcher.DefaultHttpControllerFactory</span></span>.<span><span color="#008b8b" style="color:#008b8b">.ctor</span></span>(<span color="#00008b" style="color:#00008b"><span class="normalLinkEmuLink"><span color="#00008b" style="color:#00008b">HttpConfiguration</span></span></span> <span color="#000000" style="color:#000000">configuration</span>)<br> at <span class="normalLinkEmuLink"><span color="#00008b" style="color:#00008b">System.Web.Http.Services.DefaultServiceResolver</span></span>.<span><span color="#008b8b" style="color:#008b8b">&lt;.ctor&gt;b__0</span></span>(<span color="#00008b" style="color:#00008b"><span class="normalLinkEmuLink"><span color="#00008b" style="color:#00008b">HttpConfiguration</span></span></span> <span color="#000000" style="color:#000000">config</span>)<br> at <span class="normalLinkEmuLink"><span color="#00008b" style="color:#00008b">System.Web.Http.Services.DefaultServiceResolver</span></span>.<span><span color="#008b8b" style="color:#008b8b">GetService</span></span>(<span color="#00008b" style="color:#00008b"><span><span color="#00008b" style="color:#00008b">Type</span></span></span> <span color="#000000" style="color:#000000">t</span>)<br> at <span class="normalLinkEmuLink"><span color="#00008b" style="color:#00008b">System.Web.Http.Services.DependencyResolver</span></span>.<span><span color="#008b8b" style="color:#008b8b">GetService</span></span>(<span color="#00008b" style="color:#00008b"><span><span color="#00008b" style="color:#00008b">Type</span></span></span> <span color="#000000" style="color:#000000">serviceType</span>)<br> at <span class="normalLinkEmuLink"><span color="#00008b" style="color:#00008b">System.Web.Http.DependencyResolverExtensions</span></span>.<span><span color="#008b8b" style="color:#008b8b">GetService</span></span>(<span color="#00008b" style="color:#00008b"><span class="normalLinkEmuLink"><span color="#00008b" style="color:#00008b">DependencyResolver</span></span></span> <span color="#000000" style="color:#000000">resolver</span>)<br> at <span class="normalLinkEmuLink"><span color="#00008b" style="color:#00008b">System.Web.Http.DependencyResolverExtensions</span></span>.<span class="normalLinkEmuLink"><span color="#008b8b" style="color:#008b8b">GetServiceOrThrow</span></span>(<span color="#00008b" style="color:#00008b"><span class="normalLinkEmuLink"><span color="#00008b" style="color:#00008b">DependencyResolver</span></span></span> <span color="#000000" style="color:#000000">resolver</span>)<br> at <span><span color="#00008b" style="color:#00008b">System.Web.Http.DependencyResolverExtensions</span></span>.<span class="normalLinkEmuLink"><span color="#008b8b" style="color:#008b8b">GetHttpControllerFactory</span></span>(<span color="#00008b" style="color:#00008b"><span class="normalLinkEmuLink"><span color="#00008b" style="color:#00008b">DependencyResolver</span></span></span> <span color="#000000" style="color:#000000">resolver</span>)<br> at <span class="normalLinkEmuLink"><span color="#00008b" style="color:#00008b">System.Web.Http.Dispatcher.HttpControllerDispatcher</span></span>.<span class="normalLinkEmuLink"><span color="#008b8b" style="color:#008b8b">.ctor</span></span>(<span color="#00008b" style="color:#00008b"><span class="normalLinkEmuLink"><span color="#00008b" style="color:#00008b">HttpConfiguration</span></span></span> <span color="#000000" style="color:#000000">configuration</span>)<br> at <span class="normalLinkEmuLink"><span color="#00008b" style="color:#00008b">System.Web.Http.HttpServer</span></span>.<span><span color="#008b8b" style="color:#008b8b">.ctor</span></span>(<span color="#00008b" style="color:#00008b"><span class="normalLinkEmuLink"><span color="#00008b" style="color:#00008b">HttpConfiguration</span></span></span> <span color="#000000" style="color:#000000">configuration</span>)<br> at <span><span color="#00008b" style="color:#00008b">System.Web.Http.HttpServer</span></span>.<span><span color="#008b8b" style="color:#008b8b">.ctor</span></span>()<br> at&nbsp;<span class="normalLinkEmuLink"><span color="#00008b" style="color:#00008b">Tests.Reporting.EndToEnd.get_today_daily_activity</span></span>.<span class="normalLinkEmuLink"><span color="#008b8b" style="color:#008b8b">&lt;.ctor&gt;b__0</span></span>() in <a href="">get_today_daily_activity.cs: line 21</a>&lt;/div&gt; &lt;div class=&quot;stacktrace&quot;&gt;&lt;/div&gt; 2012-03-03T14:25:43-05:004862182http://forums.asp.net/p/1776337/4862182.aspx/1?Re+Cannot+create+HttpServer+from+a+test+run+by+ReSharperRe: Cannot create HttpServer from a test run by ReSharper <p>This seems like something related to ReSharper, not Web API. You should try contacting JetBrains on their support forums.</p> 2012-03-03T15:36:07-05:004862194http://forums.asp.net/p/1776337/4862194.aspx/1?Re+Cannot+create+HttpServer+from+a+test+run+by+ReSharperRe: Cannot create HttpServer from a test run by ReSharper <p>Why do you think it's ReSharper's issue? After all it's Web API that tries to do something on ReSharper's dlls. Just trying to understand.</p> 2012-03-03T16:06:36-05:004862213http://forums.asp.net/p/1776337/4862213.aspx/1?Re+Cannot+create+HttpServer+from+a+test+run+by+ReSharperRe: Cannot create HttpServer from a test run by ReSharper <p>Not sure how ReSharper's test runner works but it looks like it's copying some binaries into your application's bin folder. Web API searches all bin assemblies for ApiController classes, and it looks like whatever got copied by ReSharper is unable to load some other DLL. You should look at your test project and verify the purpose of the JetBrains.ReSharper.Psi assembly.</p> 2012-03-03T16:26:28-05:00