Showing posts with label Visual Studio 2017. Show all posts
Showing posts with label Visual Studio 2017. Show all posts

Wednesday, November 16, 2022

Visual Studio Debugging Windows: Watch, Locals, Autos, Immediate, Call Stack and Threads

The Watch Window

The Watch Window allows you to see value of variables and expressions while debugging. It’s kind of like the DataTip you get when hovering over a variable, except that you can write any expression you want. It’s available from Debug | Windows | Watch | Watch 1 or Ctrl + Alt + W + 1.

There are 4 watch windows in Visual Studio, which you can use in different contexts (Watch 1, Watch 2, etc.).

Any expression can be entered into the watch window. The same rules apply to expressions as to code. So if you write an illegal expression, you’ll see the same compiler error.

To add items to watch do any of the following:

  • Write them manually in a new row of the Watch window
  • Right-click on a variable choose “Add Watch” in the context menu
  • Right-click on a variable in the DataTip and choose “Add Watch”
  • “Add Watch” button from QuickWatch

When to Use the Watch Window:

While the DataTip and QuickWatch are more popular, the watch window is very useful when you need to re-evaluate the same variables and expressions multiple times. This happens if you hit the same breakpoint over and over again, or different breakpoints in the same class. The most common scenario is with a breakpoint inside a loop

The Immediate Window

The immediate window is available in the menu from Debug | Windows | Immediate or Ctrl + Alt + i. You can type in any expression and the immediate window will evaluate. It’s kind of like the Watch window, but it acts more like a command line window in Windows or Linux.

For me, the immediate window was always more convenient than the Watch or QuickWatch windows.

  • Like in command line interfaces, you can use the Up/Down arrow keys to paste previous expressions.
  • To clear the window, right-click on it and select “Clear All”.

Locals and Autos Windows

VS offers 2 automatic-watch tool windows: The Locals and Autos windows.

The Locals will show local variables of the current scope. It usually starts with this, which represents the current class.

The Autos window will show all variables used in the current line and in the previous line. These could be local variables, class members or static variables. The Autos also shows values returned from methods, which is useful at times

  • In both Locals and Autos, you can double click on any Value field and change the variable’s value. This will actually its value, causing a possibly unwanted side effect.
  • Search works same as in the Watch window.

Call Stack Window

One of the most useful tool windows is the Call Stack Window. It shows the chain of methods that called one another, up to the the currently debugged method

Threads Window

The Threads Window is the final tool window in what I call the Truly Vital Debugging Windows group. This window shows all the currently active threads, and allow to switch between them.

 

Sunday, June 05, 2022

How to build using command line from Visual Studio?

Here is how we can build using command line or terminal for Visual Studio using msbuild tool

1. Open Terminal from Visual Studio

2. On the terminal type msbuild to build current project 

msbuild /t:build

3. To clean here is the syntax

msbuild /t:clean

4. To Rebuild 

msbuild /t:rebuild

More examples

Examples:

MSBuild MyApp.sln -t:Rebuild -p:Configuration=Release

MSBuild MyApp.csproj -t:Clean

                             -p:Configuration=Debug;TargetFrameworkVersion=v3.5

For more detailed information, see https://aka.ms/msbuild/docs 


Friday, April 20, 2018

Duplicate Menu Items in Visual Studio

Recently I had a situation with Visual Studio 2010 where menu items where duplicated like 3-4 times. Looks like some configuration file was corrupted. I have tried to restore current settings and setup new settings but none worked out.

To resolve this I ran the following from command line

devenv.exe /safemode /setup

Once this ran, I restarted Visual Studio I could able to see Visual studio with default factory settings.

PS: If you have any personal settings done before you have to redo those settings again.

Thursday, April 19, 2018

Visual Studio 2017 version 15.7 Preview 3

The third preview of the next update Visual Studio 2017 version 15.7 is released and below are top highlights of this Preview.

  • Updates to Universal Windows Platform development
  • C++ development improvements
  • Significant updates in Xamarin and .NET Mobile Development
  • Ability to configure installation locations
  • Debugger support for authenticated Source Link
  • Live Unit Testing improvements
  • New tooling for migrating to NuGet PackageReference
  • Connected Service improvements to deployment and Key Vault functionality

To acquire the Preview, you can either install it fresh from here, you can update the bits directly from the IDE, or if you have an Azure subscription, you can provision a virtual machine with this latest preview.

for more details

Monday, December 26, 2016

How to load Visual Studio without extensions

All versions of visual studio can be started with a set of arguments.

Using devenv.exe /SafeMode allows you to run any version of visual studio (devenv.exe) in SafeMode that will disable 3rd party plugins.

Using devenv.exe /ResetSettings will restore Visual Studio default settings

Run these commands from Command prompt in admin mode. For additional options refer MSDN for help.

Thursday, December 15, 2016

Visual Studio 2017 RC is now available for download

Microsoft announced the Release Candidate (RC) bits of next major version of Visual Studio named as 'Visual Studio 2017', which is already known to us as 'Visual Studio 15'.

Visual Studio 2017 RC offers productive developer tools and powerful services for individual developers and small teams. Visual Studio Community 2017 RC is a free, fully featured, and extensible IDE for individual developers, open source projects, education and academic research. You can create applications for Android, iOS, Windows and the web. Integrated Azure tools make it easy to create cloud-first applications directly out-of-the-box.

Download Visual Studio 2017 RC

Before starting the download, please note that, it is a Release Candidate (RC) for Visual Studio 2017 and is a web installer that supports the following languages: Chinese-Simplified, Chinese-Taiwan, Czech, English, French, German, Italian, Japanese, Korean, Polish, Portuguese-Brazil, Spanish, Russian and Turkish at this moment.

You can download any of the below editions of Visual Studio 2017 RC directly from Microsoft servers:

Tuesday, December 13, 2016

What can you do with Visual Studio17?

Boosted Productivity

Enhancements to code navigation, IntelliSense, refactoring, code fixes, and debugging, saves you time and effort on everyday tasks regardless of language or platform. For teams embracing DevOps, Visual Studio 2017 streamlines your inner loop and speeds up code flow with the brand new real time features such as live unit testing and real-time architectural dependency validation.

Refined fundamentals

There is a renewed focus to enhance the efficiency of the fundamental tasks you encounter on daily basis. From a brand-new lightweight and modular installation tailored to your need, a faster IDE from startup to shut down, to a new way of view, edit, and debug any code without projects and solutions. Visual Studio 2017 helps you stay focused on the big picture.

Streamlined Azure Development

Built-in suite of Azure tools that enable you to easily create cloud-first applications powered by Microsoft Azure. Visual Studio 2017 makes it easy to configure, build, debug, package, and deploy applications and services on Microsoft Azure directly from the IDE.

Five-star mobile Development

With advanced debugging and profiling tools and unit test generation features, Visual Studio 2017 with Xamarin makes it faster and easier than ever for you to build, connect, and tune mobile apps for Android, iOS, and Windows. You can also choose to develop mobile apps with Apache Cordova or Visual C++ cross platform library development in Visual Studio.

For more information