dotnet / dotnet/vscode-csharp

Function Breakpoint ignores the Condition

Open
#4,257 0 comments 0 reactions 0 assignees View on GitHub
Debugger OmniSharp
Dominant language
TypeScript
Stars
3.1k
Forks
737
Avg merge
17h 56m
Merged PRs (30d)
21

Description

## Issue Description ##
Hello. I am adding a function breakpoint from an custom vscode extension that I am writing. I want this breakpoint to be hit only for specified thread name. So in the custom vscode extension, I create and add a new function breakpoint with specified condition. The code is as follows:

const bps: vscode.Breakpoint[] = []
let condition = "System.Threading.Thread.CurrentThread.Name==\"TestThreadName\""
let functionBreakpoint = new vscode.FunctionBreakpoint("Execute", true, condition)
bps.push(functionBreakpoint)
vscode.debug.addBreakpoints(bps)

The function breakpoint is added to the Breakpoint list:
![2020-12-02_16h41_49](https://user-images.githubusercontent.com/1541375/100894924-4c63bc00-34bd-11eb-8d6b-e3e710a0390e.png)

When I trigger the Execute method the breakpoint is being always hit regarding the current thread name.

Execute method hit when the thread name is TestThreadName. Correct.
![2020-12-02_16h45_16](https://user-images.githubusercontent.com/1541375/100895437-d875e380-34bd-11eb-850d-7e80a3da09bb.png)

Execute method should not be hit when the thread name is null. False.
![2020-12-02_16h46_53](https://user-images.githubusercontent.com/1541375/100895572-00654700-34be-11eb-9e08-e58d14c81bb5.png)

Are conditions to Function breakpoints supported?

## Expected Behavior ##
The function breakpoint should be hit when the condition is meet.

## Actual Behavior ##
Function breakpoint is being hit ignoring the condition statement.

## Environment information ##

**VSCode version**: 1.51.1
**C# Extension**: 1.23.6

Dotnet Information
.NET SDK (reflecting any global.json):
Version: 5.0.100
Commit: 5044b93829

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

Host (useful for support):
Version: 5.0.0
Commit: cf258a14b7

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

.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

|Extension|Author|Version|
|---|---|---|
|csharp|ms-dotnettools|1.23.6|
|vscode-icons|vscode-icons-team|11.0.0|
|vscodeintellicode|VisualStudioExptTeam|1.2.10|;

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.