r/Blazor • • Aug 24 '24

Does VSCode finally supports Blazor?

I am on Linux and am trying to get my new Blazor project working in VSCode (again). However the official C# extension doesn't support anything else than chrome or edge for the debugging. Dotnet Watch supports any browser, but it cant be used for debugging. There are no extensions that can't do both for some reason.
I found many tutorials tho they are just too complex to setup for some reason and many of them are outdated.

I am more and more looking towards learning React at this point, the more i am trying to work with Blazor.

Don't get me wrong. Rider from JetBrains had also major issue with debugging Blazor apps. Rn i found that using VS + Reshaper is the recipe for most functional environment for Blazor. Unfortunately, i can't use VS on Linux.

So any ideas or should i drop Blazor entirely?

TBH: Blazor makes me almost suicidal for past month since i picked up this framework year ago and now i am finding out that all the skills i learned are useless in real world ...

0 Upvotes

45 comments sorted by

13

u/ohThisUsername Aug 24 '24

No, Blazor on VSCode is still a mess and largely unusable .

Rider works well. Debugging Blazor WASM works for me in Rider, although sometimes it's buggy.

1

u/GroundZer01 Aug 24 '24

I wrote my capstone project with Blazor Server and VSCode on a Mac and it’s far from unusable but it isn’t the best thing to use. I only used dotnet watch run and used print statements for debugging exclusively and I was able to work with it just fine. There were some weird syntax highlighting issues that required a refresh window but other than that it was fine. The worst part of it was not having breakpoints.

3

u/kastanCZ Aug 24 '24

Exactly, i just want working debugger. I don't consider print statements as a good practice for debugging stuff :)

3

u/redfournine Aug 25 '24

"good practice" lol. Even the senior React devs in my place use print statement.... sometimes ;)

1

u/ohThisUsername Aug 24 '24

"Unusable" was a hyperbole. It works, but is pretty much useless for anything beyond just text editing and basic debugging. Intellisense mostly doesn't work, refactoring throws errors, syntax highlighting is broken, etc.

I stuck with VSCode for years on Mac hoping it would improve but it never did, so I switched to Rider.

3

u/[deleted] Aug 24 '24

Is it actually unusable?

4

u/randomhaus64 Aug 24 '24

I imagine he means more than just editing kinds of features.

I assume VSCode is a fine editor for blazor, probably not great at debugging, profiling, etc

7

u/Khomorrah Aug 24 '24

For me intellisense breaks really easily in vscode. Where entire files are completely red with squiggly lines because it can’t recognize anything.

4

u/[deleted] Aug 24 '24

Visual Studio still does that sometimes with Blazor/Maui projects.

1

u/Ryzngard Aug 27 '24

We definitely have had some stability issues, but I'd give the new version a try. There was some architectural changes done recently to help with stability (and more on the way!)

If it still doesn't work please file a bug :) We're open source and try to interact with the community and actively fix feedback.

2

u/ohThisUsername Aug 24 '24

"unusable" was a bit of a hyperbole.

It works, but is really just a text editor with (broken) syntax highlighting and debugging. Intellisense is so broken that I consider it non-existent, and actually more of a hinderance since VSCode gets spammed with phantom errors that don't exist.

To be fair, I think VS code worked great for debugging Blazor, almost better than Rider does. But the lack of intellisense and refactoring make it unusable in any sizable project. Intellisense is kind of the whole reason I use statically typed languages like C#.

1

u/alexyakunin Aug 25 '24

It's more than usable. We use only Rider for 2+ years for our Blazor project.

3

u/soundman32 Aug 24 '24

Run Windows in a VM, then install VS Community. Problem solved.

-9

u/kastanCZ Aug 24 '24

That's a hard pass from me budy ...

14

u/soundman32 Aug 24 '24

I don't get it. You reject literally the best ( also free) ide for C# development, for something that is inferior in virtually every way. You do you buddy.

-3

u/kastanCZ Aug 24 '24

I don't ... I reject Windows. I am using VS Enterprise at work for over 5 years. However at home i migrated to linux and i am trying to bring my c#/blazor knowledge with me.

6

u/HealthySurgeon Aug 24 '24

Everything has its place and you’re not being honest if you reject windows fully. It has its place and its own advantages, just like Linux and every single one of its million distributions.

-4

u/kastanCZ Aug 24 '24

maybe they should mention somewhere in docs that working on Blazor Wasm apps is vendor locked behind windows and VS.

4

u/Dr-Collossus Aug 24 '24

Rider is the best IDE for working in Blazor, and that's true on Windows, macOS, and Linux. You're doing something wrong, literally everyone else in this thread has said the same thing.

0

u/kastanCZ Aug 24 '24

Its literally on their website that they don't support Blazor WASM. So what are you talking about?

2

u/Dr-Collossus Aug 24 '24

I'm not talking about their website, I'm talking about every Blazor developer in this thread stating that the best developer experience for Blazor comes from Rider, on any platform. In any case, JetBrains in fact explicitly state on their website that they do support WASM debugging for Blazor. Honestly I think you're definitely missing something, it shouldn't be this hard. See this for example: Blazor Wasm Development Upgrades in JetBrains Rider 2024.1 | The .NET Tools Blog

1

u/kastanCZ Aug 24 '24

My bad they explicitly stated that about hot reload. Tho debugging is still bugged for me anyways so it really doesn't matter. Now the worst this its a paid app.

2

u/HealthySurgeon Aug 24 '24

nothing is stopping anybody from developing anything, if youre so passionate about it, develop your own ide that does it better

Also, it may not have feature parity, but Rider 100% is working on making it better to work with Blazor WASM.

2

u/Ribak145 Aug 24 '24

well, with that attitude no wonder youre struggling to find a solution ...

3

u/[deleted] Aug 24 '24

Run dotnet watch and then run the debugger in attach mode to debug the running session of your blazor app.

1

u/Khomorrah Aug 24 '24

Officially it supports blazor.

In the real world it’s a complete mess and stuff breaks left and right. If I didn’t have rider I wouldn’t even touch blazor.

1

u/kastanCZ Aug 24 '24

Yeah but Rider doesn't support Blazor WebAssembly

1

u/Khomorrah Aug 24 '24

Idk, we use blazor server at work.

1

u/kastanCZ Aug 24 '24

me too and its amazing but i decided to try make real world app (online shop) and i need to use Blazor WebAssembly.

2

u/Level-2 Aug 24 '24

For an online shop you would use blazor server not WASM.

Try the latest blazor web app template , net8 that mixes (or allow you to use) all renders per component/page in the same project. I highly suggest using VS studio, as thats the official way to do blazor.

0

u/kastanCZ Aug 25 '24

For real world apps you can't use Blazor Server because of the server delay and complex way to scale the app.

1

u/Level-2 Aug 26 '24

read again. I told you to use blazor web app template. In this template you can have blazor server performance on the first render then subsequent access is done via WASM if you configure it like that. You need server side for SEO.

1

u/caedin8 Aug 24 '24

Blazor wasm debugging doesn’t even work for me on visual studio 2022 on a windows machine.

I get around it, and the server side works just fine

2

u/botterway Aug 24 '24

It absolutely does.

1

u/redfournine Aug 25 '24

Debugging works fine for me when I tested with latest version. Though I was merely messing with basic stuffs, ntg fancy. Did it break for large solution, or what's not working?

2

u/MarcCDB Aug 25 '24

The current scenario for Blazor (and MAUI) in VSCode is the main reason I don't fully switch to Linux... C# Dev Kit was a huge upgrade and the MAUI extension as well, but it's still not there yet...

1

u/One_Web_7940 Aug 25 '24

Vs on windows haven't had a suicidal problem yet

1

u/VirtualPAH Aug 25 '24

Could look into code instrumentation to get diagnostic data during execution where step through debugging isn't possible, also useful in prod so not wasted effort during dev due to specific dev tool limitations. A more sophisticated approach to using print statements.

1

u/-Komment Aug 26 '24

Edit: I missed that you're on Linux

You'd have to go with a VM + Windows for better Blazor support. VS still has issues with Blazor but it's as good as you'll get right now.

1

u/wanorx Dec 16 '25

Does anyone have an update on debugging blazor wasm in vscode on different OS from windows?

I spent 5 hours trying to setup the launch.json in vscode running on my macbook and wasn't able to get a stable run of it. Managed to make it work the first time you try to debug but then if you stop and run debug again it always identify another process running which means the first debug didn't stop and terminate it's process...

Someone had better experience?

BTW, finally was exhausted so I just installed rider and it magically works amazing...

3

u/[deleted] Aug 24 '24

[removed] — view removed comment

2

u/kastanCZ Aug 24 '24

Nope. Rider docs explicitly says that Blazor WebAssembly is not supported. I tried it several times and its true.

5

u/Nascentes87 Aug 24 '24

I use it everyday and it works even better than VS2022. I'm using Rider beta, tho.