Sunday, September 6, 2026

Fixed: Visual Studio Git Changes Not Showing Modified Files

 

Fixing the "Git Changes Not Showing Modified Files" Issue in Visual Studio

Have you ever made a bunch of code changes, only to look over at the Git Changes window in Visual Studio and see... nothing? It’s a frustrating glitch that can grind your workflow to a halt.

This issue is usually caused by file-system watcher sync lags, multi-repository root settings, or a minor UI state desynchronization. Fortunately, it’s usually quick to fix. Here are the most effective ways to troubleshoot and resolve the problem:

1. Manually Refresh the Git Status

Visual Studio relies on background file watchers to detect changes in your workspace. If it misses an update:

  • Click the Refresh icon (the circular arrow) at the top of the Git Changes window.

  • Run git status in an external terminal (such as Git Bash or the Developer Command Prompt) to verify if Git itself recognizes the modifications.

  • How to verify: If the command line shows your modified files but Visual Studio doesn't, you are dealing with a pure UI sync glitch.

2. Close and Reopen the Git Changes Window

A quick way to force Visual Studio to re-initialize the tool window control is to toggle it off and back on:

  • Close the Git Changes tab.

  • Go to the top menu and select View > Git Changes (or press Ctrl + 0, Ctrl + G).

3. Check for Multiple Repositories or Solution Roots

If your solution contains projects spread across different folders or Git submodules, Visual Studio might simply be looking at the wrong repository context:

  • Look at the top of the Git Changes window to check the active repository context.

  • Use the repository selector dropdown to ensure you are targeting the exact root folder where your files were modified.

4. Review Excluded Files and .gitignore Rules

Sometimes files fail to show up because they match a newly added or updated .gitignore rule, or because Visual Studio's filters are hiding them:

  • Double-check if your untracked files were accidentally ignored.

  • Ensure your view filters aren't hiding untracked or specific file types.

5. Restart Visual Studio or Clear the Component Cache

If the underlying Git integration service has crashed or locked up internally:

  • Restart Visual Studio completely.

  • If the problem persists, clear the MEF component cache by deleting the %LocalAppData%\Microsoft\VisualStudio\[Version]\ComponentModelCache folder. This forces Visual Studio to rebuild its internal component extensions on the next launch.

Have you encountered other Git quirks in Visual Studio? Let us know how you solved them in the comments below!

Saturday, August 22, 2026

How to Fix Weird .NET Build Errors Using dotnet clean and NuGet Cache Clearing

If you work with .NET long enough, you will eventually run into a baffling build error where your code looks completely correct, but the compiler stubbornly refuses to cooperate. Often, the culprit isn't your code—it's stale build artifacts or corrupted package caches.

In this quick guide, we’ll look at two powerful commands every .NET developer should have in their toolkit: dotnet clean and dotnet nuget locals all --clear.

What does dotnet clean do?

When you build a .NET project, the compiler generates temporary files, compiled binaries, and cache files stored inside the bin/ and obj/ directories of your project folder.

The dotnet clean command deletes these build outputs (the contents of the bin and obj folders).


Why use it?

To force a completely fresh build from scratch.


To resolve issues where old compiled files aren't being updated properly during incremental builds.

Before packaging or publishing your application to ensure no old artifacts sneak in.


Bash

dotnet clean

(Note: This only affects the local project directory and does not delete your source code.)


What does dotnet nuget locals all --clear do?

While dotnet clean clears local project build outputs, NuGet handles external library dependencies. .NET stores downloaded NuGet packages in global machine caches (such as http-cache, global-packages, and temp) so it doesn't have to re-download them every time.


The dotnet nuget locals all --clear command completely wipes out all local NuGet caches across your machine.


Why use it?

To fix stubborn package restore errors (e.g., NU1101, NU1202).


When a package download was interrupted or corrupted, causing constant build failures.


To force .NET to fetch fresh copies of packages from NuGet.org (useful when working with prerelease packages or packages with the same version number updated locally).


Bash

dotnet nuget locals all --clear

When should you use them together?

If you are experiencing mysterious build errors that won't go away after a standard rebuild, try running them in sequence as a "nuclear option" to reset your local environment:


 # 1. Clean local build artifacts

dotnet clean


# 2. Clear all global NuGet caches

dotnet nuget locals all --clear


# 3. Restore dependencies and rebuild fresh

dotnet restore

dotnet build

Friday, August 7, 2026

Sql Server offset 0 usage

 In SQL Server, OFFSET 0 ROWS instructs the database to skip exactly zero rows before returning data.

On its own, skipping zero rows doesn't change the output, but when paired with the FETCH NEXT clause, it becomes the standard, ANSI-compliant way to implement pagination (specifically, grabbing the "first page" of results).

Basic Syntax

SQL
SELECT column_name(s)
FROM table_name
ORDER BY sort_column
OFFSET 0 ROWS 
FETCH NEXT n ROWS ONLY;

e.g 1: The "First Page" of Results

Imagine you have an Employees table, and you are building a UI that displays 5 employees per page, starting with the highest earners.

To get Page 1, you use OFFSET 0:

SQL
SELECT EmployeeID, FirstName, LastName, Salary
FROM Employees
ORDER BY Salary DESC
OFFSET 0 ROWS 
FETCH NEXT 5 ROWS ONLY;

How it works:

  1. ORDER BY Salary DESC: Sorts the employees from highest to lowest salary.

  2. OFFSET 0 ROWS: Starts at the very first row of that sorted list (skips nothing).

  3. FETCH NEXT 5 ROWS ONLY: Grabs exactly 5 rows and stops.

(To get Page 2, you would change it to OFFSET 5 ROWS FETCH NEXT 5 ROWS ONLY).

e.g 2: Dynamic Pagination in a Stored Procedure

The most common real-world use case for OFFSET 0 is inside stored procedures where pagination math is calculated dynamically using variables.

When a user requests Page 1, the math automatically calculates to OFFSET 0.

SQL
DECLARE @PageNumber INT = 1; -- The user wants the 1st page
DECLARE @PageSize INT = 10;  -- The user wants 10 records per page

SELECT EmployeeID, FirstName, LastName, Department
FROM Employees
ORDER BY LastName ASC
-- The math: (1 - 1) * 10 = 0. So this resolves to OFFSET 0 ROWS
OFFSET (@PageNumber - 1) * @PageSize ROWS 
FETCH NEXT @PageSize ROWS ONLY;

Important Rules

  • ORDER BY is Mandatory: You cannot use OFFSET without an ORDER BY clause. The database needs a definitive sorting order to know exactly which rows it is skipping.

  • FETCH is Optional: You can use OFFSET without FETCH. If you write OFFSET 10 ROWS without a FETCH clause, SQL Server will skip the first 10 rows and return everything else.

  • No mixing with TOP: You cannot use TOP and OFFSET-FETCH in the same query block. OFFSET-FETCH was introduced in SQL Server 2012 specifically as a more robust replacement for using TOP for pagination.

Cheers
Samitha

Sunday, July 26, 2026

Visual Studio 2026 overview

 


Visual Studio 2026 delivers a major leap forward, focusing on deep AI integration, architectural speed, and a refreshed interface. Designed alongside .NET 10 and C# 14, it aims to drastically cut down boilerplate code, enhance real-time responsiveness, and streamline modern development workflows.

Key Highlights

1. AI-Powered and Agentic Workflows

  • Intelligent Agents: Built-in C# and C++ coding, debugging, and profiling agents help isolate root causes and optimize build paths seamlessly.

  • Adaptive Paste: Automatically rewrites pasted external snippets to match your active project's naming conventions and structure.

  • Model Context Protocol (MCP): Advanced [GitHub Copilot Chat] capabilities supporting custom skills and server management.

2. Performance and Architecture

  • Decoupled Build Tools: Separates the IDE from underlying compilers, allowing you to update Visual Studio independently from toolchains.

  • Reduced UI Freezes: Startup time is snappier, and UI unresponsiveness during heavy enterprise solution loads has been cut by over 50%.

3. User Experience and Tooling

  • Fluent Design: A modernized, distraction-free interface featuring cleaner icons, accessible color tokens, and full color emoji support across logs and comments.

  • Unified Settings: A streamlined, embedded settings tab that enables direct editing via JSON configurations.

Sunday, July 12, 2026

sql server get open connections

To get the active and open connections in SQL Server, you can use a few different methods depending on how much detail you need.

Here is the cleaned-up, fully corrected version of those scripts and explanations, free of formatting artifacts:

1. The Quick Count (By Database)

If you just want a quick headcount of how many connections are open on each database, query sys.sysprocesses:

SELECT 

    DB_NAME(dbid) as DatabaseName,     COUNT(dbid) as OpenConnections

FROM     sys.sysprocesses

WHERE     dbid > 0

GROUP BY     dbid;

2. The Detailed View (Recommended)

For a modern, detailed breakdown of who is connected, what application they are using, and where they are connecting from, use sys.dm_exec_sessions.

This script filters out internal system connections so you only see actual user traffic:


SELECT 

    session_id,    login_name,    host_name,    program_name,    status,    cpu_time,    total_elapsed_time

FROM      sys.dm_exec_sessions

WHERE      is_user_process = 1; -- 1 filters for user connections, 0 for system processes

3. What Are They Currently Running?

If you want to see the open connections and the exact SQL query they are executing right now, join the sessions DMV with sys.dm_exec_requests and sys.dm_exec_sql_text:


SELECT     s.session_id,    s.login_name,    s.host_name,    s.program_name,    r.status,    st.text AS ExecutingQuery

FROM     sys.dm_exec_sessions s

INNER JOIN     sys.dm_exec_requests r ON s.session_id = r.session_id

CROSS APPLY 

    sys.dm_exec_sql_text(r.sql_handle) st

WHERE     s.is_user_process = 1;

4. The Built-in Stored Procedure

If you don't want to type out a long query, SQL Server has a classic built-in stored procedure that gives you a massive dump of all current processes and connections

EXEC sp_who2;

 Look at the SPID column (anything above 50 is typically a user connection) and the DBName column to see where the action is happening.

Saturday, July 4, 2026

kill many process in sql server

 To kill multiple processes in SQL Server, you cannot pass a list of IDs directly into a single KILL command. Instead, you have to generate and execute individual KILL <spid> statements.

Here are the three most efficient ways to do this, depending on your needs.

Method 1: The Quick Filter Script (Recommended)

If you want to kill processes tied to a specific database or a specific user, you can run a query that automatically generates the syntax for you.

Run this script to generate the list of kill commands:


SQL

DECLARE @sql NVARCHAR(MAX) = '';


SELECT @sql += 'KILL ' + CAST(session_id AS VARCHAR(10)) + ';' + CHAR(13)

FROM sys.dm_exec_sessions

WHERE database_id = DB_ID('YourDatabaseName') -- Filter by database

  AND is_user_process = 1                     -- Only target user processes, not system tasks

  AND session_id <> @@SPID;                   -- Do not kill your current connection


-- STEP 1: Preview the commands to make sure they look correct

PRINT @sql;


-- STEP 2: Uncomment the line below when you are ready to execute them all at once

-- EXEC sp_executesql @sql;

Method 2: The Cursor Approach (Fully Automated)

If you want a single script that finds and drops connections instantly without a copy-paste preview step, you can loop through them using a CURSOR. This is highly effective if you are preparing a database for a restore or a drop.


SQL

DECLARE @spid INT

DECLARE @kill_cmd NVARCHAR(50)


DECLARE spid_cursor CURSOR FOR

SELECT session_id

FROM sys.dm_exec_sessions

WHERE database_id = DB_ID('YourDatabaseName')

  AND is_user_process = 1

  AND session_id <> @@SPID;


OPEN spid_cursor

FETCH NEXT FROM spid_cursor INTO @spid


WHILE @@FETCH_STATUS = 0

BEGIN

    SET @kill_cmd = 'KILL ' + CAST(@spid AS VARCHAR(10))

    EXEC sp_executesql @kill_cmd

    FETCH NEXT FROM spid_cursor INTO @spid

END


CLOSE spid_cursor

DEALLOCATE spid_cursor

Method 3: Kick Everyone Off via ALTER DATABASE

If your goal is to kill every single connection to a specific database right now (for instance, to perform maintenance, rename it, or drop it), the fastest and safest approach doesn't require looking up SPIDs at all. You can forcefully transition the database into SINGLE_USER mode, which automatically terminates all other active connections.


SQL

USE master;

ALTER DATABASE YourDatabaseName

SET SINGLE_USER WITH ROLLBACK IMMEDIATE;


-- Perform your work here...


-- Don't forget to set it back to multi-user mode when finished!

ALTER DATABASE YourDatabaseName

SET MULTI_USER;

Note on ROLLBACK IMMEDIATE: This option specifies that any open transactions in the database will be instantly rolled back, and their underlying connections severed immediately.


Best Practices & Precautions

Check Status: If you kill a long-running write transaction (like a massive data import or index rebuild), SQL Server must roll back the changes to ensure data integrity. If you check sys.dm_exec_requests, you might see the status as KILLED/ROLLBACK. Do not restart the SQL service to speed this up, as the rollback will simply resume upon startup and often take longer.


Avoid System SPIDs: Always include is_user_process = 1 or filter out session_id <= 50 to avoid accidentally targeting background SQL Server engine processes.


Cheers

Samitha

Sunday, June 28, 2026

create a new table based on an existing view

 The absolute fastest and cleanest way to create a new table with the exact same schema (structure and data types) as an existing view in SQL Server is to use a SELECT ... INTO statement combined with a WHERE 1 = 0 clause.


The WHERE 1 = 0 condition acts as a false flag—it forces SQL Server to clone the structural definition of the view without actually copying any of the rows into your new table.


Run this script in your SQL Server Management Studio (SSMS):


SQL

-- Creates an empty table with the exact structure of the view

SELECT *

INTO q2AIR_MDPL_RPT_TimecardSalaryReport

FROM q2vAIR_MDPL_TimecardSalaryReport

WHERE 1 = 0;


Cheers

Samitha