Skip to content

{} not matched in interpolated string, when newline directly after {. #9077

@PetSerAl

Description

@PetSerAl

Type: Bug

Issue Description

When in interpolated string there is new line directly after opening { (see Test2, on screenshot it marked red) it is not matched to closing } in that interpolated string. When space inserted between { and new line (see Test3), then it working properly. Compiling provided test code with dotnet build does not produce any errors.

Steps to Reproduce

namespace Lib;

static class Class
{
	static string Test1() => $"{""}";
	static string Test2() => $"{
		""}";
	static string Test3() => $"{ 
		""}";
	static string Test4() => $"{""
		}";
}

Expected Behavior

{ and } in interpolated string should match properly.

Actual Behavior

Image

Extension version: 2.120.3
VS Code version: Code 1.111.0 (ce099c1ed25d9eb3076c11e4a280f3eb52b4fbeb, 2026-03-06T23:06:10Z)
OS version: Windows_NT x64 10.0.26200
Modes:

Environment Information

VSCode version: 1.111.0
C# Extension: 2.120.3
Using OmniSharp: false

Dotnet Information
.NET SDK:
 Version:           10.0.201
 Commit:            4d3023de60
 Workload version:  10.0.200-manifests.0793c108
 MSBuild version:   18.3.0-release-26153-122+4d3023de6

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.26200
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\10.0.201\

.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.

Host:
  Version:      10.0.5
  Architecture: x64
  Commit:       a612c2a105

.NET SDKs installed:
  10.0.201 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 10.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 10.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 10.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found
Visual Studio Code Extensions
Extension Author Version Folder Name
csharp ms-dotnettools 2.120.3 ms-dotnettools.csharp-2.120.3-win32-x64
vscode-dotnet-runtime ms-dotnettools 3.0.0 ms-dotnettools.vscode-dotnet-runtime-3.0.0
C# Settings
Setting Value
preferCSharpExtension false
compilerDiagnosticScope openFiles
analyzerDiagnosticScope openFiles
enableXamlTools true
useServerGC true

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions