Skip to content

Unable to open source generated file for [GeneratedRegex("...")] #7452

@tymtam2

Description

@tymtam2

Type: Bug

Issue Description

I'm unable to open RegexGenerator.g.cs

The error is:

The editor could not be opened due to an unexpected error: Unable to resolve resource source-generated:/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs

Steps to Reproduce

  1. dotnet new console
  2. Paste
using System.Text.RegularExpressions;

Example.Demo();

static partial class Example
{
  [GeneratedRegex("a*[ab]")]
  public static partial Regex Demo();
}
  1. F12 on the word Demo in line 8

Expected Behavior

The definition of the method opens and I acquire the knowledge of how regex works. I then repeat the steps for several different expressions and this makes me ascend to the next plane of knowing.

Beyond all polarities, I am
Let the judgments and opinions of the mind
Be judgments and opinions of the mind
And I exist behind that

After several days, I am no longer of this world.

Actual Behavior

The file doesn't open. I still don't understand regex. I still have to go to work tomorrow.

The error is:

The editor could not be opened due to an unexpected error: Unable to resolve resource source-generated:/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs

The generator works because the method's description is generated and beautifully shown in the tooltip.

Logs

Attached.
dotnet.server.trace set to Trace

20240818T222933.zip

C# log

DetailsPost the output from Output-->C# here

C# LSP Trace Logs

DetailsPost the output from Output-->C# LSP Trace Logs here. Requires `dotnet.server.trace` to be set to `Trace`

Environment information

VSCode version: 1.92.1
C# Extension: 2.39.29
Using OmniSharp: false

Dotnet Information .NET SDK: Version: 8.0.107 Commit: 1bdaef7265 Workload version: 8.0.100-manifests.43c23f91

Runtime Environment:
OS Name: ubuntu
OS Version: 23.10
OS Platform: Linux
RID: ubuntu.23.10-x64
Base Path: /usr/lib/dotnet/sdk/8.0.107/

.NET workloads installed:
Workload version: 8.0.100-manifests.43c23f91
There are no installed workloads to display.

Host:
Version: 8.0.7
Architecture: x64
Commit: 2aade6beb0

.NET SDKs installed:
8.0.107 [/usr/lib/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.7 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.7 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
None

Environment variables:
Not set

global.json file:
Not found

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

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

Visual Studio Code Extensions
Extension Author Version Folder Name
code-spell-checker streetsidesoftware 3.0.1 streetsidesoftware.code-spell-checker-3.0.1
csdevkit ms-dotnettools 1.9.55 ms-dotnettools.csdevkit-1.9.55-linux-x64
csharp ms-dotnettools 2.39.29 ms-dotnettools.csharp-2.39.29-linux-x64
debugpy ms-python 2024.10.0 ms-python.debugpy-2024.10.0-linux-x64
dotnet-interactive-vscode ms-dotnettools 1.0.5229040 ms-dotnettools.dotnet-interactive-vscode-1.0.5229040
go golang 0.42.0 golang.go-0.42.0
html5-boilerplate sidthesloth 1.1.1 sidthesloth.html5-boilerplate-1.1.1
jupyter ms-toolsai 2024.7.0 ms-toolsai.jupyter-2024.7.0-linux-x64
jupyter-keymap ms-toolsai 1.1.2 ms-toolsai.jupyter-keymap-1.1.2
jupyter-renderers ms-toolsai 1.0.19 ms-toolsai.jupyter-renderers-1.0.19
learn-vim vintharas 0.0.28 vintharas.learn-vim-0.0.28
markdown-all-in-one yzhang 3.6.2 yzhang.markdown-all-in-one-3.6.2
markdown-mermaid bierner 1.23.1 bierner.markdown-mermaid-1.23.1
marp-vscode marp-team 2.8.0 marp-team.marp-vscode-2.8.0
python ms-python 2024.12.3 ms-python.python-2024.12.3-linux-x64
rust-analyzer rust-lang 0.3.2070 rust-lang.rust-analyzer-0.3.2070-linux-x64
subtitles-editor pepri 1.1.7 pepri.subtitles-editor-1.1.7
vscode-dotnet-runtime ms-dotnettools 2.1.1 ms-dotnettools.vscode-dotnet-runtime-2.1.1
vscode-html-css ecmel 2.0.10 ecmel.vscode-html-css-2.0.10
vscode-jupyter-cell-tags ms-toolsai 0.1.9 ms-toolsai.vscode-jupyter-cell-tags-0.1.9
vscode-jupyter-slideshow ms-toolsai 0.1.6 ms-toolsai.vscode-jupyter-slideshow-0.1.6
vscode-lldb vadimcn 1.10.0 vadimcn.vscode-lldb-1.10.0
vscode-map-preview jumpinjackie 0.6.0 jumpinjackie.vscode-map-preview-0.6.0
vscode-pylance ms-python 2024.8.1 ms-python.vscode-pylance-2024.8.1
vscode-rust kalitaalexey 0.4.2 kalitaalexey.vscode-rust-0.4.2

Extension version: 2.39.29
VS Code version: Code 1.92.1 (eaa41d57266683296de7d118f574d0c2652e1fc4, 2024-08-07T20:16:39.455Z)
OS version: Linux x64 6.5.0-44-generic
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz (8 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
webnn: disabled_off
Load (avg) 7, 3, 3
Memory (System) 7.47GB (2.20GB free)
Process Argv --crash-reporter-id 517a38b4-9750-49ed-b255-3af2e8ee7fec
Screen Reader no
VM 0%
DESKTOP_SESSION ubuntu
XDG_CURRENT_DESKTOP Unity
XDG_SESSION_DESKTOP ubuntu
XDG_SESSION_TYPE x11
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
pythongtdpath:30769146
welcomedialog:30910333
pythonnoceb:30805159
asynctok:30898717
pythonregdiag2:30936856
pythonmypyd1:30879173
2e7ec940:31000449
pythontbext0:30879054
accentitlementsc:30995553
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
da93g388:31013173
pythoncenvpt:31062603
a69g1124:31058053
dvdeprecation:31068756
dwnewjupyter:31046869
impr_priority:31102340
refactort:31108082
pythonrstrctxt:31112756
flighttreat:31119336
wkspc-onlycs-t:31111718
nativeloc2:31118319
wkspc-ranged-t:31118572
pme_test_t:31118333

Metadata

Metadata

Assignees

No one assigned

    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