Blog - Title

Visual Studio 2013 Current Status

  • The Ultimate Visual Studio Tips and Tricks Blog

    Visual Studio 2012 Update 1 (KB2707250): Bug Fixes

    • 13 Comments

    This post is a bit overdue but better late than never.  So let’s talk about Visual Studio Update 1…

     

    Soma originally introduced Update 1 in his November 26th post here:

    http://blogs.msdn.com/b/somasegar/archive/2012/11/26/visual-studio-2012-update-1-now-available.aspx

     

     

    Installation

    Since some of you may want to install this update immediately there are a few options for you. 

     

    From Visual Studio

    From inside the IDE, go to Tools | Extensions and Updates:

    image

     

    Then look under the updates section and install from there:

    image

     

     

    Via the Download Link Directly

    If you want a more direct route you can click this link:  http://go.microsoft.com/?linkid=9821199

    You will get this dialog and can just click Run to execute the small .EXE and begin the online install:

    SNAGHTML187699cf

     

     

    Stand-Alone Installation

    Although many believe you can only install via online resources this is actually not true.  A quick look at vsupdate_KB2707250.exe /? shows us the /layout switch:

    image

     

    So when I run vsupdate_KB2707250.exe /layout c:\ziptemp\vsup1 on my system this is the dialog I get:

    image

     

    This will download the source files to the designated location so you can make them available on a network share, thumb drive, or other media for stand-alone installation.

     

     

     

    Why Should I Care?

    The most obvious question is, “Why should I care?”  Despite the bug fixes and new features, this particular update represents a major shift in the timing for delivery.  We have now committed to a shorter update cycle so we can deliver critical fixes and incorporate new features more quickly.  What this means for you in real terms is that blocking issues may be resolved much more quickly and/or you will get a new feature that will help you get work done better/faster/stronger.

     

     

     

    What’s In it?

    So what exactly did we deliver?  Fundamentally there were two things we provided:  Bug Fixes and New Features.   You can find all the details here:

    http://support.microsoft.com/kb/2797915/EN-US

     

    I’m going to repeat the bug fixes here and then address the new features in another article right after this one.

     

    Bug Fixes

    After an extended period of time looking for the list of bug fixes included in the package I was initially unable to find a comprehensive list anywhere.  It looks like the team recognized there was a gap and updated the KB article on 1/13 to include all the relevant information.  I’ll just repeat the information here verbatim for convenience.

    ===

    Entity Framework Tools

    • Entity Framework designer may overwrite facets of C-Space properties based on facets of S-Space properties.
    • Build the solution fails after you add an empty ADO.NET Entity Data Model.
    • The .tt files stop generating after you nest an .edmx file under the project folder.

    ASP.NET Editor

    • HTML tag is not closed when you type a starting <script> tag in Visual Studio 2012.
    • IntelliSense gives a warning when you mix user controls and controls in a same tagPrefix node.
    • CSS code examples cannot work in .less files.
    • Visual Studio 2012 cannot insert a closing tag in HTML files automatically.

    Web Tools

    • Web Platform and Tools (WPT) packages are affected by a time stamp signing issue.
    • Dirty flag is displayed after you save a file in Visual Studio designer.
    • Too much memory is used after you add a new entity model that is generated from a database.
    • A local Internet Information Services (IIS) Express instance is displayed when you browse from a web page that is in a cloud service project.
    • "Application/JavaScript" content of JavaScript files is not registered to Visual Studio 2012.
    • Right-to-Left is not supported in JavaScript Windows Store app templates.
    • Visual Studio 2012 does not support the WinJS Software Development Kit (SDK).
    • Visual Studio 2012 crashes when you save a read-only manifest and then select Cancel to dismiss the dialog box.

    Web Publish

    • You cannot install the Web Deploy component when you set up Visual Studio 2012.
    • Web Tools Extensions (WTE) website publish operation does an unnecessary precompilation.

    Build Automation in TFS

    • A Build Scheduling job fails two times in TFS.
    • "TF50620: The Team Foundation identity scope A5BD927E-17AE-41F9-B8F3-34BE44653408 does not exist" error, and you cannot upgrade to Visual Studio 2012.1.
    • Message queue settings are lost.
    • You cannot scroll in web browsers for the summary and log views of build files in Team System Web Access (TSWA).

    Cloud Intelligence and Admin in TFS

    • Visual SourceSafe (VSS) installer compliance issues.
    • Visual Studio 2012.1 milestone information in ReleaseManifest.xml.
    • "Object doesn't support this property or method" error when you access the Team Profile page.

    Collaboration in TFS

    • PowerPoint Storyboarding stops working when you uninstall Visual Studio 2012.1.

    Services Framework in TFS

    • "An error occurred while executing the following script: upd_IdentitySnapshotToDev11M36.sql. Failed batch starts on the line 242. Statement line: 2." error when you attach a collection to a Visual Studio 2012.1 server.
    • You cannot upgrade to Visual Studio 2012 if the database collation name contains "90" and this instance is hosted on Microsoft SQL Server 2012.
    • Rebranded URLs (for example tfs.visualstudio.com) are not supported in the Visual Studio 2012 client.
    • "Exception of type 'Microsoft.TeamFoundation.Framework.Server.HostShutdownException' was thrown" error when you try to delete a project of an offline collection.
    • LocalScopeId value is not changed in tbl_GroupScope when you change the Server ID.
    • You cannot detach and reattach a cloned collection database instance, and it fails with an index violation.
    • Decreased performance when you use the complex identity or group membership topography.

    Version Control in TFS

    • Query plan in the prc_CheckIn process causes large memory estimates.
    • "Cannot insert NULL value (QU1)" exception in the TFS 2012 service, and the VC++ UpdateLocalVersion command fails.

    .NET Runtime

    • "Code Analysis errors of the same type - CA2149 Transparent code must not reference security critical items" error when you create a new application by using the default "Windows Phone XAML and Direct3D" project template.

    F#

    • The sort algorithm of the FSharp.Core.dll assembly may produce incorrect results, and you cannot deploy the applications that contains F# code to Windows Store.

    ClickOnce

    • "Not a valid Win32 application" error when you try to use ClickOnce to deploy a Windows Presentation Foundation (WPF) application to Windows XP.

    C++ Compiler

    • Incorrect code is generated for bit field swap on the ARM compiler.
    • Debug Interface Access (DIA) ARM stack unwinder displays empty stack when the CPU contains an invalid address.
    • WinCE default entry point is _stdcall instead of _cdecl.
    • The image base symbol name of WinCE is ImageBase instead of CeImageBase.
    • Single VC++ file takes a long time to compile.
    • No sign targets are called for the vcredist_x86, vcredist_x64, or vcredist_arm files.

    Installation

    • "Microsoft XP support for Visual Studio" error when you install the XP targeting package.

    C++ Editor

    • You may lose the property sheet changes in Property Manager.
    • "Exception 0xC0000005; SQLCEOLEDB40.DLL!unloaded" error when you run VC++ applications in Visual Studio 2012.
    • "Exception 0xC0000005;MICROSOFT.VISUALSTUDIO.CPPSVC.INTERNAL.DLL!" error when you run VC++ applications in Visual Studio 2012.
    • You encounter a deadlock between the Devenv.exe and VCPkgSrv.exe files.
    • VC++ project system does not support transitive closure of SDKs.

    Standard C++ Library

    • Potential branding issue during installation.
    • Application intermittently crashes when you create an async operation with Parallel Patterns Library (PPL).

    C Runtime (CRT)

    • Replace mempcy function for ARM CPU with a faster version from Windows.

    Visual Studio Fundamentals

    • NetFx payloads are not the re-signed version in TFS and in team agents.
    • Test professional and feedback client Stock Keeping Unit (SKU) are not included in the list of the Visual Studio 2012.1 bundle.
    • The message on the Visual Studio 2012.1 "uninstall finished" page uses the information icon instead of the warning icon.
    • ProjectReference and SKURef are not updated for the Visual Studio 2012.1 MSP with WDExpress core MSI file.
    • Visual Studio 2012 does not contain the TFS_ServerCore.msi package.
    • Threaded wait dialog title bar colors do not work well with a custom Microsoft Visual Studio 2010 color theme.

    Visual Studio IDE

    • Crash occurs when you try to close Visual Studio 2012.
    • "Exception 0xC0000005; DEVENV.EXE!CDevEnvAppId::Run" error when you change the default installation path in Visual Studio 2012.
    • Chrome does not automatically appear in the list of the Browse With dialog in Visual Studio 2012.
    • You cannot start .VSIX setups after you install the July 2012 update in Visual Studio 2012 RC.

    Localization

    • Some IntelliSense texts are not translated.

    ASP.NET Data

    • Data Sources window is disabled after you build a project. Additionally, a "data sources are not supported by the current project" warning is displayed.

    Code Analysis

    • "MSBuild could not locate the Code Analysis tool" error when you run code analysis in Visual Studio Express 2012 for Windows Desktop.

    Agile

    • No feedback when you cannot create stubs or shims for an assembly by using the Fakes function.

    My Work

    • You encounter crash and data loss issues in the code review workflow.
    • The work items that are under the selected area path do not show in the "Available Work Items" section of MyWork.
    • The feature enablement infobar does not go away when you upgrade TFS 2010 to TFS 2012.

    Debugger

    • 764861: Visual Studio 2012 crashes when you try to debug a native x32-based application.

      (http://connect.microsoft.com/VisualStudio/feedback/details/764861)

    • 760468: The remote endpoint is not reachable, and you cannot start or attach the debugger in Visual Studio 2012.

      (https://connect.microsoft.com/VisualStudio/feedback/details/760468)

    • "Exception 0xC0000005;VSDEBUGENG.MANIMPL.DLL!" error when you debug an application in Visual Studio 2012.
    • The application may crash or data corruption occurs when you debug optimized native ARM-based binaries.
    • The brand name is incorrect in the remote debugger installer dialog window.
    • "Exception rxoejih3rskjez4xxwpxudkcppwjodng; VSDEBUGPRESENTATIONPACKAGE.NI.DLL!" error when you debug an application in Visual Studio 2012.
    • You cannot debug ARM-based VC++ applications for late-breaking Windows hardware changes.
    • You cannot step in a dynamic SQL script file by using the debugger in Visual Studio 2012.
    • You cannot uninstall the app package after you debug an installed app package.
    • The Wait dialog box is not helpful when third-party networking software blocks local 64-bit debugging.

    IntelliTrace

    • "'Microsoft.VisualStudio.TraceLogPackage.TraceLogPackage, Microsoft.IntelliTrace.Package.11.0.0, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' package did not load correctly" error when you debug a new project in Visual Studio 2012.

    Code Map

    • Flag icons on Code Map are not updated.

    T4

    • You cannot debug the T4 template by using the Entity Framework templates.

    Lab Manager

    • You cannot create network isolation environments on Microsoft Windows 2008 R2 Service Pack 1 (SP1) hosts.
    • You cannot create the TestEnvironment.xml file by using Build Verification Testing (BVT) scripts.
    • LoadTestScenario case fails in the BVT rolling build.
    • "Specified cast is not valid" exception when you try to stop recording for an editing task scenario.
    • You cannot obtain VC++ runtime from Visual Studio 2012 remote store.
    • Test-signing time is too long in Visual Studio 2012.

    ===

  • The Ultimate Visual Studio Tips and Tricks Blog

    How to Convert Tabs to Spaces and Vice Versa

    • 10 Comments

    Menu:  Edit -> Advanced -> Tabify Selected Lines; Edit -> Advanced -> Untabify Selected Lines
    Command:  Edit.TabifySelectedLines; Edit.UntabifySelectedLines;Edit.ConvertTabsToSpaces;Edit.ConvertSpacesToTabs
    Versions:  2008,2010
    Published:  3/14/2010
    Code:  vstipEdit0028

     

    Some people prefer spaces, others prefer tabs.  Well you can have it any way you want it with this next item.  You can convert spaces to tabs and convert tabs to spaces on your selected lines.  There are a couple of ways to do this and each has different results:

     

    Tabify / Untabify

    If all you want to do is convert leading spaces to tabs (or vice versa) then you would use the Tabify/Untabify commands.  First, start out with a line with some leading spaces (NOTE:  You don't have to select the entire line for this to work as long as any part of the line is selected it will perform the action):

    image

     

    Now go to Edit -> Advanced -> Tabify Selected Lines:

    image

     

    And you should get the leading spaces converted to tabs:

    image

     

    Obviously, to change leading tabs to spaces you would use Untabify Selected Lines:

    image

     

     

    ConvertSpacesToTabs / ConvertTabsToSpaces

    Okay, so what if you want ALL spaces to tabs?  Well you have to use a command to do that and will have to make a custom keyboard mapping.  The commands you are interested in are Edit.ConvertTabsToSpaces and Edit.ConvertSpacesToTabs.  Here is what ConvertSpacesToTabs does to our example (NOTE: For these commands you have to select everywhere you want to convert it will not automatically convert the entire line in case you just want to convert a part of the line):

    image

     

    As you can see, almost all spaces are converted to tabs.  Since spaces are converted to tabs in increments of 4, if you have, say, 6 spaces it will result in a tab and 2 spaces left over.  That is why there are some left over spaces in the example.  And, naturally, if we select these lines and run ConvertTabsToSpaces this will be the result:

    image

     

    And now you know how to convert tabs to spaces and spaces to tabs.  Have fun! 

  • The Ultimate Visual Studio Tips and Tricks Blog

    View White Space

    • 11 Comments

    Keyboard:  CTRL + R, CTRL + W
    Menu:  Edit -> Advanced -> View White Space
    Command:  Edit.ViewWhiteSpace
    Versions:  2008,2010
    Published:  4/9/2010
    Code:  vstipEdit0043

    I've hijacked today's tip to remind everyone that next Monday I will start giving away $100 ThinkGeek gift certificates (one every day for about 30 days).  For details of my evil plan, go here.  Also, make sure to sign up for a Visual Studio Launch event in your area.  Happy coding!

    Download the seriously cool Tip of the Day Extension to get the daily tips delivered to your Start Page!

     

    Ever want to see the white space you are working with?  Maybe you want to know if your spaces are tabs or you have extra spaces on lines.  It's easy to view white space.  Just go to Edit -> Advanced -> View White Space (CTRL + R, CTRL + W) to go from this:

    image

     

    To this:

    image

  • The Ultimate Visual Studio Tips and Tricks Blog

    AutoRecover

    • 30 Comments

    Menu:  Tools -> Options -> Environment -> AutoRecover
    Versions:  2008,2010,2012,2013
    Published:  6/30/2010
    Code:  vstipEnv0019

     

    =====

    WARNING: Read the comments associated with this post as there are multiple complaints that this features doesn't work as expected. Read this thread from the engineering folks about usage with versions VS2010 and older.

    http://connect.microsoft.com/VisualStudio/feedback/details/731561/autorecover-on-new-files-does-not-work

    =====

     

    Perhaps your best friend is the AutoRecover feature.  It can be a real life saver if the dev environment crashes or there is a power outage or a meteor hits your cube (okay, maybe not that last one).  It's very simple to use, just go to Tools -> Options -> Environment -> AutoRecover:

    image

     

    If you want to turn this feature off you can deselect the "Save AutoRecover information every" checkbox.  Of course, if you do this we will all laugh at you when you lose important work because you didn't have it and I will personally blog about it so everyone knows--you might want to leave it on--just saying.  Here is what the other options do:

     

    X minutes - determines how often files have AutoRecover information saved.  The default is 5 minutes but you can adjust up or down depending on usage.  There is an inverse relationship between this value and the frequency of your updates to code.  If you make more frequent updates to code then have a lower number here.  Fewer updates to code mean you can increase this number if you desire.  If you are going to make a mistake here make it on the side of a number that is too low rather than too high.  It's better to take any performance hit from file I/O than to lose a ton of work.

     

    X days - used to decide how long AutoRecover files are kept in the Backup Files directory.  The default is 7 days which is usually adequate for most situations.  If you work with a lot of projects over a short period of time then you may want to decrease this number to keep the Backup Files directory more clear.  If you are going to guess on this value then it's better to guess high and lower the number as needed. 

     

     

     

    Let's be clear on what a is exactly saved and where it is saved.  First, recovered files are stored at \...\My Documents\Visual Studio <version>\Backup Files\<projectname>.  Not every file is saved here.  Let me show you an example:

     

    Here is the backup folder for one of my solutions when I create it in Visual Studio:

    image

     

    Obviously the folder is empty.  Now let me make a change to a file and save the change.  Then I'll wait 5 minutes to see the result:

    image

     

    Still nothing because there is no need to recover a saved file.  But let me make a change to a file without saving it and wait another 5 minutes:

    image

     

    NOW we have AutoRecover information because if there is crash we will have to make a decision to recover the unsaved changes or keep the last saved version.  This is essentially the function of AutoRecover.

     

     

     

    When you do finally have to recover a file, this is the dialog you will get:

    image

     

     

     

     

    Recovered files - lists the file(s) that can be recovered with a a checkbox to select/deselect the file as well as basic information.

     

    <File Name> Summary - shows detailed information about the currently selected file including date/time info, location of the backup file, and destination location where the file will be recovered to.

     

    Recover Selected Files - performs a recovery action on the file(s) selected copying the recovered source file to the previously indicated destination.

     

    Do Not Recover - closes the dialog box without recovering any of the files listed.

  • The Ultimate Visual Studio Tips and Tricks Blog

    Navigate Backward and Navigate Forward

    • 6 Comments

    Keyboard:  CTRL + -; CTRL + SHIFT + - 
    Menu:  View -> Navigate Backward; View -> Navigate Forward
    Command:  View.NavigateBackward; View.NavigateForward
    Versions:  2008,2010
    Published:  3/1/2010
    Code:  vstipEdit0024

     

    image

     

    The editor remembers locations when you move in a single command more than several lines away from where you are currently working, or if you edit in a particular location that is not adjacent to the last place you edited.

     

    The goal is to remember interesting locations so that you can recall where you have been working without remembering so many locations the feature is not useful (such as every character typed, or every line entering several new lines of code one right after the other).

     

    A go-back marker is dropped under the following conditions:

    • An incremental search (including reverse) leaves a go-back marker at the beginning of the search and another one at the end.

    • A Go To Line action, like CTRL + G, or a mouse-click that moves the cursor 11 lines or more from the current position drops a go-back marker at the new location.

    • A destructive action (like hitting Backspace) after having moved the cursor to a new location drops a go-back marker.

    • Doing a search, like Ctrl+F, drops a go-back marker at the found location.

    • Opening a file drops a go-back marker wherever the cursor was on the old file and drops another on the opened file.

     

    So with all that, welcome back to the wonderful world of the Navigate buttons (and keyboard shortcuts, too)!  These gems make travelling around your code much, much easier:

    image

  • The Ultimate Visual Studio Tips and Tricks Blog

    Track Active Item in Solution Explorer

    • 16 Comments

    Menu:  Tools -> Options -> Projects and Solutions –> General
    Commands:  View.TrackActivityinSolutionExplorer
    Versions:  2005,2008, 2010
    Published:  3/29/2010
    Code:  vstipProj0011

     

    Note: Several people have asked if you can turn this feature on and off at will. You can if you bind the View.TrackActivityinSolutionExplorer command to a keyboard shortcut.

     

    By default, VS2010 will track the current file you are editing in Solution Explorer.  It looks like this:

    image

     

     

    Notice that the current file being edited is also selected in Solution Explorer automatically.  This is a great way to keep track of where you are in the solution when you are working with a lot of files.  You can turn it off if you want.  Just go to Tools -> Options -> Projects and Solutions -> General -> "Track Active Item in Solution Explorer" and uncheck the option to turn this feature off.

    image

  • The Ultimate Visual Studio Tips and Tricks Blog

    Vista Activation

    • 1 Comments

    If you haven't come across this yet you will at some point.  There is a known issue with Vista and activation.  You can get the details for common errors at this KB article, but the steps are pretty straightforward:

    1) Go to Control Panel...System and Maintainence...System

    2) Scroll to the bottom of the screen

    3) Click on Change Product Key

    4) Type in your key

    5) Click Next and follow the rest of the steps in the wizard

     

    That's it!   Soon you'll be enjoying Vista and be activated :)

  • The Ultimate Visual Studio Tips and Tricks Blog

    VMDK(VMWare) to VHD Converter

    • 1 Comments

     

    Several people have asked me how to convert from VMWare to VHD format.  Here are the steps to get you going:

     

    1) Download VMDK to VHD converter free tool from http://vmtoolkit.com/files/folders/converters/entry8.aspx   I had successfully converted disks 29Gb in size

     

    2) “Prepare” your VMWare image by following steps in  http://searchservervirtualization.techtarget.com/tip/0,289483,sid94_gci1239063,00.html or  http://www.jaylee.org/post/2008/10/How-to-convert-a-big-VMWare-VMDK-into-an-Hyper-V-VHD.aspx

    3) Install Virtual Server 2005 (Std/Ent, R2 or not – but if R2, select Enterprise and install the one with SP1 – it’s all free and on the web…)

     

    4) Make sure your VMWare image contains at least one IDE drive before final shutdown (VS2005 will need it). Take note of drives inside VM (C,D,E…)

     

    5) Convert each one VMW files into VHD

     

    6) Attach “system” disk as a main disk in new Virtual Server image

     

     

     

    NOTE:  You could roll out Virtual Machine Manager and use the “conversion” feature in one step instead of six.

     

    Thanks to Oleg Kofman from MS who provided me this info...

  • The Ultimate Visual Studio Tips and Tricks Blog

    Hide or Show the Solution File in Solution Explorer

    • 6 Comments

    Menu:  Tools -> Options -> Projects and Solutions -> General
    Versions:  2008,2010
    Published:  3/26/2010
    Code:  vstipProj0008 

     

    If you don't like seeing the solution file in Solution Explorer, you can easily hide it (or show it if you have it hidden).  First, let's review what the default looks like with the solution file showing:

    image

     

    Now if we go to Tools -> Options -> Projects and Solutions -> General and uncheck "Always show solution":

    image

     

    This is the result:

    image

     

    SPECIAL NOTE:  This only works when there is one project in the solution.  If you have multiple projects in your solution it will ignore this setting and give you the default view.

  • The Ultimate Visual Studio Tips and Tricks Blog

    Code Metrics – Class Coupling

    • 3 Comments

    SKU: Premium, Ultimate

    Versions: 2008, 2010

    Code: vstipTool0133

     

     

    As we continue looking at code metrics in Visual Studio (see vstipTool0129, “Calculating Metrics”), it’s time to look at class coupling. Class coupling also goes by the name Coupling Between Objects (CBO) as originally defined by [CK94]. Basically, class coupling is a measure of how many classes a single class uses. A high number is bad and a low number is generally good with this metric. Class coupling has been shown to be an accurate predictor of software failure and recent studies have shown that an upper-limit value of 9 is the most efficient [S2010].

     

    According to the MSDN documentation, class coupling “[m]easures the coupling to unique classes through parameters, local variables, return types, method calls, generic or template instantiations, base classes, interface implementations, fields defined on external types, and attribute decoration. Good software design dictates that types and methods should have high cohesion and low coupling. High coupling indicates a design that is difficult to reuse and maintain because of its many interdependencies on other types.”

     

    The concepts of coupling and cohesion are clearly related. To keep this discussion on topic, I will not get into depth with cohesion other than to give a brief definition from [KKLS2000]:

    “Module cohesion was introduced by Yourdon and Constantine as ‘how tightly bound or related the internal elements of a module are to one another’ [YC79]. A module has a strong cohesion if it represents exactly one task […], and all its elements contribute to this single task. They describe cohesion as an attribute of design, rather than code, and an attribute that can be used to predict reusability, maintainability, and changeability.”

     

     

    Class Coupling Example

    Let’s look at class coupling in action. First, create a new console application and create a new class called Person with some properties in it then immediately calculate the code metrics:

    image

     

    Notice the class coupling is 0 since this class doesn’t use any other classes. Now create another class called PersonStuff with a method that creates an instance of Person and sets the property values. Calculate the code metrics again:

    image

     

    See how the class coupling value goes up? Also notice that, no matter how many properties we set, the class coupling value just goes up by 1 and not by some other value. Class coupling measures each class only once for this metric no matter how much it is used. In addition, can you see that DoSomething() has a 1 but the constructor, PersonStuff(), has a 0 for its value? Currently there is no code in the constructor that is using another class.

     

    What if we put code in the constructor that used another class? Here is what you get:

    image

     

    Now the constructor clearly has code that uses another class and the class coupling metric shows this fact. Again, you can see the overall class coupling for PersonStuff() is 1 and DoSomething() is also 1 to show that only one external class is being used no matter how much internal code we have that uses it.

     

    Next, let’s create another new class. I’ll call my class Blah and create some properties inside it:

    image

     

    Now consume the class in our DoSomething() method within the PersonStuff class and calculate code metrics again:

    image

     

    As you can see, the class coupling for the PersonStuff class goes up to 2 and, if we drill into the class, we can see that the DoSomething() method has the most coupling in it but the constructor still only consumes 1 class.  Using these metrics we can see the overall max number for a given class and drill down into the details on a per-member basis.

     

     

    The Magic Number

    As I mentioned with cyclomatic complexity (see vstipTool0131, “Code Metrics - Cyclomatic Complexity”), there is no limit that fits all organizations. However, [S2010] does indicate that a limit of 9 is optimal:

    “Therefore, we consider the threshold values […] as the most effective. These threshold values [for a single member] are CBO = 9[…].” (emphasis added)

     

     

    Code Analysis

    When using code analysis, the Extended Design Guideline rule set contains a maintainability area:

    image

     

    Inside the maintainability area is a rule for class coupling:

    image

     

    This rule issues a warning when the class coupling is excessive. You can learn more about the rule here:

    http://msdn.microsoft.com/en-us/library/bb397994.aspx

     

    Unfortunately, the documentation doesn’t talk about the thresholds set for this rule but I did find a description on the Code Analysis Team Blog (http://blogs.msdn.com/b/codeanalysis/archive/2007/11/15/code-metrics-as-check-in-policy.aspx): “Warning at above 80 for class and above 30 for a method”.  These seem abnormally high but at least provide an extreme upper limit. If you hit this warning then something is almost certainly wrong.

     

     

    Citations

    [CK94]

    Chidamber, S. R. & Kemerer, C. F. (1994). A Metrics Suite for Object Oriented Design (IEEE Transactions on Software Engineering, Vol. 20, No. 6). Retrieved May 14, 2011, from the University of Pittsburgh web site: http://www.pitt.edu/~ckemerer/CK%20research%20papers/MetricForOOD_ChidamberKemerer94.pdf

     

    [KKLS2000]

    Kabaili, H., Keller, R., Lustman, F., and Saint-Denis, G. (2000). Class Cohesion Revisited: An Empirical Study on Industrial Systems (Proceedings of the Workshop on Quantitative Approaches in Object-Oriented Software Engineering). Retrieved May 20, 2011, from Université de Montréal web site http://www.iro.umontreal.ca/~sahraouh/qaoose/papers/Kabaili.pdf

     

    [SK2003]

    Subramanyam, R. & Krishnan, M. S. (2003). Empirical Analysis of CK Metrics for Object-Oriented Design Complexity: Implications for Software Defects (IEEE Transactions on Software Engineering, Vol. 29, No. 4). Retrieved May 14, 2011, from University of Massachusetts Dartmouth web site http://moosehead.cis.umassd.edu/cis580/readings/OO_Design_Complexity_Metrics.pdf

     

    [S2010]

    Shatnawi, R. (2010). A Quantitative Investigation of the Acceptable Risk Levels of Object-Oriented Metrics in Open-Source Systems (IEEE Transactions on Software Engineering, Vol. 36, No. 2).

     

    [YC79]

    Edward Yourdon and Larry L. Constantine. Structured Design. Prentice Hall, Englewood Cliffs, N.J., 1979.

Page 3 of 135 (1,345 items) 12345»