How To Debug PowerShell Core Binary Cmdlets
Just a few minor tweaks is all it takes to get going with PowerShell Core cmdlets. I just wish it was documented better....
Just a few minor tweaks is all it takes to get going with PowerShell Core cmdlets. I just wish it was documented better....
When writing sentences to a console window, by default, the text will wrap at the exact width of the current window. Unless your sentences happen to consistently have word boundaries at exactly the same intervals as the window width, your text will wrap right in the middle words…...
When I look at a class file, I will frequently collapse it down to its method signatures. Maybe I want to scan the file for a particular method. Maybe I want to get an overview of what functionality the class contains. Could be any number of reasons. Ultimately it’s a quick way to minimize the noise and isolate what I really want to see. In a C# class file, the noisiest bits - easily - are the XML comments that decorate everything from the class itself to all its containing methods and properties....
Without getting into all the whys and wtfs, the other day I had a need to dynamically render and inject html snippets into various webpages at runtime. The project I’m working on originally created the html in C# by concatenating string fragments and formatting them with runtime values. With all the requisite escape sequences needed to create valid html (including encapsulated JavaScript), this approach struck me as a bit messy and I decided to take a different route....
Getting the custom number format string for an Excel cell using OpenXml is not entirely intuitive. But once you understand how this information is laid out, it starts making sense....
How oh how is one to get XML from a local (not server) SSRS report? As it turns out, via Excel. The LocalReport.Render() method only supports Excel, PDF, and Image formats, but since the Excel 2007+ file format is just compressed XML, it didn’t take too much finagling to get what I was really after. The only thing I needed was the Microsoft OpenXml SDK, easily acquired through Nuget. This code snippet shows how to get the rendered values from a LocalReport in memory:...
For some odd reason, System.IO doesn’t include a method to get the UNC path for a file or directory. Even stranger, many code samples resort to using p/invoke in order to get that information. But then I came across this StackOverflow answer that explained a pure .NET way to do the same thing. I gave the original code a good refactoring and turned it into the extension method below. While the most obvious place to stick something like this is the Path class, since it’s static that’s not possible....
Today I encountered a very aggravating exception while playing back some coded ui tests. I consistently got a “Failed To Perform Action On Blocked Control Exception”. Yet nothing was blocking the row...