Omnisharp-vscode: Test debugging does not work on .NET Core 2.0 and xUnit 2.3.0

Created on 23 Aug 2017  路  16Comments  路  Source: OmniSharp/omnisharp-vscode

Environment data

dotnet --info output:

袩褉芯谐褉邪屑屑褘 泻芯屑邪薪写薪芯泄 褋褌褉芯泻懈 .NET (2.0.0)

Product Information:
 Version:            2.0.0
 Commit SHA-1 hash:  cdcd1928c9

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.13
 OS Platform: Darwin
 RID:         osx.10.12-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.0.0/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0
  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

VS Code version: 1.15.1
C# Extension version: 1.12.1
xUnit version: 2.3.0-beta4

Steps to reproduce

Create project with any xUnit test and click codelens "debug test" button.

Expected behavior

Test should be runned in debug mode.

Actual behavior

Exception message occurs:
An exception occurred while test discoverer 'VsTestRunner' was loading tests. Exception: Object reference not set to an instance of an object.

May be this is connected with this PR https://github.com/OmniSharp/omnisharp-roslyn/issues/944? If so then may you update extension to include this fix?

Bug Resolved-Fixed Test

All 16 comments

Yes, you're right that this was fixed recently in OmniSharp but that change has not made it into C# for VS Code yet. I'll keep this issue here until that happens and we have a new beta of C# for VS Code you can use.

I've just taken a new version of OmniSharp that fixes this and created a new beta release: https://github.com/OmniSharp/omnisharp-vscode/releases/tag/v1.13.0-beta1. You can following the instructions here to install the beta release.

@DustinCampbell thank you!

@DustinCampbell I've installed OmniSharp 1.13.0-beta1, but exception still appears on xUnit test debug:
An exception occurred while test discoverer 'VsTestRunner' was loading tests. Exception: Object reference not set to an instance of an object.

I'm using xUnit 2.3.0-beta5-build3769.

Oop! I forgot to merge in the C# for VS Code side of this fix before creating the new beta. Will fix shortly.

New day, new release. Please try C# for VS Code 1.13.0-beta2: https://github.com/OmniSharp/omnisharp-vscode/releases/tag/1.13.0-beta2.

I still got the same error message after installed the vsix manually (1.13.0-beta2):

An exception occurred while test discoverer 'VsTestRunner' was loading tests. Exception: Object reference not set to an instance of an object.
Debugging complete.

Might be related with the "Reload" icon. I did reload multiple times. Not sure why it is still there.

screen shot 2017-10-13 at 4 26 13 pm

After uninstall 1.13.0-beta2 and reinstall manually, the "reload" icon is finally gone. The debug is working now.

Glad to hear it's working for you now.

Just discovered this - I'm managing to debug in VS Code now :champagne: Do you happen to know when this might be released?

We're aiming for a release by the end of the month.

Sweet - thanks!

Great thread ! After 2 hours of googling I finally found it ! Thanks @DustinCampbell for the fix

I'm having the same problem in vs-code on Ubuntu. Has this also been resolved? Thank you. See @asilferreira.

Option "debug test"
image

Error:
An exception occurred while test discoverer 'VsTestRunner' was loading tests. Exception: Object reference not set to an instance of an object.

Info:

xunit version 2.3.1

.NET Command Line Tools (2.0.0)

Product Information:
Version: 2.0.0
Commit SHA-1 hash: cdcd1928c9

Runtime Environment:
OS Name: ubuntu
OS Version: 16.04
OS Platform: Linux
RID: ubuntu.16.04-x64
Base Path: /usr/share/dotnet/sdk/2.0.0/

Microsoft .NET Core Shared Framework Host

Version : 2.0.0
Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

@americofreitasjr: Have you tried the latest C# for VS Code 1.13-beta5 release? You can follow the instructions here to install a beta release.

Was this page helpful?
0 / 5 - 0 ratings