-
Notifications
You must be signed in to change notification settings - Fork 326
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
Debugging XUnit test cases fails critically #558
Comments
From @dmenoud on February 27, 2017 15:27 I have the same problem.
|
By any chance is there a |
Hmm... I wanted to give you a |
Had the same problem, for me removing |
Would be nice if my problem could be solved as simple as that. But I have no |
Have you got any other test adapter installed? I had the same problem, for me disabling the NUnit adapter fixed it. |
I had the same error, no launchSettings.json file present and no other adapters. I'm not sure exactly what fixed the problem but I did a couple of things. I closed VS 2017, ran the test on the command line (dotnet test) then reopened my project in VS2017. During the launch I got a "Inconsistent Line Endings" prompt for my test .cs file. I confirmed to make all line endings CR LF. Now things work! |
In my case, this is probably related to: dotnet/sdk#1018 As stated in dotnet/sdk#1018 (comment) the following comment and discussion dotnet/msbuild#1603 (comment) gives a possible solution. |
I had the same problem. Using the solution outlined by bryanrcarlson solved the issue. |
I had the same problem. Using the solution outlined by @bryanrcarlson solved the issue. |
I had the same problem with xUnit and solved this problem changing project type from Library to Console Application: <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netcoreapp1.1|AnyCPU'">
<OutputType>exe</OutputType>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net461</TargetFrameworks>
<AssemblyName>MyProject.UnitTests</AssemblyName>
<ApplicationIcon />
<OutputTypeEx>exe</OutputTypeEx>
<StartupObject />
</PropertyGroup> My final csproj: https://gist.github.com/ircnelson/9cbddb681d520d7f581dbfc99709a9e1 |
I also had the same problem. Using VS 2017 with .Net Core 1.1.1, Microsoft.NET.Test.Sdk(15.0.0), xunit(2.2.0), xunit.runner.visualstudio(2.2.0). The solution by @bryanrcarlson solved the issue. Thanks! I did also copy the comment from @andrey-yemelyanov, Thanks! |
I am having the exact same problem. @bryanrcarlson's solution does not help. There is a launchsettings.json in the target assembly, but not in the unit test assembly. |
The solution by @ircnelson worked for me. |
I had the same problem. No launchsettings.json. Using the solution outlined by @bryanrcarlson solved the issue. |
Similar issue being hit for Nunit here |
I hit this error while debugging an MSTest test case in VS 2017 (version 15.3.5) The solution from @bryanrcarlson worked (albeit VS did not prompt about line endings on load, so I manually saved the file and selected CR LF line endings; see https://stackoverflow.com/questions/43323941/inconsistent-line-endings-visual-studio-community-2017) |
I cannot repro this on 15.4. I tried the project from here. Can anyone confirm please? |
Just had this problem with 15.4.1. Solved by deleting launchsettings.json that someone had added to a library project. |
I keep getting this every day, I end up having to clear everything down including temp directory then it lets me get back to work. I'm on VS 15.4.1 |
Thanks for the responses. |
This is being tracked external to this repo here: |
@AbhitejJohn |
I'm having this problem with VS 15.5.4 |
Had the same isssue with VS 2017 15.5.6 and .NET Core 2.0 using XUnit. Had no launchsettings.json, and the solution by @bryanrcarlson did not help. |
No dice on @bryanrcarlson and no launchsettings.json. Fixed by updating .netcore packages to latest (2.0.5). Debug tests now working. ??? |
I've run in to the same problem and none of the fixes listed here helped. I started a brand new asp.net core web app and hit the same roadblock of not being able to debug tests. The tests are embedded in the main project file and that appears to be causing the problem. If I create a regular unit test project in the same solution then debugging is fine. Here is a repo repo: https://github.com/svickers/Debug_no_worky |
Clean Solution worked for me as well. |
Add one more for deleting launchsettings.json fixed it. If someone is unsure where it is, it's under the Properties folder. |
Failing with VS 15.9.5, NUnit3TestAdapter 3.12, Microsoft.NET.Test.Sdk 15.9 when debugging tests targeting .NET Framework 4.52 . But it works when debugging the same test targeting .NET Core App 2.0/2.2. |
@CalArabshahi, @ognjenkurtic : If you haven't already, could you delete the .vs folder for your solution and try this out please(@ognjenkurtic you might want to update to the latest as well)? If that doesn't work, would you be able to file an issue in developercommunity and paste a link here please? This specific issue would get more traction there. |
From @couven92 on February 24, 2017 10:45
Ref.: microsoft/VSProjectSystem#195
Originally issued in wrong repository
Here's my CSPROJ:
Note the (as of writing this issue) the newest versions for the Test SDK and XUnit packages. I'm using the newest RC for Visual Studio 2017 (Version
15.0.0-RC4+26206.0
)Also note that I'm setting the
BaseOutputPath
andBaseIntermediateOutputPath
to values different from their defaults.Running test cases from the Test Explorer view in Visual Studio works fine. However, when I choose to debug one or more tests, Visual Studio goes over into debugging mode, and immediately displays a crtical error message window:
Copied from original issue: dotnet/project-system#1620
The text was updated successfully, but these errors were encountered: