A while ago I whipped up a small utility to search for filenames at the command line. I noticed recently that it did not handle long filenames over 260 (MAX_PATH) characters. Having a few spare minutes I updated FastFileFinder to use the Win32 API directly as the .NET Framework Directory methods do not have that support. Additionally, I took at idea from Josh Carroll and batched up the matching filename output to minimize the calls to Console.WriteLine.
With that little bit of work FastFileFinder is now 30%-50% faster! I haven’t looked too much harder but I think there’s some more speed up work that can be done. Are you up for the challenge? How much faster can you make it go?
Grab the code here: https://github.com/Wintellect/FastFileFinder
Grab the compiled binary here: https://github.com/Wintellect/FastFileFinder/releases/tag/v2.0… Read more
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.
On my production machine, my Apple MacBook Pro, I did an in place upgrade from Windows 8.1 to Windows 10. I ran into a couple of bumps and got them figured out so I thought I’d post this for others seeing the same problems. That way when combined with the power of Greyskull (AKA internet search engines) they can get answers if they hit the same issues.
The first issue I ran into had nothing to do with the MacBook Pro. I’d been short on disk space so pushed my 7 GB C:\Windows\Installer\$PatchCache$ directory to another drive with a directory link. That worked fine in Windows 8.1, but about 40% through the pre boot processing in Windows 10 setup I’d get the awesome “Something Happened” error. I’d made a strong mental note that I’d moved the $PatchCatch$ directory so that was the first thing I fixed. I had to make some room on the drive so did things like deleting my Outlook .OST file, which would get recreated the next time I started Outlook.
With 9 GB free on my C: drive, and $PatchCache$ in the proper location, I tried again. The upgrade was smooth sailing at that point. Once I logged into Windows 10, and deleted Windows.Old through the Disk Cleanup Utility, I was thrilled to see my 8 GB fee space had jumped to 19.2 GB.… Read more
How many clicks has this dialog eaten out of your life?
The idea for the warning is good because, you know, SECURITY. However, if you’re developing web apps or anything running in IIS, this gets old by the thousandth time you click the Attach button. It’s easy to turn off with an undocumented registry key. Make sure to shut down all instances of VS before changing this key as it will get overwritten on shutdown.
For Visual Studio 2015: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\Debugger
For Visual Studio 2013: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\Debugger
In the Debugger key, add a REG_DWORD value of DisableAttachSecurityWarning and set it to 1, and you now have one less click when you attach to a process.… Read more
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
Now that Visual Studio 2015 RC is fresh off the build machines and available for everyone, I’ve updated my Wintellect.Analyzers project (http://johnr.us/1bEO4h8) with full RC support. Go forth and add them to your project so you can get the benefit of advanced compiler analysis and code fixes. To add the analyzers, hit up your Package Manager Console with the following command:
I guess you could go through the fancy new NuGet window in Visual Studio, but you want to be hard core and use PowerShell in VS!
If you’re interested in writing your own analyzers, as I have discussed previously, you’re immediately going to run into errors and warnings with projects based off the default Roslyn template when you try to install your analyzer masterpiece. Here’s what you’ll see:
Attempting to gather dependencies information for package ‘Analyzer188.8.131.52’ with respect to project targeting ‘.NETPortable, Version=v4.5, Profile=Profile7’
Attempting to resolve dependencies for package ‘Analyzer184.108.40.206’ with DependencyBehavior ‘Lowest’
Resolving actions to install package ‘Analyzer220.127.116.11’
Resolved actions to install package ‘Analyzer18.104.22.168’
Adding package ‘Analyzer1 22.214.171.124’ to folder ‘c:\junk\code\Analyzer1\packages’
Added package ‘Analyzer1 126.96.36.199’ to folder ‘c:\junk\code\Analyzer1\packages’
Added package ‘Analyzer1 188.8.131.52’ to ‘packages.config’
Executing script file ‘c:\junk\code\Analyzer1\packages\Analyzer184.108.40.206.0\tools\install.ps1’
Get-ChildItem : Cannot find path ‘C:\junk\code\Analyzer1\packages\Analyzer220.127.116.11.0\tools\analyzers\C#’ because it does not exist.… Read more
My deep abiding love of Roslyn continues! I just published a new video Writing Roslyn Analyzers and Code Fixes up at WintellectNOW: https://www.wintellectnow.com/Videos/Watch?videoId=writing-roslyn-analyzers-and-code-fixes. My goal was to take you from zero knowledge of Roslyn to writing a real world analyzer and code fix in 1.5 hours. This video covers everything from using the Syntax Visualizer to developing and testing analyzers and code fixes. Along the way I show how I solved some of the hard real world issues you’ll encounter.
Given that there’s not a lot of documentation on Roslyn I thought this video would help get folks up to speed as we approach the release date for Visual Studio 2015. I would love to hear any and all constructive criticisms you have on the video. What did I do right, what did I do wrong, and what else do you want to see. Sign up for a free WintellectNOW account and post to the discussion area under the video.
Please note that we reserve the right to move the video to subscription required in the future. Given how new Roslyn and VS 2015 are at the time of recording we thought it was good to get the info out now.… Read more
The other day my co-worker Jeffrey Richter and I were discussing my latest infatuation, Roslyn analyzers. As we bounced around a few ideas one came to the forefront; every catch block should throw. This is not a hard and fast rule, but eating an exception, especially accidentally, has caused more bugs in .NET than we all care to count. My mind started spinning thinking that I want to see if I can automate checking for eaten exceptions in a Roslyn analyzer.
At first glance, the idea seems pretty easy. Look for the catch blocks and look to see if there are any throws, returns, or, goto statements. (Realizing that you can use a goto in a catch block made me involuntarily shudder.) Anyway, sketching through a quick algorithm of going about analyzing the syntax nodes made me realize there was going to be nothing quick about it. This was going to be a lot of work, especially when you really start thinking about all the ramifications. While I welcomed the challenge, I thought I better look deeper at the Roslyn API to see what it offers. Fortunately for everyone, there’s a super nice control flow analysis engine built right into Roslyn.… Read more
Mark your calendars for May 14-15, 2015 for the free 2015 Microsoft MVP Virtual Conference. This is a Microsoft sponsored conference where Microsoft Valuable Professionals (MVPs) will be presenting five different tracks for world wide consumption: IT Pro, Developer, Consumer, LATAM (Spanish), and Brazil (Portuguese). Obviously, I’ll be in the Developer track, but I’m really excited about the multiple language tracks. Making development and IT more welcoming to non-English speakers is awesome.
I’ll be presenting the following session. Go register today.
Roslyn for Normal Developers: It’s Not Just for Compiler Geeks!
You have no doubt heard about Roslyn, the new C# and VB.NET compilers in Visual Studio 2015, and you are probably wondering what they mean to you as a normal developer especially since you don’t have a PhD in Compilerology. In this demo only session you’ll see that no matter the type of .NET development you are doing, Roslyn will quickly become one of your favorite tools. You’ll learn how to leverage Roslyn analyzers and code fixers to fix problems in your team’s code as its being written. You’ve dreamed about having super smart editors that find the bugs before you check in and Roslyn is the answer!
After this session, you’ll know how to develop, test, and deploy your own Roslyn analyzers and code fixers to ensure your team is coding correctly and using your architecture the way you want all by leveraging the actual compiler.… Read more
Over the last few months I have been having a wonderful time developing Roslyn analyzers and code fixes. You can find all the Wintellect.Analyzers code at Wintellect’s GitHub page. If you would like to include these analyzers in your own Visual Studio 2015 CTP 6 project, install the NuGet package by executing the following in Visual Studio’s package manager console window:
Now that I’m getting more fluent in analyzers and code fixes I wanted to share some of the things I’ve learned to save you some time when you start doing your own in the future. First I’ll go over some of the new analyzers I’ve written. Next I’ll turn to the question of using analyzers and code fixes as NuGet packages vs. a Visual Studio VSIX. Finally, I’ll jump into some of the development aspects of analyzer and code fix development where I’ve had issues. Obviously, in that section, I’m assuming you know something about Roslyn and analyzer development. If this is all new to you Alex Turner’s two part series in MSDN Magazine gives you a solid understanding quickly: Part 1, Part 2.