Stop visual studio from reloading swagger UI - visual-studio

I have updated my visual studio to version 16.10.2 (enterprise).
Now when I run my Asp.net Core 5 Web API, every time I modify something in my code, visual studio runs a task in the background, and with that, chrome refresh my swagger UI, and all my data get lost.
How can I stop this behavior?
I have always used swagger UI to test my APIs, but this behavior of visual studio is really annoying!
See the video for better understanding: video

There is an option in visual studio which will refresh chrome every time you save something.
you can disable this behavior by selecting none.
Go to: Tools > Options > Projects & Solutions > ASP.NET Core > Auto build and refresh options = and put it to none

Related

How to prevent Visual Studio 2019 [16.10.3] from auto page refresh in browser when changing any .js file?

After upgrading to Visual Studio Community 2019 [16.10.3] from [16.9.x] Chrome gets updated every time I save any javascript file. In my workflow it is annoying and does not bring my work any benefits. How to disable this feature?
I spent couple hours on searching the internet for the answer, but failed. It may be related to Hot Reload feature, but I still did not find an answer
I also want to disable this and what I found is that a javascript file named aspnetcore-browser-refresh.js is injected into the rendered page. The code in that file sets up a web socket to your web server which then allows the web server to issue a remote refresh of the browser. The browser refresh is triggered by something called dotnet watch, which is a process watching all the files in your project to see if any have changed.
You can read about it here: https://learn.microsoft.com/en-us/aspnet/core/tutorials/dotnet-watch?view=aspnetcore-5.0#run-net-core-cli-commands-using-dotnet-watch
Apparently this is a new feature in VS2019 for ASP .NET Core apps and is enabled by default.
HOW TO DISABLE
Go to Tools > ⚙ Options > Projects and Solutions > ASP .NET Core
Select Auto build and refresh browser after saving changes in Auto build and refresh option

How can one debug embedded code in razor pages?

I am looking at Blazor client side with asp.net hosting. So I am going through the template project and Visual Studio Preview does not seem to support breakpoints in razor pages, more specifically the code block:
#code {
private WeatherForecast[] forecasts;
protected override async Task OnInitializedAsync()
{
forecasts = await Http.GetJsonAsync<WeatherForecast[]>("WeatherForecast"); //breakpoint here
}
}
Is there a workaround or maybe something I am missing?
Thank you!
Blazor Webassembly debugging is currently available only using Chrome browser debugging proxy. The steps are described in Blazor docs:
Run a Blazor WebAssembly app in Debug configuration.
Pass the --configuration Debug option to the dotnet run command: dotnet run --configuration Debug
Access the app in the browser.
Place the keyboard focus on the app, not the developer tools panel. The developer tools panel can be closed when debugging is initiated.
Select the following Blazor-specific keyboard shortcut:
Shift+Alt+D on Windows/Linux
Shift+Cmd+D on macOS
Follow the steps listed on the screen to restart the browser with remote debugging enabled.
Select the following Blazor-specific keyboard shortcut once again to start the debug session:
Shift+Alt+D on Windows/Linux
Shift+Cmd+D on macOS
The "Hit F5 in Visual studio" debugging experience is not ready yet. Bits of it have been demonstrated by Daniel Roth in the .NET community standup video. Basically, Visual studio can attach to the browser's debugging proxy. Currently, in the preview versions, you have to do a series of steps manually, while in the future, those should be streamlined and done by the Visual studio.
Update March 26, 2020
Microsoft released a new preview of WASM Blazor and an improved support for debugging in Visual studio. Details here.

Visual Studio 2013 doesn't respond after updating the WCF service references from Front End project

Whenever I update WCF service reference in front end project, the service reference update happens and the bottom left corner of Visual Studio indicates that the service reference update is complete, but Visual Studio becomes non responsive after the update. If I close the Visual studio using the Task manager and restart it, reopen the solution, I can proceed as normal and can use the updated service reference. For now I always restart my Visual studio and reopen my solution to continue working on my tasks. Has anyone faced this issue? If anyone found the solution for this issue, could you please help me fixing this as it is very annoying to restart the Visual studio every time I update the service references. Thank you.
(I am using Visual Studio 2013 - project uses .Net Framework, asp.net webforms, and C# as the language for development. - if it helps.)
After trying different options, I guess the size of sln file and the size of references caused the issue for me. We use Resharper in our company which adds extra load when updating the service references.
My Visual Studio doesn't hang/becomes not responsive (most of the times), when i do the following..
1) Go to Tools -> Options -> Source Control - change the default option from Microsoft Git Provider to None.
2) Tools -> Options -> Resharper Ultimate and disabl it.
3) Try to figure out which projects in the solution is not required or affected and unload them.
Then update the reference. Still sometimes it doesn't work for me, but most of the times i dont have to restart the solution using task manager. I always disable resharper before I have to update the service reference and enable it back again once the service reference is updated. Hope it help others if they face similar situations..

Slow performance in Visual Studio 2012 update 4 RC when setting a breakpoint

I'm using Visual Studio 2012 update 4 RC.
When I set a breakpoint in my MVC 4 app (C#), the performance goes drastically down. From << 1sec. to 40-60 seconds for a page refresh (if the page appears at all.....)
Disabling all breakpoints bring the performance to a normal level.
How can I set breakpoint without a major performance penalty?
You may try to delete your .suo file but beware as you may loose your personal solution configuration settings for this solution.
You may also try disabling "Enable property evaluation and other implicit function calls" in Tools > Options > Debugging > General.
Also check this related question:- Visual Studio Debugging/Loading Very Slow
To solve this issue I've quit using the Azure Full Emulator and started using the Emulator Express.
rightclick the azure project
select properties
web emulator -> select 'Use Emulator Express'

Visual Studio 2010: very slow web applications debugging!

I recently installed Visual Studio 2010 (Ultimate edition, final version released in April), and found that debugging a web application became very slow (2-3 times slower than in Visual Studio 2008)!
I took the same web application and checked the speed of loading of one of its pages in VS 2008 and VS 2010, and compared the time it takes to load the page.
I tested it using 2 approaches: 1) debugging under ASP.NET Development Server (by pressing the "Start" button) and 2) using ASP.NET Development Server without debugging (by using the "View in Browser" menu command).
And I got the following results for Visual Studio 2008 and 2010.
1) ASP.NET Development Server withoud debugging ("View in Browser"): the speed of page loading is the same in VS 2008 and 2010.
2) Debugging under ASP.NET Development Server ("Start" button): in VS 2010 the page takes more time to load than in VS 2008 - VS 2010 debugging is 2-3 times slower than in VS 2008!
3) At the same time, when debugging a web application in VS 2008, it takes the same time to load the page compared to when using only the "View in Browser" command. That is, VS 2008 debugging does not introduce any overhead to page loading in the web browser!
I wanted to make sure that other people have the same problem with slow debugging of web applications in VS 2010. Can this issue be solved by any means?
BTW, I am using Windows XP SP3.
Thank you.
Disable Intellitrace (historical debugger) - it enable jumping "back in time" during debug but it slows down debugging.
You can disable it from the options->intellitrace
Try 'Delete all breakpoints' from the Debug menu. It sped up my web application debugging by 10 times.
I had problems with slow Visual Studio debugging when "Native Code" debugger was enabled. Try disabling it.
On "Visual Studio 2010" go to:
Project Properties ->
Web ->
Debuggers (bottom of page). ->
Disable all exept ASP.NET
Hope it helps.
Similar question: 1
After incredibly slow debugging for months I finally discovered the cause (even after disabling intellitrace).
It turned out to be PC Tools internet security -> IntelliGuard -> 'Behaviour Guard'
This is a hips like protection system that monitors the 'signature' of system operations
I disabled this feature and wow what a speed difference - 'stepping into' lines of code in debug now has almost zero delay. I re-enabled Intellitrace and can use it with only a very slight speed hit.
Tino
I tried a lot of things and the only way to solve it was the swax solution 'Delete all breakpoints'
I had this problem as well and it turned out to be due to sybmbols.
Go to Tools > Options > Debugging > Symbols and uncheck any symbol servers
Deactivate the option Show Parameter Values in the callstack window (debug -> windows -> callstack -> left click).
It required lots of recursion.
Reference
I did find out what you have to do:
Disable Intellisense
Disable the Graphics Rendering Editor Function, this causes editor slowness
with some graphics cards.
Disable the Sourcecontrol that is set by default to the Microsoft Server Product.
I just can tell you, that VS2010 is a very good product, if you
know these few things, and setup this.
You can uncheck the Symbols servers.
Try removing the localhost from the list of trusted sites in IE security settings.
For me it solved the problem of slow JavaScript debugging in VS 2010. It may work for you if you have added 'localhost' (or any other domain name you use for local development) to the trusted sites list, like I did.
I can get it faster by clear all break points, all unnecessary variable in Watch windows, and all the unnecessary debug windows, such as CallStack ...
I realized that ESET Internet Security also makes lots of performance issues while debugging in Visual Studio 2010 using ASP.NET Development Server.
Recently I faced with the same problem. I noticed that I had too many messages (especially "A first chance exception ...") in the VS's Output window. I fixed those exceptions and everything went fine.
What is expensive too sometimes is debugging the JavaScript libraries you are using or developing.
Checking the option "Don't open a page" in the project property window allows you to debug the web application without debugging JavaScript. You simply have to open the web application in your browser manually.
In some circumstances debugging JavaScript can break the responsiveness of the debugging process and if you know that your concern is with the .NET debugging, you can make load time faster that way easily.
Taking another route of Paulius' answer (disabling "Native Code" debugger) I was able to speed up the debugging. Here are the steps I took for VS 2010 Pro:
1) Tools > Options > Debugging > General
2) Ticked Enable Just My Code (Managed Only)
3) Also this might help, unticking Enable address-level debugging
There is another trick you can do:
1) Go to (Ctrl + Alt + Del) Task manager > Processes
2) There are 2 main processes for visual studio debugging, 1)devenv.exe 2) WebDev.Webserver40.exe (Or similar).
3) Right click on each of the bove processes > Set Priority > Real Time. Click Ok in the message Box.
Speeds up debugging dramatically!.

Resources