-
Notifications
You must be signed in to change notification settings - Fork 263
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
Test Explorer fails to show tests. Tests output: "The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)" #241
Comments
@Jehoel: Sorry you are running into this. Few queries:
Edit by @smadala See following two comments. |
|
Thanks @Jehoel.
Looking at your issue again and the fact that this is working in VS2015, I suspect this could be because of a missing assembly(possibly in GAC in VS2015). Could you please turn on fusion logs and look for any assembly load failures? Here is how you could turn them on. You could zip the logs and share them over here as well. |
I now see more output in the Test window, it contains data I'd rather not publish publicly - can I message you on Skype-for-Business? Here's the tail end of the output that seems the most relevant - no obvious errors though:
(etc - including more
|
Thanks @Jehoel. As I suspected, these logs do not seem to be giving us much. Could you turn on fusion logging instead following the instructions above.
On
Sure, you can send a mail to vstestsup@microsoft.com with any other details you might have. |
@AbhitejJohn - what was the resolution for this? Half of my tests are getting ignored in both VS and TFS. |
I generated the fusion logs - I had a quick look but I couldn't see any errors. I do have another test project that works fine and its tests do appear in the Test Explorer window - so I compared the two projects. I noticed they're both .NET Framework 4.6.2 projects, however the working project has a reference to Indeed, the working project is using a standard Visual Studio Test project which came with its own VS-coupled references, while the non-working project is using the NuGet "MSTest V2" assemblies instead. So why is MSTest V2 not working all of a sudden? TL;DR Workaround:
|
I've emailed vstestsup@microsoft.com with my fusion logs. |
My email to vstestsup@microsoft.com was rejected by the Microsoft e-mail server with this message:
I see that |
That may work locally, but won't fly on our CI server. A real proper resolution would be real nice :( |
I found the reason for the failure on my end. Basically some of my projects are really old, and have slowly been migrated to newer .NET-versions and test-frameworks. Turns out that the <system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v2.0.50727">
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime> Removing these made test-explorer able to discover and run my tests. |
@Jehoel: Yes, Replied. |
Just want to report that I had the same problems in a newly created project. The solution was simple - I deleted the whole runtime section and cleared the output folders (bin, obj and TestResults), then it was working again. |
Just wanted to comment that I too am having the same issue with newly created projects. I'm on: Microsoft Visual Studio Professional 2017 Update: I just took that test project, added the .Net standard library through NuGet and it worked. Strange! |
Not without checking these first =D Some of these are older projects, but not 3.5 old. Something is also broken badly in VS. where running update-package -reinstall on a solution crashes VS halfway through. This leaves us with app.config files for projects displayed in solution explorer as loose files in a solution folder as well as within the projects. Its also forcibly adding assembly binding redirects that are not necessary (internally built dll, only one version ever released even internally). So I think its app.config related for me too, but want to see if fixing them has any effect. |
I tried downgrading both the test adapter and test framework packages to an older version (.13) and still got test skippage. The only app config content is an assembly binding for a non-test assembly (the one mentioned that shouldnt be needed). Only removing these two nuget packages entirely and setting the reference mentioned seems to have corrected this. However its only going to work right if everyone uses the same VS install path due to the HintPath it uses.
Removing the package also doesnt seem to have completely removed the csproj file contents. I removed the following error conditions and import manually to avoid future errors.
@AbhitejJohn - the links on the front page list ways to enable additional diagnostics. Which one should be used for the "Visual Studio Test" build task? |
The info for enabling diagnostics would be a nice to have at this point. I pulled all the MSTest2 packages and reverted the references, and got all our tests back. Let me know if you need additional info or examples to either reproduce this defect or make sure any proposed correction will work. |
@StingyJack: For the test task setting
Yes, a repro would help. The proposed correction takes one back to the old MSTest framework which is not Cross-Plat and does not support the new features MSTestV2 has. |
@Jehoel,@StingyJack can you share a repro please. |
I will try to pare down something for this, I can't publicly share the projects that had this problem. |
@pvlakshm I don't have it on my computer anymore, but @AbhitejJohn will have it in the email I sent him. |
I ran into this issue as well today. I was able to workaround / fix my specific issue by removing all unnecessary assembly bindings in app.config. After doing this, my tests were discovered. How did I determine my necessary bindings? I commented them all out and repeated these steps: (1) run my tests, and (2) reintroduced the binding hinted in the test failure. Luckily, I only had to repeat these steps for two bindings and not for all of my bindings (30+). /phew Hope this helps. |
I've got a similar issue I upgraded from 4.6.1 to 4.7.1 of the .net framework now my unit test project can't find and tests, I get the message "given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)" I've tried removing the bindings in the web.config, which did nothing and I've taking a look at some of the logs in fusion but there does not seem to be anything obvious there either. I also tried switching on "setx VS_UTE_Diagnostics 1" but nothing extra came through on the output. Any suggestions? |
Repro available at https://github.com/StingyJack/testfx241 |
@StingyJack I couldn't repro the issue. I have tried this on two machines(my dev machine and fresh lab machine with >= VS 15.5 preview 3). @Davewarner If you are using VS >= 15.3, You can enable logs by Tools -> Options -> Test -> Logging -> Logging level -> Diagnostic (VS_UTE_Diagnostics option removed in 15.3). And Please provide repro project to try out our side. |
This has been present for several versions of vs15. Can you please try a non-preview version? Preferably one that has had 15, 15.1., 15.2., etc. It does work in correctly in both vstest.console.exe and mstest.exe console on my dev box, but this was missing tests on the TFS server too. I'll check that later today. |
Still misses tests on the TFS build server. Running this project with the 15.5 preview 5 is more interesting, but also holds the same end result. It compiled the first time, and found only one test in UnitTestProject2. I changed the "keep test execution engine running" to unchecked and compiled and was greeted with errors in the errors list about VS not being able to find the adapter package. Trying to open the nuget package manager ui then pops the warning "No projects supported by nuget in this solution". I reenabled the "keep test exec..." option. Closing the solution and reopening it allows it to build again, and this time it discovers and executes all four expected tests. Closing all that and reopening the solution in Vs 15 Ent, Vs is immediately able to find the tests and can execute them. Would the toggling of that "Keep execution engine running" have created some necessary setting? |
The issue is with the auto redirection being added without the right assemblies being present. More details below. 1: Repro :(https://github.com/StingyJack/testfx241) This works fine. 2: Repro (https://github.com/smadala/samples/tree/master/Test%20Explorer%20fails%20to%20show%20tests/ClassLibrary.Tests) Able to repro with the both projects. -> Tests are being discovered fine through the source based discovery Detailed Repro Steps
The issue can be mitigated by either removing the redirects or by adding a reference to the 4.1.1.0 version of the System.Runtime.dll and ensuring that it is present in the test output path. |
Finally, some truth... @cltshivash - where have you been this whole time? =) Please make sure this fix works for tfs 2015.4 vnext test task. That was where it started silently failing for my team. |
@StingyJack The fix isn't at the task end so it should work. Nevertheless we will validate once we have a resolution. |
Update your MSTest.TestAdapter to 1.2.1 and MSTest.TestFramework to 1.2.1. These packages will be available in nuget.org very soon. Until then you can obtain them from feed https://dotnet.myget.org/F/mstestv2/api/v3/index.json After updating you can see message with exact missing assembly name. I'm closing this issue as there is no more action required from testfx side. |
@smadala - getting the assembly name is only identifying the assembly that is missing. The STR and E/A complain about tests not being discovered, not that we don't see the assembly name its complaining about.
If the assembly that is missing (I presume you know what that assembly is at this point) is a MSFT assembly, then there is still action required from the MSFT side. As someone who has too many years in the same kind of customer service role you are holding in within this thread, I offer you the advice of not prematurely closing this thread. When the package is available and the OP or participants in this thread deem it fixed satisfactorily, that would be the time to close it. @ManishJayaswal attests that there are no issue closure stats being tracked at MSFT for measuring individual performance, so leaving this open until that agreement happens should not pose much of a problem, if any. |
+1 Well put @StingyJack ⚡! |
Please check if migrating the nuget packages from package.config to package references helps. For more details please refer to the issue on the nuget repo. NuGet/Home#6723 |
@cltshivash - The nuget team owes a conversion/migration tool (its close to done I think) before we can realistically convert to package ref. If the problem with the silent failure to discover tests gets fixed I can at least not worry about that part of it. I'd rather have it break on build so we can workaround it sooner. |
@StingyJack Does the option available in 15.7.0 help with the migration ? |
@cltshivash - A tool is for sure better than the semi-manual steps. I'd still have to click on it for every single project (10 - 180 per solution) unless I can action it at the solution level. However, the first three of these, in addition to the "Not yet available for Asp.net full framework" are complete blockers for us. Thanks for the info share though. |
@mishra14 Do you have recommendation for the below ?
|
|
Yes, that worked on my repro 😊. Branch w/ conversion to Package Reference. |
@Haplois Is there any work we need to do for this issue? |
Closing this issue. Please feel free to comment if you are still facing some issue. |
Description
I cloned a private Git repo on my local machine. The solution comprises of several projects all targeting .NET 4.6.2. I built the solution which pulled-in some NuGet packages, including
MSTest.TestAdapter, 1.1.18
andMSTest.TestFramework, 1.1.18
. There is a test project in the solution with several[TestClass]
/[TestMethod]
tests. The solution builds successfully, however the Test Explorer window is empty. On a coworker's machine running VS2015 the Test Explorer is populated correctly.In the Output window's Test output I see the following:
Steps to reproduce
I have no specific reproduction steps - it happened spontaneously on my machine. Restarting VS, cleaning the project output and
TestResults
directory, and closing+reopening the Test Explorer window has no effect.Expected behavior
The tests in the project should appear in Test Explorer.
Actual behavior
No tests appear in Test Explorer, and an error message in the Output window.
Environment
vstest.console
installed:C:\Program Files (x86)\Microsoft Visual Studio 15.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe
-15.0.26228.0
- 142KBC:\Program Files (x86)\Microsoft Visual Studio 15.0\Common7\IDE\Extensions\TestPlatform\vstest.console.exe
-15.0.0.0
- 117KBThe text was updated successfully, but these errors were encountered: