We have a new version of Visual Studio coming soon so I did the work to update my WintellectPowerShell module to support it. And, what a huge adventure that turned out to be! I will discuss why its support for Visual Studio 2017 was hard a bit later in this blog entry. For those of you who are new to WintellectPowerShell, it is a module that brings a number of useful cmdlets for setting up symbol and source servers for Visual Studio 2013-2017 as well as WinDBG. Other cmdlets automatically download and extract all the lovely goodness of the SysInternal tools, automate the analysis of lots of minidump files, and so on. The module has been helpful to me over the years. You can look at all the source code on GitHub: https://github.com/Wintellect/WintellectPowerShell. To install WintellectPowerShell directly, execute the following command in PowerShell:
If you have a previous version of WintellectPowerShell installed, you will see an ‘Authenticode issuer’ error when you try to update. The error is because since I last released a WintellectPowerShell build, my code signing certificate needed to be renewed. When PowerShellGet does checks a signed module, it checks all the certificate fields.… Read more
Microsoft has released the 1.0 version of the Azure PowerShell cmdlets for automating processes with Azure including better support for Resource Manager, VM disk encryption with Azure Vault, and inclusion of Azure Data Lake and Notification Hub cmdlets. Also released were new user experience improvements in the Azure Preview Portal such as notification enhancements and adding Marketplace access directly in the New menu.
Azure PowerShell 1.0 includes the following items from the Azure Blog.
Getting and installing modules is easier than ever with the PowerShell Gallery and PowerShellGet. Instead of downloading and extracting files into your PowerShell modules directory, a simple call to Install-Module takes care of everything for you. Today I’ve published my WintellectPowerShell module. Now you can install and get started setting up Visual Studio to access symbol server, source servers, and many other cmdlets for debugging support. All you need to do with PowerShell 5.0 (or by adding the Package Management Preview to PowerShell versions 3 or 4) is issue the following command:
If you haven’t heard of WintellectPowerShell, here are all the commands it offers.
When debugging a nasty problem in your code, one of the most helpful things you can get is a minidump. With that picture of what your app was doing at the time of the crash, hang, or when the memory started spiking, you’ve got a big hint to jumpstart your exploring. While there’s a bunch of tools out there, such as the wonderful ProcDump, and the debuggers themselves to create minidumps, the real moment of truth is when you have to look at those minidump. That’s easy to do with one or two, but what happens if you have 200? In my line of work, where I debug other’s software problems (and will be glad to help you with yours), I’m routinely faced with hundreds of dumps from a client. As much as I would like to carefully open each minidump and lovingly type the same commands over and over for the greatest consulting billing statement ever, I just can’t get my clients to pay for that.
What I really need is a way to say, “Here’s a bunch of .DMP files; go run these WinDBG commands across all of them.” It turns out that accomplishing that basic task is not hard at all when you combine a little WinDBG knowledge with a little PowerShell magic.… Read more
As I was building up a moderately complicated pipeline in PowerShell, I was having some trouble and really wished there was a way to single step the pipeline so I could see the state of each item as it was processed. I wasn’t sure this was possible, but it is and I thought others might find it helpful. The magic is in the super powerful Set-PSBreakpoint cmdlet.
Because Set-PSBreakpoint can create breakpoints on not only lines and variable reads/writes, but also commands, I thought I’d try setting a breakpoint in the PowerShell console on one of the commands in the pipeline and it worked great! In the example below I will set a breakpoint on the Get-ChildItem cmdlet and when the breakpoint is hit, use the command line debugger to step through parts of the pipeline (the ‘s’ command is step into)
PowerShell scripts for better debugging and life! This module provides cmdlets for setting up symbol servers and other functionality related to debugging. This module makes setting up symbol servers and source server debugging functionality easier to control for Visual Studio 2010, Visual Studio 2012 and WinDBG. Setting up a development machine for symbol server access is more difficult than it needs to be but no more.
… Read more
Numerous times in the last month I’ve been working with different teams and when I whip out my PowerShell window and start doing all the magic, especially with Visual Studio command line tools, the young kids go crazy. The mix of command line development tools and PowerShell is a powerful aphrodisiac. Too bad that Visual Studio is living in the dark ages of batch files required to set various environment variables so everything works. The trick is getting those environment variables into PowerShell, which is not as easy as it should be.
For command line work, there’s two key batch files from Visual Studio that do the environment variables dance. The first is <VS Install Dir>\VC\VCVARSALL.BAT, which does the work to set up the PATH, LIB, INCLUDE, and other key environment variables. This is the batch file run when opening the Visual Studio Developer Command prompt and the other flavors of command prompts for ARM, cross compilers, etc. The second batch file is <VS Install Dir>\Team Tools\Performance Tools[\x64\]VSPerfCLREnv.cmd that you use to do command line profiling and code coverage, which again involves setting the PATH but also the key profiling environment variables that start with COR_*.
What we need is a seamless way to execute batch files so any environment variables that are added or removed automatically reflected in the PowerShell window.… Read more
When sampling profiling on Windows 8 or Server 2012, nothing looks different in Visual Studio 2012, but the entire insides of the profiling collector is completely changed. With the profiler now based on Event Tracing for Windows (ETW) everything is spiffy but PDB files are more important than ever. While I’m sure you are all using the Symbol Servers and have all symbols for the code you build, what about the binaries you didn’t build and was built on the server/user’s machine?
If you’re installing binaries in the Global Assembly Cache or running Native Generation (NGEN) to pre-JIT your binaries, that code generation is done on each machine so each machine has a unique copy of the binary. When profiling, you need the PDB files for those unique binaries to see the JIT’d methods show up in the sampling profiling. You’re probably thinking you are safe that since you are not putting anything in the GAC you can stop reading now. Sadly you have to keep reading because the .NET Framework itself is NGEN’d on each install so if you want to see where your calls into the .NET Framework are eating your time, you need to get those PDBs from that machine.… Read more
Working on a giant codebase recently, I needed to check if all C# projects had Code Analysis turned on for all configurations. Given there were easily 30 to 40 different .CSPROJ files I was so not looking forward to manually going through them all one at a time in Visual Studio to check. The .CSPROJ files are just XML files and PowerShell handles XML great, so 10 minutes of messing around and I had a nice one-liner that reported all the .CSPROJ file names and which configurations didn’t have Code Analysis enabled.
In the code above, I added a lot of line continuation characters so it was easier to read in the blog. Even if you haven’t done much PowerShell, it should be pretty easy to follow. Because PowerShell loves you, declaring a variable as means you get the automatic properties for elements and XML is a piece of cake. PowerShell for the win!
So now I have all the projects that need to be updated, but I still have to do that manually.… Read more
For some reason, I always seem to be looking for file and directory names. Since desktop search is a GUI and I’m a command line kind of guy, I got tired of waiting on PowerShell to slowly grind through the file system on its single thread. With lots of cores and an SSD, I shouldn’t be waiting on simple file finds! On a plane trip I threw together this command line tool to speed up my file finding and give me an extra five seconds each day I used to spend waiting on file searches to finish. This little program scratched my itch and maybe someone will find it useful.
You can search with wild cards as well as regular expressions and for as many patterns as you want. It will also handle directory names if you want. Yes, it’s a full featured fast file finder. Here are all the command line flags and usage instructions: