Git Worktree: Managing Multiple Working Directories

 
 
  • Gérald Barré
Git worktree is a powerful feature that allows you to have multiple working directories associated with a single repository. Instead of switching branches and potentially losing uncommitted work, you can check out different branches in separate directories simultaneously without recloning the repository. Git worktree creates additional working trees linked to the same repository. Each worktree can have a… [read more]

Accessing Windows Known Folders in C# with SHGetKnownFolderPath

 
 
  • Gérald Barré
Windows has a list of well-known folders such as Documents, Pictures, Music, etc. You can access most of these folders using the Environment.GetFolderPath method in C#. Here's an example: Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); However, this list is limited to the folders defined in the Environment.SpecialFolder enumeration. If you need to access other well-known folders, such as… [read more]

Reduce boilerplate and maintain project consistency

 
 
  • Gérald Barré
Before reading: If you work in a small company with only one or two projects, this post may not be relevant for you. I've worked for companies of various sizes, from small startups to organizations with thousands of developers. While small companies typically have one or two projects, large companies can have hundreds or thousands of repositories. As organizations grow, keeping all projects aligned and… [read more]

How to Keep Processes Running After a GitHub Action Job Ends

 
 
  • Gérald Barré
When a GitHub Actions job finishes, the runner terminates any orphaned processes it started. It identifies these processes by checking for the RUNNER_TRACKING_ID environment variable. Any process with this variable set is treated as a child of the runner and will be stopped. On GitHub-hosted runners, this is usually not a concern since the entire virtual machine is discarded after the job ends. To allow a… [read more]

How to Retrieve Your Windows Product Key Using PowerShell

 
 
  • Gérald Barré
If you need to reinstall Windows, having your original product key is essential for activation. If you can't locate your product key, you can retrieve your current product key using PowerShell. This method is helpful if you have a digital license or purchased Windows online and didn't save the key. Run the following PowerShell command to extract your product key from the Windows Management Instrumentation… [read more]

Improving WASM Performance in Microsoft Edge by Disabling Enhanced Security

 
 
  • Gérald Barré
 
When running a WASM application in Microsoft Edge, you may observe significantly slower performance compared to other browsers (sometimes 5 to 10 times slower). Although Edge uses the same engine as Google Chrome and similar browsers, it introduces a security feature called enhanced security that can impact JS and WASM execution speed. This feature impacts WASM execution by using an interpreter instead of… [read more]

How to Find All Types That Can Be Sealed Using Roslyn

 
 
  • Gérald Barré
In the previous post, I described how to use Roslyn as a library to find all types that could be internal instead of public. Let's continue this series by showing how to find all types that can be sealed in a solution. Marking a type as sealed can improve performance and safety by preventing further inheritance. Note that removing sealed is not a breaking change, so you can safely mark types as sealed… [read more]

How to Find Public Symbols That Can Be Internal Using Roslyn

 
 
  • Gérald Barré
I got a question about how to find all public symbols in a solution that can be internal. This is a common scenario when you want to reduce the visibility of your code to improve encapsulation. You can use Roslyn as a library to analyze the code in a solution and find such symbols. I've already written about how to use Roslyn as a library to analyze and rewrite code in a solution: . This post will build… [read more]

How to Exclude Your Windows App from Screen Capture and Recall

 
 
  • Gérald Barré
Some applications are displaying sensitive information. With Recall, Windows can take a screenshot of your screen regularly and store sensitive information. You can exclude your application from this feature, and screen capture more generally, by using SetWindowDisplayAffinity and the WDA_EXCLUDEFROMCAPTURE flag. This is a Windows API function that allows you to set the display affinity of a window, which… [read more]