Upgrade to Visual Studio 2022 Blazor WASM client debugging not working - visual-studio

I am trying to debug my webassembly blazor client.
I was previously using VS2019 fairly successfully, except that the breakpoints were unbound till I toggled them off and on again after starting the debug session.
I tried the VS 2022 preview and found that if I introduced a delay at the start of the app like this:
public class Program
{
public static async Task Main(string[] args)
{
#if DEBUG
Console.WriteLine("Delaying");
await Task.Delay(5000);
Console.WriteLine("Delay Done");
#endif
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.Services.AddBlazorise(options =>
... etc.
Then with .NET 5 libs and VS2022(preview) it worked. So I resolved to struggle on till the full releas came out, and now I have upgraded to the release version of 2022 and updated the libs to .NET 6. I am finding the problem is in fact worse. This because I can't get the breakpoints to bind at all any more.
Fortunately, I have not gotten very fara with this and can roll back to Net5 and VS2019 again.
However, I was wondering if this is just me, or have I done something stupid.
I have checked that the DEBUG>OPTIONS>GENERAL>'Enable Javascript debugging for ASP.NET is enabled, however, here is agrab of my options in case anyone can see anything I have set wrongly...
Given that this has been going on for some time and I am far from the only person with this issue (though very little about it on here), I wondered if anyone could help as it is really stopping me from getting on atm..
Thanks in advance,
Brett
EDIT I am interested in peoples thoughts on this.
I took my backup of the project (at .net5) and upgraded it again.
Now all seems to be working ok., but I can't help womdering if it isn't something to do with when I tried to restructure my components folder (which contains razor, razor.cs and razor.css files). It caused initial errors because the namespace for the razor files is implied and I needed to change that of the .cs files (I am using partial classes for them). After that, it was just broken. I also tried deleting the .vs file in the root project but that didn't help either. Is there a formal process for moving .razor files around?
Curious.

Related

How to I solve a Visual Studio Fatal Error during debugging involving Desktop CLR, CoreCLR and recommending Managed Debugger

I'm afraid the error is so baffling to me I didn't even know how to word the question! I'm writing a plugin that's a class library for a Third Party Application (call it 'ApplicationX'). I had this successfully set up in a debug environment where it would build to ApplicationX's Plugin folder with the .pdb file and then the VS debug would start ApplicationX, thus enabling me to debug the plugin/class library code. This was working fine until I had a System Drive crash >.< (my first ever + ouch!).
Here's the debug setup:
I've just come back to it. I couldn't tell you all the changes, but I'm on VS2022 now as opposed to 2019. Now when I run it (the source code and ApplicationX is still much the same), I get this really weird error:
I've read through all the SO articles I could find and tried the suggesitons therein, but nothings worked. Firstly, I just can't understand the error. Secondly, Are there any suggestions on what to do. Here's what I've tried:
Installing .net Core 3.1 and 6 (full + desktop versions)
In options>debugging>general, checked "automatically close the console when debugging stops"
Some other stuff that I can't remember right now!
Be grateful of any help as this has brought my dev to a grinding halt!
Solution: I got in touch with the author of 'ApplicationX' He confirmed that he'd migrated it to .net Core. So that was the issue. I haven't got the solution in terms of solving it from that perspective, as I switched to the .net Framework version of ApplicationX instead! Non-the-less, the error's a bit clearer.

MSB3073 UE4 exited with code 6 - how do I fix this?

Ok, so I'm taking a udemy course on UE4 and when compiling I have a issue where I'm presented with my file location and told it exited with code 6. There are also a lot of errors saying that say it can't read my macros - how do I fix this? I'm relatively new to this so try to make it as simple as possible when answering. Thank you.
I would advise paying close attention to syntax and UPROPERTY (what is in here).
For example, I had this situation:
struct FGridCoord
{
GENERATED_BODY()
public:
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Grids")
int Col = 0;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Grids")
int Row = 0;
/** Default constructor (no initialization). */
FORCEINLINE FGridCoord() {} <<<------ This was giving same error ---->>> FORCEINLINE FGridCoord();
And other one I had:
UPROPERTY(VisibleAnywhere, Category = "Grids", meta = (AllowPrivateAcsess = "true")) <<<---- It had BlueprintReadOny and was giving an error
USceneComponent* RootComp;
I was getting the exact error this question lists (also taking a Udemy course on Unreal LOL), syntax all looked fine (this project/environment worked fine the last time I used it, some months ago) and hadn't changed, so I decided to clean the solution and rebuild.
This time I got a slightly different error, and it mentioned needing Windows SDK installed.
A quick Google of that seems to show that yeah, that's what's needed. Visual Studio Installer showed under C++ Game Development that none of the Windows SDK options were checked/installed. Since I'm running Windows 10 I checked the most recent/highest version of W10SDK and installed that.
After that I tried loading my project from the Epic Games Launcher, just like I did before starting my Udemy course 30 minutes prior. Now that said it was missing a module and that it needed to be rebuilt. Clicked "OK." The project rebuild failed.
I saw Unreal Engine could be updated from 4.27.1 (which I created my project in and which had been working without issue some months ago, like I said) to 4.27.2. Downloaded the 4GB update, still got the "missing module, rebuild" error but after clicking "OK" that time it built and UE 4 opened the project. VS2022 now builds the solution, and I can play the project within UE 4.
I have no fricking clue what just happened here, cause this all worked last time I worked on it and I changed nothing in the meantime, but it all works now.
So for others that get this, maybe:
Try cleaning your solution and see if you perhaps need to install Windows SDK
Maybe upgrade your UE 4 a minor version, if it's available
Head asplodes 🤷‍♂️🤷‍♂️🤷‍♂️

UnityContainerExtensions.cs not found

After updating some NuGet packages, it turned out that some things in my website got broken by new code. I updated to the new Unity inversion control 5.0.0, etc. So after a while of hunting around and trying to fix it, I was able to get it to finally build and launch the site. However, the Unity IOC was broken because I kepts getting the "Error in Application '~/', controller must have a parameterless constructor". I saw that my couple of Unity files (UnityConfig.cs and UnityMvcActivator.cs) were gone, so I replaced them with ones I had in the backup folder.
Well, now it launches a loading site, but in VS it now says "UnityContainerExtensions.cs not found". I see that it looks all over for this file, around 'C:\ Program Files (x86)\Microsoft Visual Studio 14.0\VC...' and then it goes looking through 'c:\projects\unity]Abstractions\src\Utility...' - a folder that I can't even see.
This is in VS2015, doing a web application with Framework 4.6.
What can I do to just make it work again, as when I first had it so many months ago?
Alright, I was able to fix my Unity problem by rolling back on some of the packages. I'm the kind of person who likes to have no notifications, so I clicked Update All, and apparently the updates weren't necessarily compatible with my project here. To get it working again I has to bring back:
Unity.Abstractions = 2.0.0
Unity = 4.0.1
Unity.AspNet.WebApi = 4.0.1
Unity.Mvc = 4.0.1
Now to great relief, all works just as it did before!
However, I do wish I knew why the breakages happen and also why these packages are listed as updates when they are not going to work with my project.
Till the future, my system is going to have to consist of a Post-It "Do not update these xxxx packages, they will break stuff". And I wish to gain an understanding of what is the reason behind such Unity mess.

Code Definition Window not working in VS2015

Just upgraded to Visual Studio 2015 and the Code Definition Window is not working.It just says "No definition selected" no matter what I select. Project is Windows Forms written in C#.
Go to Definition and Peek Definition are working fine
Went back to VS2013 to try it out and it's still working there
Tried to make a brand new project in VS2015 to see if it was project related, but it was not
Checked with a couple of colleagues and it wasn't working for them either
I have a feeling this is either a bug in VS2015 or some sort of configuration change.
Anyone found a way to configure it, or any sort of work around to get it up and running again?
I got a reply from Microsoft on my Bug report. Turns out it's not implemented and possibly never will be:
Hi,
Based on the fact that Peek Definition was introduced in VS2013,
combined with telemetry data that shows that only a tiny percentage of
users ever display the Code Definition Window, we decided not to
implement support for it as part of Roslyn. I've filed an issue on our
GitHub project to consider resurrecting it.
Thanks for the report!
-- Kevin Pilch-Bisson Visual Studio Managed Languages
Here´s the github issue Kevin created in response to my bug report in July: https://github.com/dotnet/roslyn/issues/4224
Looks like they just merged a fix for this into Roslyn:
https://github.com/dotnet/roslyn/pull/56102

Visual Studio LESS: Compile main file upon save of imported file

I have this less structure:
parent.less
child1.less
child2.less
Is it possible to compile parent.less any time child1 or child2 are saved? I would prefer not to have to build the project for LESS compilation to occur. At the moment I have to trigger a save from parent.less.
I'm using the latest Web Essentials with LESS support, is it possible to do what I want with this?
Many thanks
According to "SLaks" comment on the Uservoice request for this feature. "Press Alt+Shift+Y (Build, Web Essentials, Recompile all LESS Files) to do this without rebuilding."
I agree, it would be a great feature for it to do it automatically without the shortcut.
Just a quick comment in case anyone else stumbles across this while searching, this has been added to WE2013, but if you are still in VS2012 and using WE2012, this still doesn't work, and it doesn't sound like it will be added to 2012.

Resources