Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binding Redirects necessary to run Unit Tests on .NET Framework are not preserved when running in testhost #428

Closed
analogrelay opened this issue Feb 1, 2017 · 13 comments

Comments

@analogrelay
Copy link
Member

Description

Binding Redirects necessary to run Unit Tests on .NET Framework are not preserved when running in testhost. When MSBuild compiles the test Console Exe project, it generates an app.config with a binding redirect for System.Net.Http. However, that binding redirect is not present when running inside testhost and thus the tests fail with a MissingMethodException because the binding was never redirected.

Steps to reproduce

  1. Clone https://github.com/anurse/testhost_bindingredirect_issue
  2. Open "SystemNetHttpIssue.sln" in VS 2017
  3. Build the Solution
  4. Ensure App is set as the start-up project and run it
  5. Confirm that no error occurs
  6. Run All Tests
  7. See error, described below
  8. Switch to command line and run dotnet test in the folder containing the Test project
  9. See error, described below

Expected behavior

Steps 5, 7 and 9 all complete successfully without errors

Actual behavior

During step 7 (running tests from VS), there is an exception while discovering tests (this particular issue may be xunit related and may not be related to the specific problem):

[xUnit.net 00:00:00.5384903] Exception discovering tests from Test: System.BadImageFormatException: Could not load file or assembly 'Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Xunit.Sdk.ReflectionAssemblyInfo..ctor(String assemblyFileName)$$RethrowMarker$$   at ExceptionExtensions.RethrowWithNoStackTraceLoss(Exception ex) in C:\BuildAgent\work\82a56c38c02ce641\src\common\ExceptionExtensions.cs:line 25
   at Xunit.AppDomainManager_AppDomain.CreateObject[TObject](AssemblyName assemblyName, String typeName, Object[] args) in C:\BuildAgent\work\82a56c38c02ce641\src\xunit.runner.utility\AppDomain\AppDomainManager_AppDomain.cs:line 82
   at Xunit.Xunit2Discoverer..ctor(AppDomainSupport appDomainSupport, ISourceInformationProvider sourceInformationProvider, IAssemblyInfo assemblyInfo, String assemblyFileName, String xunitExecutionAssemblyPath, String configFileName, Boolean shadowCopy, String shadowCopyFolder, IMessageSink diagnosticMessageSink, Boolean verifyAssembliesOnDisk) in C:\BuildAgent\work\82a56c38c02ce641\src\xunit.runner.utility\Frameworks\v2\Xunit2Discoverer.cs:line 98
   at Xunit.XunitFrontController.CreateInnerController() in C:\BuildAgent\work\82a56c38c02ce641\src\xunit.runner.utility\Frameworks\XunitFrontController.cs:line 111
   at Xunit.XunitFrontController.get_InnerController() in C:\BuildAgent\work\82a56c38c02ce641\src\xunit.runner.utility\Frameworks\XunitFrontController.cs:line 81
   at Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner.DiscoverTests[TVisitor](IRunSettings runSettings, IEnumerable`1 sources, LoggerHelper logger, Func`4 visitorFactory, Action`4 visitComplete) in C:\BuildAgent\work\b97dadc0a591f9a\xunit.runner.visualstudio.desktop\VsTestRunner.cs:line 200

During step 9, the test will fail:

Build started, please wait...
Build completed.

Test run for C:\Users\anurse\Code\anurse\testhost_bindingredirect_issue\Test\bin\Debug\net461\Test.dll(.NETFramework,Version=v4.6.1)
Microsoft (R) Test Execution Command Line Tool Version 15.0.0.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
Failed   UnitTest.Main
Error Message:

 System.MissingMethodException : Method not found: 'System.Net.Http.HttpClient Microsoft.AspNetCore.TestHost.TestServer.CreateClient()'.
Stack Trace:
   at UnitTest.Main()Test Run Failed.

Total tests: 1. Passed: 0. Failed: 1. Skipped: 0.
Test execution time: 3.5745 Seconds

Environment

OS: Windows 10 x64
VS: 2017 build 26126 d15prerel

dotnet --info:

.NET Command Line Tools (1.0.0-rc3-004530)

Product Information:
 Version:            1.0.0-rc3-004530
 Commit SHA-1 hash:  0de3338607

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.15019
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Users\anurse\AppData\Local\Microsoft\dotnet\sdk\1.0.0-rc3-004530

App.config file

Below is the app.config file generated when compiling the App project (which works):

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
      </dependentAssembly>
    </assemblyBinding>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Security.Cryptography.X509Certificates" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
      </dependentAssembly>
    </assemblyBinding>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.2.1.0" newVersion="1.2.1.0" />
      </dependentAssembly>
    </assemblyBinding>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

Test Host Verbose log (dotnet test --diag)

TpTrace Information: 0 : 290876, 1, 2017/02/01, 12:30:31.202, 1118375145124, testhost.exe, DefaultEngineInvoker: Using Application Configuration: '<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
  </startup>
  <runtime>
    <legacyUnhandledExceptionPolicy enabled="1" />
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="Extensions" />
      <!-- Test adapters compiled against version 11-14, need to be redirected to version 15. -->
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.VisualStudio.TestPlatform.ObjectModel" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="11.0.0.0-14.0.0.0" newVersion="15.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.VisualStudio.TestWindow.Interfaces" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="11.0.0.0-14.0.0.0" newVersion="15.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.VisualStudio.QualityTools.UnitTestFramework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="10.1.0.0" newVersion="10.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.VisualStudio.QualityTools.Resource" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="10.0.0.0-14.0.0.0" newVersion="15.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.VisualStudio.QualityTools.ControllerObject" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="10.0.0.0-14.0.0.0" newVersion="15.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.VisualStudio.QualityTools.ExecutionCommon" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="10.0.0.0-14.0.0.0" newVersion="15.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.VisualStudio.QualityTools.Common" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="10.0.0.0-14.0.0.0" newVersion="15.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="1.1.37.0" newVersion="1.2.0.0" />
      </dependentAssembly>
    </assemblyBinding>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <system.diagnostics>
    <switches>
      <add name="TpTraceLevel" value="0" />
    </switches>
  </system.diagnostics>
  <appSettings>
    <!--<add key="ExecutionThreadApartmentState" value ="MTA"/>-->
    <!--<add key="TraceLogMaxFileSizeInKb" value ="10240"/>-->
    <!-- MsTest Adapter Specific AppSettings -->
    <add key="TestProjectRetargetTo35Allowed" value="true" />
  </appSettings>
</configuration>'
TpTrace Information: 0 : 290876, 1, 2017/02/01, 12:30:31.232, 1118375224030, testhost.exe, DefaultEngineInvoker: Monitoring parent process with id: '291712'
TpTrace Information: 0 : 290876, 1, 2017/02/01, 12:30:31.280, 1118375367372, testhost.exe, DefaultEngineInvoker: Initialize communication on port number: '53499'
TpTrace Information: 0 : 290876, 1, 2017/02/01, 12:30:31.282, 1118375374776, testhost.exe, Trying to connect to server on port : 53499
TpTrace Information: 0 : 290876, 6, 2017/02/01, 12:30:31.290, 1118375397689, testhost.exe, Connected to the server successfully 
TpTrace Information: 0 : 290876, 1, 2017/02/01, 12:30:31.499, 1118376022123, testhost.exe, DefaultEngineInvoker: Start Request Processing.
TpTrace Information: 0 : 290876, 5, 2017/02/01, 12:30:31.585, 1118376282396, testhost.exe, Discovery Session Initialize.
TpTrace Verbose: 0 : 290876, 8, 2017/02/01, 12:30:31.617, 1118376375696, testhost.exe, TestPluginCache: Updating loadOnlyWellKnownExtensions from False to False.
TpTrace Verbose: 0 : 290876, 8, 2017/02/01, 12:30:31.617, 1118376378271, testhost.exe, TestPluginCache: Using directories for assembly resolution 'C:\Users\anurse\Code\anurse\testhost_bindingredirect_issue\Test\bin\Debug\net461'.
TpTrace Verbose: 0 : 290876, 8, 2017/02/01, 12:30:31.618, 1118376378524, testhost.exe, TestPluginCache: Updated the available extensions to 'C:\Users\anurse\Code\anurse\testhost_bindingredirect_issue\Test\bin\Debug\net461\xunit.runner.visualstudio.testadapter.dll'.
TpTrace Verbose: 0 : 290876, 8, 2017/02/01, 12:30:31.620, 1118376387420, testhost.exe, TestExecutorService: Loading the extensions
TpTrace Information: 0 : 290876, 5, 2017/02/01, 12:30:31.624, 1118376397935, testhost.exe, Execution started.
TpTrace Verbose: 0 : 290876, 8, 2017/02/01, 12:30:31.626, 1118376404765, testhost.exe, TestPluginCache: Discovering the extensions using extension path.
TpTrace Error: 0 : 290876, 8, 2017/02/01, 12:30:31.627, 1118376406921, testhost.exe, Default extensions folder does not exist
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.634, 1118376428515, testhost.exe, AssemblyResolver: xunit.runner.visualstudio.testadapter: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.647, 1118376466795, testhost.exe, AssemblyResolver: xunit.runner.visualstudio.testadapter: Resolved assembly. 
TpTrace Verbose: 0 : 290876, 8, 2017/02/01, 12:30:31.660, 1118376506913, testhost.exe, TestPluginCache: Discovered the extensions using extension path 'C:\Users\anurse\Code\anurse\testhost_bindingredirect_issue\Test\bin\Debug\net461\xunit.runner.visualstudio.testadapter.dll'.
TpTrace Verbose: 0 : 290876, 8, 2017/02/01, 12:30:31.662, 1118376512994, testhost.exe, TestPluginCache: Discoverers are 'Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner, xunit.runner.visualstudio.testadapter, Version=2.2.0.1225, Culture=neutral, PublicKeyToken=null'.
TpTrace Verbose: 0 : 290876, 8, 2017/02/01, 12:30:31.663, 1118376513416, testhost.exe, TestPluginCache: Executors are 'executor://xunit/VsTestRunner2'.
TpTrace Verbose: 0 : 290876, 8, 2017/02/01, 12:30:31.663, 1118376513678, testhost.exe, TestPluginCache: Setting providers are ''.
TpTrace Verbose: 0 : 290876, 8, 2017/02/01, 12:30:31.663, 1118376514073, testhost.exe, TestPluginCache: Loggers are ''.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.700, 1118376624546, testhost.exe, AssemblyResolver: xunit.runner.visualstudio.testadapter, Version=2.2.0.1225, Culture=neutral, PublicKeyToken=null: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.700, 1118376626485, testhost.exe, AssemblyResolver: xunit.runner.visualstudio.testadapter, Version=2.2.0.1225, Culture=neutral, PublicKeyToken=null: Resolved assembly. 
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.701, 1118376630006, testhost.exe, TestPluginManager.CreateTestExtension: Attempting to load test extension: Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner
TpTrace Verbose: 0 : 290876, 8, 2017/02/01, 12:30:31.702, 1118376630711, testhost.exe, TestDiscoveryManager: LoadExtensions: Created discoverer Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner
TpTrace Verbose: 0 : 290876, 8, 2017/02/01, 12:30:31.702, 1118376630956, testhost.exe, TestExecutorService: Loaded the discoverers
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.707, 1118376647989, testhost.exe, TestPluginManager.CreateTestExtension: Attempting to load test extension: Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner
TpTrace Verbose: 0 : 290876, 8, 2017/02/01, 12:30:31.708, 1118376648414, testhost.exe, TestExecutorExtensionManager: Loading executor Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner
TpTrace Verbose: 0 : 290876, 8, 2017/02/01, 12:30:31.708, 1118376648593, testhost.exe, TestExecutorService: Loaded the executors
TpTrace Verbose: 0 : 290876, 8, 2017/02/01, 12:30:31.711, 1118376658515, testhost.exe, TestExecutorService: Loaded the settings providers
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.711, 1118376658852, testhost.exe, TestExecutorService: Loaded the extensions
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.729, 1118376711635, testhost.exe, AssemblyResolver: Microsoft.VisualStudio.TestPlatform.Common.resources, Version=15.0.0.0, Culture=en-US, PublicKeyToken=b03f5f7f11d50a3a: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.729, 1118376712727, testhost.exe, AssemblyResolver: Microsoft.VisualStudio.TestPlatform.Common.resources, Version=15.0.0.0, Culture=en-US, PublicKeyToken=b03f5f7f11d50a3a: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.746, 1118376764161, testhost.exe, TestDiscoveryManager: Discovering tests from sources C:\Users\anurse\Code\anurse\testhost_bindingredirect_issue\Test\bin\Debug\net461\Test.dll
TpTrace Verbose: 0 : 290876, 8, 2017/02/01, 12:30:31.755, 1118376790356, testhost.exe, BaseRunTests.RunTestInternalWithExecutors: Running tests for executor://xunit/VsTestRunner2
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.792, 1118376900613, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Hosting.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.793, 1118376904109, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Hosting.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved assembly. 
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.795, 1118376908956, testhost.exe, AssemblyResolver: Microsoft.Extensions.Logging.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.798, 1118376920624, testhost.exe, AssemblyResolver: Microsoft.Extensions.Logging.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved assembly. 
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.799, 1118376922098, testhost.exe, AssemblyResolver: Microsoft.Extensions.Logging.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.799, 1118376922430, testhost.exe, AssemblyResolver: Microsoft.Extensions.Logging.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved from cache.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.801, 1118376927202, testhost.exe, AssemblyResolver: Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.805, 1118376938909, testhost.exe, AssemblyResolver: Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved assembly. 
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.805, 1118376940215, testhost.exe, AssemblyResolver: Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.805, 1118376940473, testhost.exe, AssemblyResolver: Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved from cache.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.807, 1118376945803, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Http.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.810, 1118376956536, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Http.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved assembly. 
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.811, 1118376957781, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Http.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.811, 1118376958042, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Http.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved from cache.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.812, 1118376962215, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Hosting.Server.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.815, 1118376970940, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Hosting.Server.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved assembly. 
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.820, 1118376984048, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Http.Features, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.821, 1118376987489, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Http.Features, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved assembly. 
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.822, 1118376991302, testhost.exe, AssemblyResolver: Microsoft.Extensions.FileProviders.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.825, 1118376999963, testhost.exe, AssemblyResolver: Microsoft.Extensions.FileProviders.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved assembly. 
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.825, 1118377001028, testhost.exe, AssemblyResolver: Microsoft.Extensions.FileProviders.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.825, 1118377001198, testhost.exe, AssemblyResolver: Microsoft.Extensions.FileProviders.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved from cache.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.826, 1118377002570, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Http.Features, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:31.826, 1118377002764, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Http.Features, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved from cache.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.719, 1118379678951, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Http.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.720, 1118379679366, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Http.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved from cache.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.720, 1118379680792, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Http.Features, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.720, 1118379681026, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Http.Features, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved from cache.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.722, 1118379687154, testhost.exe, AssemblyResolver: Microsoft.Extensions.Primitives, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.724, 1118379691778, testhost.exe, AssemblyResolver: Microsoft.Extensions.Primitives, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved assembly. 
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.731, 1118379715128, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.WebUtilities, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.735, 1118379727114, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.WebUtilities, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved assembly. 
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.748, 1118379763281, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Http.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.748, 1118379763650, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Http.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved from cache.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.748, 1118379764837, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Http.Features, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.748, 1118379765071, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Http.Features, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved from cache.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.749, 1118379767161, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Hosting.Server.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.749, 1118379767406, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Hosting.Server.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved from cache.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.750, 1118379769291, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Hosting, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.751, 1118379773463, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Hosting, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved assembly. 
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.764, 1118379812176, testhost.exe, AssemblyResolver: Microsoft.Extensions.Configuration.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.766, 1118379817341, testhost.exe, AssemblyResolver: Microsoft.Extensions.Configuration.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved assembly. 
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.768, 1118379824241, testhost.exe, AssemblyResolver: Microsoft.Extensions.Primitives, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.768, 1118379824633, testhost.exe, AssemblyResolver: Microsoft.Extensions.Primitives, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved from cache.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.768, 1118379825898, testhost.exe, AssemblyResolver: Microsoft.Extensions.Primitives, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.769, 1118379826158, testhost.exe, AssemblyResolver: Microsoft.Extensions.Primitives, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved from cache.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.774, 1118379842001, testhost.exe, AssemblyResolver: Microsoft.Extensions.Configuration, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.775, 1118379845625, testhost.exe, AssemblyResolver: Microsoft.Extensions.Configuration, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved assembly. 
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.775, 1118379846745, testhost.exe, AssemblyResolver: Microsoft.Extensions.Configuration.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.776, 1118379846948, testhost.exe, AssemblyResolver: Microsoft.Extensions.Configuration.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved from cache.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.780, 1118379860520, testhost.exe, AssemblyResolver: Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.780, 1118379860771, testhost.exe, AssemblyResolver: Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved from cache.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.788, 1118379883793, testhost.exe, AssemblyResolver: Microsoft.Extensions.Primitives, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.788, 1118379884075, testhost.exe, AssemblyResolver: Microsoft.Extensions.Primitives, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved from cache.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.788, 1118379885186, testhost.exe, AssemblyResolver: Microsoft.Extensions.FileProviders.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.788, 1118379885377, testhost.exe, AssemblyResolver: Microsoft.Extensions.FileProviders.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved from cache.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.792, 1118379896465, testhost.exe, AssemblyResolver: Microsoft.Extensions.FileSystemGlobbing, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.796, 1118379907663, testhost.exe, AssemblyResolver: Microsoft.Extensions.FileSystemGlobbing, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved assembly. 
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.806, 1118379939661, testhost.exe, AssemblyResolver: Microsoft.Extensions.Logging.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.807, 1118379940055, testhost.exe, AssemblyResolver: Microsoft.Extensions.Logging.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved from cache.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.897, 1118380209663, testhost.exe, AssemblyResolver: System.Collections.Immutable, Version=1.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.951, 1118380373026, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Hosting.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.951, 1118380373319, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Hosting.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved from cache.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.952, 1118380374250, testhost.exe, AssemblyResolver: Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.952, 1118380374429, testhost.exe, AssemblyResolver: Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved from cache.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.952, 1118380375249, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Http.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.952, 1118380375419, testhost.exe, AssemblyResolver: Microsoft.AspNetCore.Http.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Resolved from cache.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.961, 1118380402992, testhost.exe, AssemblyResolver: xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.962, 1118380405840, testhost.exe, AssemblyResolver: xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c: Resolved assembly. 
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.966, 1118380416977, testhost.exe, AssemblyResolver: xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.966, 1118380417167, testhost.exe, AssemblyResolver: xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c: Resolved from cache.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.966, 1118380418247, testhost.exe, AssemblyResolver: xunit.core, Version=2.2.0.3474, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.967, 1118380421011, testhost.exe, AssemblyResolver: xunit.core, Version=2.2.0.3474, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c: Resolved assembly. 
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.978, 1118380454457, testhost.exe, AssemblyResolver: xunit.runner.utility.desktop, Version=2.2.0.3474, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.979, 1118380457786, testhost.exe, AssemblyResolver: xunit.runner.utility.desktop, Version=2.2.0.3474, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c: Resolved assembly. 
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.980, 1118380458627, testhost.exe, AssemblyResolver: xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:32.980, 1118380458799, testhost.exe, AssemblyResolver: xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c: Resolved from cache.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:34.527, 1118385091623, testhost.exe, AssemblyResolver: xunit.execution.desktop, Version=2.2.0.3474, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:34.528, 1118385095299, testhost.exe, AssemblyResolver: xunit.execution.desktop, Version=2.2.0.3474, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c: Resolved assembly. 
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:34.528, 1118385095708, testhost.exe, AssemblyResolver: xunit.execution.desktop, Version=2.2.0.3474, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c: Resolving assembly.
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:34.528, 1118385095879, testhost.exe, AssemblyResolver: xunit.execution.desktop, Version=2.2.0.3474, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c: Resolved from cache.
TpTrace Information: 0 : 290876, 13, 2017/02/01, 12:30:34.674, 1118385530890, testhost.exe, Sending test run statistics
TpTrace Verbose: 0 : 290876, 13, 2017/02/01, 12:30:34.720, 1118385669089, testhost.exe, TestRunCache: OnNewTestResult: Notified the onCacheHit callback.
TpTrace Warning: 0 : 290876, 13, 2017/02/01, 12:30:34.944, 1118386341043, testhost.exe, InProgressTests is null
TpTrace Information: 0 : 290876, 13, 2017/02/01, 12:30:34.948, 1118386353781, testhost.exe, AssemblyResolver: Microsoft.VisualStudio.TestPlatform.ObjectModel.resources, Version=15.0.0.0, Culture=en-US, PublicKeyToken=b03f5f7f11d50a3a: Resolving assembly.
TpTrace Information: 0 : 290876, 13, 2017/02/01, 12:30:34.949, 1118386354940, testhost.exe, AssemblyResolver: Microsoft.VisualStudio.TestPlatform.ObjectModel.resources, Version=15.0.0.0, Culture=en-US, PublicKeyToken=b03f5f7f11d50a3a: Resolving assembly.
TpTrace Warning: 0 : 290876, 13, 2017/02/01, 12:30:34.950, 1118386358046, testhost.exe, TestRunCache: No test found corresponding to testResult 'UnitTest.Main  Failed
  Message: System.MissingMethodException : Method not found: 'System.Net.Http.HttpClient Microsoft.AspNetCore.TestHost.TestServer.CreateClient()'.
  StackTrace:
   at UnitTest.Main()' in inProgress list.
TpTrace Warning: 0 : 290876, 13, 2017/02/01, 12:30:34.953, 1118386366939, testhost.exe, InProgressTests is null
TpTrace Verbose: 0 : 290876, 8, 2017/02/01, 12:30:34.998, 1118386501553, testhost.exe, TestExecutionManager.RunTestInternalWithExecutors: Completed running tests for executor://xunit/VsTestRunner2
TpTrace Information: 0 : 290876, 8, 2017/02/01, 12:30:35.001, 1118386512771, testhost.exe, Sending test run complete
TpTrace Verbose: 0 : 290876, 8, 2017/02/01, 12:30:35.021, 1118386572858, testhost.exe, BaseRunTests.RunTests: Run is complete.
TpTrace Information: 0 : 290876, 5, 2017/02/01, 12:30:35.056, 1118386677514, testhost.exe, Session End message received from server. Closing the connection.
TpTrace Information: 0 : 290876, 5, 2017/02/01, 12:30:35.057, 1118386679620, testhost.exe, Closing the connection !

Related issue: aspnet/Hosting#926

/cc @Tratcher @muratg

@natemcmaster
Copy link
Contributor

@anurse and I played around with this more. We think this may be solved by forcing MSBuild to generate binding redirects. This does not normally happen for .NET Framework and OutputType=Library projects.

<PropertyGroup>
  <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
  <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>

See: https://github.com/Microsoft/msbuild/blob/dd5e8bc3f86ac98bd77d8971b00a6ad14f122f1a/src/XMakeTasks/Microsoft.Common.CurrentVersion.targets#L2027

@muratg
Copy link

muratg commented Feb 1, 2017

@Eilon could you add this to your tracking list for VS2017 RTM?

@analogrelay
Copy link
Member Author

So I guess we'd need to add those MSBuild properties to test projects somehow, preferably through the Test SDK MSBuild package.

@sbaid
Copy link
Contributor

sbaid commented Feb 14, 2017

@Eilon @muratg since you are unblocked - we plan to take this in 15.1.

@analogrelay
Copy link
Member Author

This is going to block many people running tests in .NET Framework. As soon as you start adding NuGet packages, you begin to need binding redirects and if this isn't fixed, those redirects will fail and you'll get Assembly Load errors and Missing Method exceptions with no idea how to resolve them. I think this is a pretty important fix.

dougbu added a commit to dougbu/XunitTestImmutable that referenced this issue Mar 5, 2017
dougbu added a commit to aspnet/Mvc that referenced this issue Mar 5, 2017
- use specific workaround for microsoft/vstest#428
  - generating an executable for a test project is a bit too weird
- also work around dotnet/sdk#926
  - generating an executable covered this as well

nit: add and update comments about other workarounds in the functional tests project
dougbu added a commit to aspnet/Mvc that referenced this issue Mar 6, 2017
- use specific workaround for microsoft/vstest#428
  - generating an executable for a test project is a bit too weird
- also work around dotnet/sdk#926
  - generating an executable covered this as well

nit: add and update comments about other workarounds in the functional tests project
hikalkan added a commit to aspnetboilerplate/aspnetboilerplate that referenced this issue Mar 8, 2017
hikalkan added a commit to aspnetboilerplate/aspnetboilerplate that referenced this issue Mar 8, 2017
@analogrelay
Copy link
Member Author

We're seeing customers hitting this now (aspnet/Hosting#959)

@codito
Copy link
Contributor

codito commented Mar 15, 2017

+1, there are several reports on this issue. We should fix this in the next preview nuget package. /cc @sbaid @pvlakshm @smadala

ShiningRush added a commit to ShiningRush/aspnetboilerplate that referenced this issue Mar 17, 2017
* Nolocking extensions implemented for aspnetboilerplate#1637

* Add EfCoreTransactionStrategy

* Implement EfCoreTransactionStrategy

* Abp.Dapper package implemented for aspnetboilerplate#1661

* Dapper packoptions added on project.json

* Abp.Dapper tests added

* refactor for aspnetboilerplate#1661

* resolved aspnetboilerplate#1907

* Resolved aspnetboilerplate#1847: Trigger AbpHandledExceptionData for hangfire jobs too.

* Fixed aspnetboilerplate#1875: Tenant Resolve Contributer renamed to Contributor (typo fix)

* Resolved aspnetboilerplate#1886: Make TestAbpSession methods and properties virtual to allow overriding.

* Use existing connection in the demo if available for EF Core.

* aspnetboilerplate#1909: Refactor EF Core transaction strategy. Pass conn string to options builder.

* aspnetboilerplate#1909 refactored DbContextEfCoreTransactionStrategy

* aspnetboilerplate#1854 Correct version in project.json for dapper package.

* Add Abp.Dapper to pack.ps1.

* Resolved aspnetboilerplate#1827: Depend on JetBrains.Annotations instead of including annotations in Abp package.

* Resolved aspnetboilerplate#1864: Set Http Status to 400 for validation exceptions.

* Add WithNoLockInterceptor in AbpEntityFrameworkModule aspnetboilerplate#1823.

* Resolved aspnetboilerplate#1892: Load plugin dependencies from plugin folder.

* Incremented version to 1.5.0.0.

* Resolved aspnetboilerplate#1915: Upgrade to AspNet Core v1.1.1.

* Open solution on VS 2017, make it building (but not passing all unit tests yet).

* Upgraded xunt and other nuget packages.

* Create nuget packages after build.

* Create Abp-fa.xml

* Added bindings based on microsoft/vstest#428 to be able to run unit tests for aspnet core.

* Passed all unit tests by applying microsoft/vstest#428

* Remove solution folder.

* Change pack.ps1 for msbuild

* Revised nuget packaging.

* Fix appveyor.xml.

* Move common project properties to a single file. Revise pack.ps1.

* Change sln format.

* update appveyor file

* added RuntimeIdentifier.

* Fix test dll paths in appveyor.xml

* Temporarily remove NH tests for appveyor.

* Check matched count on DomainTenantResolveContributor

* Fixed aspnetboilerplate#1928: Fix Dapper namespaces.

* Fix default namespaces for projects.

* Resolved aspnetboilerplate#1934: Upgrade nuget package dependencies.

* Fixed aspnetboilerplate#1923: Web API [DontWrapResult] Not Working with [AbpApiAuthorize]

* Fixed aspnetboilerplate#1918: Can not handle model binding validation errors for dynamic web API actions.

* aspnetboilerplate#1936 Remove Abp dependency from Abp.Web.Resources package.

* Fixed aspnetboilerplate#1936: Abp.Web.Resources contents become flat with 1.5.1 release.
@codito codito added this to the Preview 115.3 - 20170324 milestone Mar 21, 2017
@Compufreak345
Copy link

I just want to add myself as a customer being hit by this - it took me almost 2 days to figure it out, and making another developer scratch his head as I thought it was caused by his library.
NickStrupat/EntityFramework.Triggers#13

For now I added the 2 lines to my .csproj and it works fine - but I really would appreciate a quick fix.

Thanks & best regards,
Christoph

Faizan2304 added a commit to Faizan2304/vstest that referenced this issue Mar 21, 2017
1) microsoft#613
2) microsoft#428
3) microsoft#391
4) microsoft#595

Fix:
Generate config file for test project targeting .NET Framework. This config file has have binding redirect which is needed at time of running tests.
Faizan2304 added a commit that referenced this issue Mar 22, 2017
* Issue:
1) #428
2) #595

Fix:
Generate config file for test project targeting .NET Framework. This config file has binding redirect which is needed at time of running tests.
ebekker added a commit to zyborg/Zyborg-tug that referenced this issue Jun 30, 2017
* `dotnet migrate` all the projects, moving from project.json to .csproj
* Created a solution file (dotnet new sln and dotnet sln add ...)
capturing all of the projects to replace the equivalent global.json
* Adjusted *some* of the test run batch files to account for new CLI
format for invoking unit tests
* Had to make some adjustments to TestServer integration tests to
handling binding redirects properly as described by
aspnet/Hosting#959 and
microsoft/vstest#428
@escamoteur
Copy link

Why did this get closed?

@bricelam
Copy link

This is fixed in version 15.3.0 of the Microsoft.NET.Test.Sdk package.

@russmeine
Copy link

I could be off here, but it looks like i'm running into this issue. I'm using the full .net framework 4.6.1 and MS Test:

System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.'

Let me know if this belongs somewhere else.

@sergeibobyr
Copy link

sergeibobyr commented Dec 4, 2021

Using latest VS 2019 and Nunit, I still had to add the GenerateBindingRedirectsOutputType to my Tests csproj file to make VS generate Tests.dll.config file to allow the tests to run correctly in Nunit runner from within VS and standalone. Is there a better solution for auto-generating binding redirects for DLLs that need to run as part of Unit testing?

@weberms
Copy link

weberms commented Sep 16, 2022

Like sergeibobyr I still have to add GenerateBindingRedirectsOutputType to my Tests csproj file manually using VS 2019 and MSTest to get the binding redirects added to the app.config file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests