-
Notifications
You must be signed in to change notification settings - Fork 215
Description
This issue has been moved from a ticket on Developer Community.
[severity:I'm unable to use this version] [regression] [worked-in:I don't this it ever worked in 2026.]
In Microsoft Visual Studio Community
Channel: Insiders
Version: 18.0.0 Insiders [11104.47]
Trying to set a breakpoint inside a "simple" .cshtml file isn't possible. If I switch to a an other version of VS, it is.
The status-bar in the bottom just responds: A breakpoint could not be inserted at this location.
Original Comments
Feedback Bot on 09/10/2025, 01:18 PM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Feedback Bot on 10/10/2025, 08:42 AM:
This issue is currently being investigated. Our team will get back to you if either more information is needed, a workaround is available, or the issue is resolved.
David Wengier [MSFT] on 10/10/2025, 01:03 PM:
Thanks for reporting this issue. It’s a little surprising though, as we definitely had this bug in Insiders 1, but we fixed it for 2 in #12242 so you shouldn’t be running into it.
Does it repro 100% of the time for you? Or only sometimes? If you type a few characters in a Razor file, then close and reopen the file, does that make it work?
The other thing to check, and its a bit of the elephant in the room, is to run a repair in the VS installer, because the COMException in the tool window seems to indicate that you have something going on, and I can see in the logs that a debugger library has hit an error while loading.
Janus Kamp Hansen (CodeOptimus) on 10/10/2025, 04:55 PM:
Thank you for your answers. I appreciate that. I will try to follow up on your questions.
I can reproduce the problem, 100% of the time.
Wheather I try to set a breakpoint strait away after opening my project (any project) or I close the file and reopens it or another file.
There are not differences either wheater I’ve just booted my machine or have had Visual Studio 2026 opened several times.
Makes no difference - I can set breakpoints.
Using System.Diagnostics.Debugger.Break() makes the debugger break the code.
I’ve tried the “Repair”-feature of the Installed version from within the Visual Studio Installer, but after repairing it - no difference.
David Wengier [MSFT] on 10/10/2025, 05:06 PM:
Thanks for the quick response!
Duncan Smart (lexonis.net) on 13/10/2025, 08:22 PM:
Might be worth mentioning issue is for ASP.NET Web Application (.NET Framework) projects (for us at least). I tried with a .NET Core Razor Pages and breakpoints still work there)
David Wengier [MSFT] on 13/10/2025, 08:25 PM:
That is definitely worth mentioning! It means when I was trying I was using entirely the wrong editor in VS! The .NET Framework editor is separate.
Janus Kamp Hansen (CodeOptimus) on 13/10/2025, 08:39 PM:
My project is NET9.0 project. Not a .NET Framework project.
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<NoWarn>$(NoWarn); SYSLIB0021</NoWarn>
</PropertyGroup>
The chosen editor (If using “Open With”, while right-clicking on the .cshtml file) is: “HTML Editor (default)”.
Another observation: While Visual Studio is loading the editor comes into view and for a short while I am able to toggle breakpoints until all-of-a-sudden it stops working and VS statusbar says: A breakpoint could not be inserted at this location.
David Wengier [MSFT] on 13/10/2025, 08:58 PM:
Oops, sorry, didn’t notice that was a different person commenting. Just blindly responded to the email message 😃
David Wengier [MSFT] on 13/10/2025, 09:23 PM:
Looking at the logs from your report Janus Kamp Hansen (CodeOptimus) it looks like your project might be doing something custom with .razor files, which is making it incompatible with the Razor editor. I see this in the logs (and you should see it in the Output Window, under the “Razor Logger Output” category):
[Razor.LanguageClient.Cohost.IncompatibleProjectNotifier] [09:48:05.1477085] The Razor editor utilizes the Razor Source Generator, which requires *.razor and *.cshtml files to be AdditionalFiles in the project. _Layout.cshtml appears to come from 'DinBilAuktion.dk', which has no Razor documents that are AdditionalFiles, so the editing experience will be limited. Is it using the Razor SDK? No more messages will be logged for this project.
Does that sound reasonable? Or is this a standard web project?
If you create a new web application, or blazor application, from the default template does that still have the same issue?
Janus Kamp Hansen (CodeOptimus) on 13/10/2025, 09:58 PM:
(private comment, text removed)
David Wengier [MSFT] on 13/10/2025, 10:21 PM:
Duncan Smart (lexonis.net) that’s a little surprising, the cohosting editor doesn’t support .NET Framework projects and should just defer to the same editor as if you have it off.
Duncan Smart (lexonis.net) on 13/10/2025, 11:06 PM:
David Wengier [MSFT] - our project is using https://github.com/CZEMacLeod/MSBuild.SDK.SystemWeb (SDK-style projects for ASP.NET 4.x) which might make it a bit of an outlier.
Original Solutions
Duncan Smart (lexonis.net) solved on 13/10/2025, 10:18 PM, undefined votes:
For a .NET Framework project, this workaround works for us: turn off Preview Features > Use Roslyn Cohost server for Razor.
Janus Kamp Hansen (CodeOptimus) solved on 13/10/2025, 10:24 PM, undefined votes:
Deactivating the “Preview Feature” -> Use Roslyn Cohost server for Razor (requires restart) seems to do the trick.