Debugger Doesn't Pause on Exceptions in `.razor` when justMyCode is false
- Dominant language
- TypeScript
- Stars
- 3.1k
- Forks
- 737
- Avg merge
- 17h 56m
- Merged PRs (30d)
- 21
Description
## Issue Description ##
Debugger doesn't pause on exceptions in `.razor` files when _justMyCode_ setting is set to **false**.
## Steps to Reproduce ##
Just download the demo project [DemoTheProblem.zip](https://github.com/OmniSharp/omnisharp-vscode/files/4882021/DemoTheProblem.zip)
Or follow the steps below:
### Preparation ###
1. Create a Demo Project **dotnet new blazorserver -o BlazorServer --auth Individual**
2. Add **Entity.cs** class under _BlazorServer/Data_
```
using System.Collections.Generic;
namespace BlazorServer.Data
{
public class Entity
{
public Dictionary Fields { get; set; }
}
public class Field
{
public object Value { get; set; }
}
}
```
3. Open **BlazorServer/Pages/Counter.razor** and make following modifications
Add the following variables to @code block
```
public string entityName = "contact";
public string selectedId = "asdasd";
public string searchFieldName = "asdasd";
private Entity selectedEntity;
```
Add the following razor code to the page
```
@if (selectedId != null && !string.IsNullOrEmpty(selectedId) && !string.IsNullOrEmpty(entityName))
{
}
```
This code should throw an exception, because _selectedEntity_ is never set.
4. Finally, generate a debug config (launch.json) by pressing F5 and selecting .NET Core Clr
5. Add the following line into _configurations_ section: **"justMyCode": true,**
### Reproduction ###
1. Run the application, switch to Counter page in the Left Sidebar menu and observe VSCode pausing on exception

2. Go to launch.json and change "justMyCode": **true**, to "justMyCode": **false**,
3. Repeat 1, and observe that instead of pausing on exception, VSCode will just log it into the Debug Console.

In the breakpoints section, _All Exceptions_ is unticked, and _User-Unhandled Exceptions_ is ticked.
## Expected Behavior ##
I think VSCode should break on any unhandled exception, just like Visual Studio. It is strange that this behaviour is bound to justMyCode setting. Maybe I am doing something wrong?
This problem somehow reminds me about #3369
## Logs ##
### OmniSharp log ###
Starting OmniSharp server at 07/07/2020, 04:21:47
Target: /home/jrm/GIT/DemoTheProblem
OmniSharp server started.
Path: /home/jrm/.vscode/extensions/ms-dotnettools.csharp-1.22.1/.omnisharp/1.35.3/run
PID: 17756
[info]: OmniSharp.Stdio.Host
Starting OmniSharp on debian 10.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: StandAlone 16.4 - "/home/jrm/.vscode/extensions/ms-dotnettools.csharp-1.22.1/.omnisharp/1.35.3/omnisharp/.msbuild/Current/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to '/home/jrm/.vscode/extensions/ms-dotnettools.csharp-1.22.1/.omnisharp/1.35.3/omnisharp/.msbuild/Current/Bin/MSBuild.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: StandAlone 16.4 - "/home/jrm/.vscode/extensions/ms-dotnettools.csharp-1.22.1/.omnisharp/1.35.3/omnisharp/.msbuild/Current/Bin"
CscToolExe = csc.exe
MSBuildToolsPath = /home/jrm/.vscode/extensions/ms-dotnettools.csharp-1.22.1/.omnisharp/1.35.3/omnisharp/.msbuild/Current/Bin
CscToolPath = /home/jrm/.vscode/extensions/ms-dotnettools.csharp-1.22.1/.omnisharp/1.35.3/omnisharp/.msbuild/Current/Bin/Roslyn
BypassFrameworkInstallChecks = true
MSBuildExtensionsPath = /home/jrm/.vscode/extensions/ms-dotnettools.csharp-1.22.1/.omnisharp/1.35.3/omnisharp/.msbuild
[info]: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in '/home/jrm/GIT/DemoTheProblem'.
[info]: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
No solution files found in '/home/jrm/GIT/DemoTheProblem'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for '/home/jrm/GIT/DemoTheProblem/BlazorServer/BlazorServer.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in '/home/jrm/GIT/DemoTheProblem'.
[info]: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: /home/jrm/GIT/DemoTheProblem/BlazorServer/BlazorServer.csproj
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
[info]: OmniSharp.WorkspaceInitializer
Configuration finished.
[info]: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location '/home/jrm/GIT/DemoTheProblem' on host 17647.
[info]: OmniSharp.OmniSharpWorkspace
Miscellaneous file: /home/jrm/GIT/DemoTheProblem/BlazorServer/Pages/Counter.razor__virtual.cs added to workspace
[info]: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file '/home/jrm/GIT/DemoTheProblem/BlazorServer/BlazorServer.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
Adding project '/home/jrm/GIT/DemoTheProblem/BlazorServer/BlazorServer.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Update project: BlazorServer
### C# log ###
It is empty
## Environment information ##
**VSCode version**: 1.46.1
**C# Extension**: 1.22.1
Mono Information
OmniSharp using built-in mono
Dotnet Information
.NET Core SDK (reflecting any global.json):
Version: 3.1.301
Commit: 7feb845744
Runtime Environment:
OS Name: debian
OS Version: 10
OS Platform: Linux
RID: debian.10-x64
Base Path: /usr/share/dotnet/sdk/3.1.301/
Host (useful for support):
Version: 3.1.5
Commit: 65cd789777
.NET Core SDKs installed:
3.1.301 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Visual Studio Code Extensions
|Extension|Author|Version|
|---|---|---|
|auto-using|Fudge|0.7.15|
|blazorsnippets|ScottSauber|1.3.0|
|csharp|ms-dotnettools|1.22.1|
|vscode-css-formatter|aeschli|1.0.1|
|vscode-peacock|johnpapa|3.7.2|
|yarn-ui|xqchen|0.1.2|;
Contributor guide
Assessment
This issue has not been assessed yet.