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

Strange error while attempting to debug test #1960

Closed
firelizzard18 opened this issue Jan 12, 2018 · 16 comments
Closed

Strange error while attempting to debug test #1960

firelizzard18 opened this issue Jan 12, 2018 · 16 comments

Comments

@firelizzard18
Copy link

firelizzard18 commented Jan 12, 2018

dotnet --info output:

.NET Command Line Tools (2.1.2)

Product Information:
 Version:            2.1.2
 Commit SHA-1 hash:  5695315371

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.16299
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.2\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.3
  Build    : a9190d4a75f4a982ae4b4fa8d1a24526566c69df
  • VSCode Version: Code 1.19.2 (490ef761b76b3f3b3832eff7a588aac891e5fe80, 2018-01-10T15:55:03.538Z)
  • OS Version: Windows_NT x64 10.0.16299
  • C# Extension version: 1.13.1

I'm having trouble debugging a test in VSCode. I deleted bin and obj and tried debugging via code lens again (i.e. clicking on "debug test" above the method) and got the following message:

Failed to start debugger: "System.NullReferenceException: Object reference not set to an instance of an object.
 at OmniSharp.DotNetTest.TestManager.SendMessage[T](String messageType, T payload) in C:\\projects\\omnisharp-roslyn\\src\\OmniSharp.DotNetTest\\TestManager.cs:line 225
 at OmniSharp.DotNetTest.VSTestManager.<DiscoverTestsAsync>d10.MoveNext() in C:\\projects\\omnisharp-roslyn\\src\\OmniSharp.DotNetTest\\VSTestManager.cs:line 249
 --- End of stack trace from previous locat

My project:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net462</TargetFramework>

    <IsPackable>false</IsPackable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
    <PackageReference Include="xunit" Version="2.3.1" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
    <DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
  </ItemGroup>

  ...

</Project>
@rchande
Copy link

rchande commented Jan 22, 2018

@akshita31 You've been looking at unit testing. Can you take a look?

@akshita31
Copy link
Contributor

akshita31 commented Jan 22, 2018

@firelizzard18 This may be problem with the .debugger folder in your install directory. Could you try deleting the .debugger folder and the install.Lock file in your .vscode/extensions/ms-vscode.csharp-1.13.1 directory and then restarting vscode? (The path to the .vscode directory can be seen in the Omnisharp Log)

Or alternatively you could try uninstalling and then reinstalling the extension.

@gregg-miskelly
Copy link
Contributor

gregg-miskelly commented Jan 23, 2018

@akshita31 maybe I am missing something, but the crash is in OmniSharp (here). What do you think might be going wrong with the debugger?

@gregg-miskelly
Copy link
Contributor

@firelizzard18 can you debug other things? (ex: create a new console app (dotnet new console) and try to debug).

@firelizzard18
Copy link
Author

@akshita31 I will try to discover what I was working on when I found this error.

@gregg-miskelly I have been able to debug other things in the past. I seem to be getting all kinds of interesting issues when attempting to debug .NET Framework projects. I've reinstalled the extension already, so if the .debugger folder was the issue, I can't test that.

@firelizzard18
Copy link
Author

I've also been switching between Visual Studio and VSCode, as the former occasionally is able to debug my projects.

@Adam-Pond
Copy link

I found that updating to the 64bit version of VSCode solved the problem. Not sure this was the cause or in doing so, it cleared up some other files or something that was the cause.

@akshita31
Copy link
Contributor

@firelizzard18 Can you provide the project where this error occurs, to help debug.

@DustinCampbell DustinCampbell changed the title Strange error while attempting to debug Strange error while attempting to debug test May 24, 2018
@firelizzard18
Copy link
Author

@akshita31 The project I was working on is owned by my employer and not open source :(

@akshita31
Copy link
Contributor

@firelizzard18 Are you able to perform "Run Test" successfully ? Could you post the Omnisharp log here ?

@Adam-Pond
Copy link

I can confirm that a colleague who also had this problem solved it by uninstalling 32bit and installing 64bit version of VSCode.

@akshita31
Copy link
Contributor

Thanks @Adam-Pond. @firelizzard18 Did you try this solution ?

@DustinCampbell
Copy link
Member

Thanks for the insight @Adam-Pond.

@gregg-miskelly, would the bitness of VS Code affect the bitness of the debugger used? I'm curious since the debugger does not support Windows 32-bit.

@gregg-miskelly
Copy link
Contributor

No. We always use a 64-bit vsdbg.

@firelizzard18
Copy link
Author

@akshita31 I'm not sure I can reproduce this issue. My working environment has changed significantly since I created this issue, and OmniSharp-VSCode no longer works at all for me. Once #2171 is merged and #1694 resolved, I'll try again.

@JoeRobich
Copy link
Member

Closing as a lot has changed with testing and debugging since this issue was opened. Please reopen if this is still a problem and provide updated details.

@JoeRobich JoeRobich closed this as not planned Won't fix, can't repro, duplicate, stale Nov 9, 2024
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

8 participants