dotnet / dotnet/vscode-csharp

Using positional / shorthand record syntax for property definition prevents test code lens from appearing

Open
#5,654 0 comments 0 reactions 0 assignees View on GitHub
OmniSharp
Dominant language
TypeScript
Stars
3.1k
Forks
737
Avg merge
18h 40m
Merged PRs (30d)
31

Description

## Environment data
`dotnet --info` output:

```text
.NET SDK (reflecting any global.json):
Version: 6.0.407
Commit: d8659ea151

Runtime Environment:
OS Name: Mac OS X
OS Version: 12.6
OS Platform: Darwin
RID: osx.12-arm64
Base Path: /usr/local/share/dotnet/sdk/6.0.407/

Host:
Version: 7.0.4
Architecture: arm64
Commit: 0a396acafe

.NET SDKs installed:
6.0.407 [/usr/local/share/dotnet/sdk]
7.0.202 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.10 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.13 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.14 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.15 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.10 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.14 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.15 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
x64 [/usr/local/share/dotnet/x64]
registered at [/etc/dotnet/install_location_x64]

Environment variables:
Not set

global.json file:
~/some/path/global.json

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download
```

VS Code version: 1.77.3 (Universal)
C# Extension version: 1.25.4

## OmniSharp log

```text
[warn]: OmniSharp.Roslyn.CSharp.Services.Navigation.FindUsagesService
No symbol found. File: MyFile.cs, Line: 0, Column: 0.
Received response for /v2/getcodeactions but could not find request.
Received response for /v2/getcodeactions but could not find request.
```

## Steps to reproduce

1. Create a test class with a positional record syntax definition inside it.

```csharp

namespace MyProject.Tests;

using Xunit;

public class MyClassTest {
public record struct MyUtility(int Prop1, string Prop2);

[Fact]
// code lens is missing — comment out record definition above to make it reappear
public void MyTest() { }
}
```

## Expected behavior

Using positional record syntax shouldn't break the test code lens like "run test", "debug test", "run all tests", and "debug all tests"

## Actual behavior

Codelens don't load if positional record syntax is present in a test file.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.