Monday, December 12, 2011
It's been a long time since I've done a post or had any motivation to do so. Much of that is due to events that turned my life upside-down for a time. However, I can concentrate on other things now that I'm shaking off the shackles and things are looking brighter.
With that in mind here are a couple of random tips for Visual Studio. These tips work specifically in Visual Studio 2010; however, it's possible they may be relevant to past and future versions.
Tip #1: Editor does not work correctly for CSHTML files
I frequently have the issue where backspaces and carriage returns stop working when I'm editing a CSHTML file. This appears to be a common bug in Visual Studio. The quickest way that I've found to temporarily resolve the bug is to go to a CS file (which I have open anyway), save it (whether it needs it or not), and then go back to the CSHTML file. At that point I have the use of those keys again.
Tip #2: Getting rid of the pesky validation errors for HTML 5
MVC 3 by default uses HMTL 5 markup. This includes tags such as section, header, and footer. Visual Studio by default uses a much older standard for validation. Therefore, you will get a bunch of warnings/errors such as:
Validation (XHMTL 1.0 Transitional): Element 'section' is not supported.
You can easily change the target for the validation in the Visual Studio options. In this case, I use the HTML 5 option in the HTML Validation settings. The path to this is: Tools > Options > Text Editor > HTML > Validation. Select the target from the drop-down list and then click OK.
Thursday, February 17, 2011
 |
I was honored today by the receipt of a 2011 Microsoft Community Contributor Award. Thank you to Microsoft and anyone involved in the nomination and award process.
|
Friday, January 28, 2011
In a previous post I reported an InvalidProgramException that occurs in a certain circumstance with unit tests involving accessors on a private generic method. It turns out that Bug #635093 reported through Microsoft Connect will not be fixed.
The reason cited is that private accessors have been discontinued. And why have private accessors been discontinued? They don't have time is the reason listed in the blog post titled "Generation of Private Accessors (Publicize) and Code Generation for Visual Studio 2010".
In my opinion, it's a piss poor decision to discontinue support for a feature that they're still using within automatically generated unit tests against private classes and methods. But, I think what is worse is the lack of guidance cited in the aforementioned blog post. Their advice? Use the PrivateObject to help, but develop your own framework.
At the end of the day what Microsoft is saying is, "I know you spent a lot of money for this product. I know that you don't have time to develop a framework to deal with this. We don't have time and that is all that's important."
Friday, January 07, 2011
There is a bug in the unit testing framework in Visual Studio 2010 with unit testing. The bug appears in a very special circumstance involving an internal generic type.
The bug causes the following exception to be thrown:
System.InvalidProgramException: JIT Compiler encountered an internal limitation.
This occurs under the following circumstances:
- Type being tested is internal or private
- Method being tested is generic
- Method being tested has an out parameter
- Type accessor functionality used to access the internal type
The exception is not thrown if the InternalsVisibleToAttribute is assigned to the source assembly and the accessor type is not used; nor is it thrown if the method is not a generic method.
Bug #635093 has been added through Microsoft Connect
Monday, August 30, 2010
NDepend is a Visual Studio add-in designed for intense code analysis with the goal of high code quality. NDepend uses a number of metrics and aggregates the data in pleasing static and active visual reports. My evaluation of NDepend will be broken up into several different parts.
The first part of my evaluation of NDepend is in the installation. The second part will cover my first impressions including the initial profiling for the solution that I will use throughout my evaluation. I used version 3.0.3 Professional in my testing.
Installation
I was given an XML file and pointed to a location to download the ZIP file containing the files. The first thing I noticed is that there is no installation program. The decision was made to use XCopy deployment. Personally, I think this is the wrong decision and when I sent a message to Patrick Smacchia he responded with a link to a discussion about this topic. Apparently, this is already a well covered issue that people have with this tool.
The people on the side of using XCopy deployment have some valid points; however, the highlighted point in the discussion is completely illogical. In it, the developer makes the comparison between having a Ferrari with an automatic transmission and an application with an installer. I had to shake my head at that and just move on.
Given that XCopy was my only choice I created my directory and unzipped the files to it. You also need to copy the XML file into the new directory although it's not indicated in the documentation (Mr. Smacchia said that will be fixed). The first file you'll want to look at is the quick start file (named QuickStartTutorial_NDepend.txt in my version). This file will guide you through the additional steps for setting up the add-in.
The next step will be run the add-in executable (named NDepend.Install.VisualStudioAddin.exe). This executable will perform the integration into Visual Studio. The version I tested supports 2005, 2008, and 2010. The tool is easy enough to use with simple Install and Uninstall buttons for each supported version of Visual Studio.
The tool also provides an option for Full Integration or Light Integration. There is no dedicated documentation for this tool or NDepend. Instead, tool tips are provided on special icons. Tool tips just cannot store enough information to make an informed decision. For instance, for Light Integration the tool tip says you won't have access to "all VisualNDepend panels in Visual Studio", but it fails to enumerate either what is missing or provided at that level. This is probably not a big deal, because most people are going to want Full Integration. My installation and therefore my evaluation is based off of the Full Integration.
It's also worth noting that there are two tools called Visual NDepend and NDepend.Console that you get. These applications allow you to perform code analysis outside of Visual Studio. Some people may prefer that based on some of the resource requirements of NDepend (which I'll get to in Part 2 of my evaluation that covers my first impressions).
All-in-all the installation was simple enough to justify XCopy deployment; however, I cannot shake the idea that it would seem that much more professional with an installer that would combine several manual steps into a single step. The space required for the installation is just shy of 20 MB.
Disclaimer: Patrick Smacchia contacted me about reviewing NDepend. I received a free license in return for sharing my experiences and talking about the capabilities of the add-in on this site. There is no expectation of a positive review elicited from the author of NDepend.
Resources:
Debate on using XCopy deployment with NDepend
Friday, July 16, 2010
I just resolved a problem where I could not download or install Windows sidebar gadgets in Windows 7. The behavior occurred as I entered the gallery and clicked Download. The popup appeared for the unverified publisher, but when I clicked Install nothing happened. There was no error or any other indication that it failed -- other than the gadget not being installed.
I couldn't find anything on the Internet about this problem that was remotely helpful. But, I narrowed it down to InPrivate Filtering. After I disabled InPrivate Filtering I was able to install the gadget.
This may or may not be a problem for most users with InPrivate Filtering. I have added a Registry key value so that my Internet Explorer sessions always start with InPrivate Filtering (by default you have to turn it on for each browser session).
Thursday, June 17, 2010
You'll quickly find out that enabling code coverage in Visual Studio 2010 has changed. With the new version you enable this functionality through the test settings. The following steps will enable code coverage:
- Open the local.testsettings which you can access from Test -> Edit Test Settings -> Local (local.testsettings)
- Select Data and Diagnostics from the list
- Select the Enabled checkbox on the Code Coverage row
- Double-click the Code Coverage row
- Select the assemblies you want to instrument
- Specify a re-signing key file if your assemblies are strong-named
- Click OK
- Click Apply
- Click Close
Friday, May 21, 2010
The Smart Client Software Factory (SCSF) for Visual Studio 2010 was uploaded tonight. You can get it, the source code, and the documentation on the patterns & practices page.
Note: Do not forget to "unblock" the documentation (CHM) file after you download it. To unblock it right click the file, choose Properties, and click the Unblock button.