FIX: No metrics data is generated when you click "Calculate Code Metrics" in a .NET Framework 4-based WPF project if a partial class is used in the project

Symptoms

Consider the following scenario:
  • You create a Microsoft .NET Framework 4-based Windows Presentation Foundation (WPF) project.
  • You add some user code to a partial class in the project.
  • You select Microsoft All Rules in the Code Analysis property of the project.
  • You click the Calculate Code Metrics for Solution item or the Run Code Analysis item .
In this scenario, you do not receive messages as expected, or no metrics data is generated for the partial class.

Note:
The issue doesn't only occur in Code Metrics feature, but also it does in Code Analysis.

For example, when you run Code Analysis for the solution, you do not receive the following message if you add a System.Exception exception into the partial class: 
CA2201: Do not raise reserved exception types

Cause

This issue occurs because the compiler uses the GeneratedCodeAttribute attribute to mark the partial class. Therefore, functions of code analysis and of code metrics skip the partial class even though the class contains user code.

Resolution

Hotfix information

A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

To resolve this problem, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer Support Services telephone numbers and information about support costs, visit the following Microsoft website:Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.


Prerequisites

To apply this hotfix, you must have the .NET Framework 4 installed.

Restart requirement

You do not have to restart the computer after you install this hotfix if the affected files are not being used.

We recommend that you close all .NET Framework applications and Visual Studio instances before you install this hotfix.

File information

The global version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.

For all supported x86-based versions of Windows XP, of Windows Server 2003, of Windows Vista, of Windows Server 2008, and of Windows 7

File nameFile versionFile sizeDateTimePlatform
Presentationbuildtasks.dll4.0.30319.483599,91217-Jun- 201103:19x86
For all supported x64-based versions of Windows XP, of Windows Server 2003, of Windows Vista, of Windows Server 2008, of Windows 7, and of Windows Server 2008 R2

File nameFile versionFile sizeDateTimePlatform
Presentationbuildtasks.dll4.0.30319.483599,91217-Jun- 201103:19x64
For all supported IA-64–based versions of Windows Server 2003, of Windows Server 2008, and of Windows Server 2008 R2

File nameFile versionFile sizeDateTimePlatform
Presentationbuildtasks.dll4.0.30319.483599,91217-Jun- 201103:19IA-64

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
คุณสมบัติ

รหัสบทความ: 2563483 - การตรวจสอบครั้งสุดท้าย: 10 ส.ค. 2011 - ฉบับแก้ไข: 1

คำติชม