Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
Expand All @@ -14,7 +15,7 @@ namespace Microsoft.CodeAnalysis.CSharp.FxCopAnalyzers.Usage
/// <summary>
/// CA2231: Overload operator equals on overriding ValueType.Equals
/// </summary>
[ExportCodeFixProvider(CA2231DiagnosticAnalyzer.RuleId, LanguageNames.CSharp)]
[ExportCodeFixProvider(CA2231DiagnosticAnalyzer.RuleId, LanguageNames.CSharp), Shared]
public class CA2231CSharpCodeFixProvider : CA2231CodeFixProviderBase
{
internal override Task<Document> GetUpdatedDocumentAsync(Document document, SemanticModel model, SyntaxNode root, SyntaxNode nodeToFix, string diagnosticId, CancellationToken cancellationToken)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Composition;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Usage;

namespace Microsoft.CodeAnalysis.CSharp.FxCopAnalyzers.Usage
{
[ExportCodeFixProvider("CA2237 CodeFix provider", LanguageNames.CSharp)]
[ExportCodeFixProvider("CA2237 CodeFix provider", LanguageNames.CSharp), Shared]
public class CA2235CSharpCodeFixProvider : CA2235CodeFixProviderBase
{
protected override SyntaxNode GetFieldDeclarationNode(SyntaxNode node)
Expand Down
1 change: 1 addition & 0 deletions Src/Diagnostics/FxCop/CSharp/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.Immutable" version="1.1.20-beta" targetFramework="net45" />
<package id="Microsoft.Composition" version="1.0.27" targetFramework="net45" />
<package id="Microsoft.Net.ToolsetCompilers" version="0.7.4092303-beta" targetFramework="net45" />
<package id="StyleCop.MSBuild" version="4.7.48.2" targetFramework="net45" developmentDependency="true" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected sealed override string GetCodeFixDescription(string ruleId)
//// return FxCopFixersResources.EnumsShouldZeroValueNotFlagsNoZeroValueCodeFix;

//// default:
//// throw Contract.Unreachable;
//// throw ExceptionUtilities.Unreachable;
////}

throw new NotImplementedException();
Expand Down Expand Up @@ -217,7 +217,7 @@ internal sealed override Task<Document> GetUpdatedDocumentAsync(Document documen
//// return GetUpdatedDocumentForRuleNameNoZeroValue(document, root, nodeToFix, enumType, cancellationToken);

default:
throw Contract.Unreachable;
throw ExceptionUtilities.Unreachable;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -16,7 +17,7 @@ namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Design
/// <summary>
/// CA1012: Abstract classes should not have public constructors
/// </summary>
[ExportCodeFixProvider(CA1012DiagnosticAnalyzer.RuleId, LanguageNames.CSharp, LanguageNames.VisualBasic)]
[ExportCodeFixProvider(CA1012DiagnosticAnalyzer.RuleId, LanguageNames.CSharp, LanguageNames.VisualBasic), Shared]
public sealed class CA1012CodeFixProvider : CodeFixProviderBase
{
public sealed override ImmutableArray<string> GetFixableDiagnosticIds()
Expand Down
23 changes: 21 additions & 2 deletions Src/Diagnostics/FxCop/Core/FxCopRulesDiagnosticAnalyzers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<Project>{1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}</Project>
<Name>CodeAnalysis</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Workspaces\Core\Workspaces.csproj">
<ProjectReference Include="..\..\..\Workspaces\Core\Portable\Workspaces.csproj">
<Project>{5F8D2414-064A-4B3A-9B42-8E2A04246BE5}</Project>
<Name>Workspaces</Name>
</ProjectReference>
Expand All @@ -41,7 +41,26 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "></PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Composition.AttributedModel, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Convention, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Hosting, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Runtime, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Composition.TypedParts, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Collections.Immutable;
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
Expand All @@ -10,7 +11,7 @@ namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Performance
/// <summary>
/// CA1821: Remove empty finalizers
/// </summary>
[ExportCodeFixProvider(CA1821DiagnosticAnalyzerRule.RuleId, LanguageNames.CSharp, LanguageNames.VisualBasic)]
[ExportCodeFixProvider(CA1821DiagnosticAnalyzerRule.RuleId, LanguageNames.CSharp, LanguageNames.VisualBasic), Shared]
public sealed class CA1821CodeFixProvider : CodeFixProviderBase
{
public sealed override ImmutableArray<string> GetFixableDiagnosticIds()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.Diagnostics;
using System.Linq;
using System.Threading;
Expand All @@ -15,7 +16,7 @@

namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Usage
{
[ExportCodeFixProvider("CA2229 CodeFix provider", LanguageNames.CSharp)]
[ExportCodeFixProvider("CA2229 CodeFix provider", LanguageNames.CSharp), Shared]
public sealed class CA2229CodeFixProvider : CodeFixProviderBase
{
public sealed override ImmutableArray<string> GetFixableDiagnosticIds()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Collections.Immutable;
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
Expand All @@ -10,7 +11,7 @@

namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Usage
{
[ExportCodeFixProvider("CA2237 CodeFix provider", LanguageNames.CSharp, LanguageNames.VisualBasic)]
[ExportCodeFixProvider("CA2237 CodeFix provider", LanguageNames.CSharp, LanguageNames.VisualBasic), Shared]
public sealed class CA2237CodeFixProvider : CodeFixProviderBase
{
public sealed override ImmutableArray<string> GetFixableDiagnosticIds()
Expand Down
1 change: 1 addition & 0 deletions Src/Diagnostics/FxCop/Core/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.Immutable" version="1.1.20-beta" targetFramework="net45" />
<package id="Microsoft.Composition" version="1.0.27" targetFramework="net45" />
<package id="Microsoft.Net.ToolsetCompilers" version="0.7.4092303-beta" targetFramework="net45" />
<package id="StyleCop.MSBuild" version="4.7.48.2" targetFramework="net45" developmentDependency="true" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@
<Project>{76C6F005-C89D-4348-BB4A-391898DBEB52}</Project>
<Name>TestUtilities</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Workspaces\CSharp\CSharpWorkspace.csproj">
<ProjectReference Include="..\..\..\Workspaces\CSharp\Portable\CSharpWorkspace.csproj">
<Project>{21B239D0-D144-430F-A394-C066D58EE267}</Project>
<Name>CSharpWorkspace</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Workspaces\VisualBasic\BasicWorkspace.vbproj">
<ProjectReference Include="..\..\..\Workspaces\VisualBasic\Portable\BasicWorkspace.vbproj">
<Project>{57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C}</Project>
<Name>BasicWorkspace</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Workspaces\Core\Workspaces.csproj">
<ProjectReference Include="..\..\..\Workspaces\Core\Portable\Workspaces.csproj">
<Project>{5F8D2414-064A-4B3A-9B42-8E2A04246BE5}</Project>
<Name>Workspaces</Name>
</ProjectReference>
Expand Down Expand Up @@ -141,7 +141,6 @@
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<Project>{36755424-5267-478C-9434-37A507E22711}</Project>
<Name>FxCopRulesDiagnosticAnalyzers</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Workspaces\Core\Workspaces.csproj">
<ProjectReference Include="..\..\..\Workspaces\Core\Portable\Workspaces.csproj">
<Project>{5F8D2414-064A-4B3A-9B42-8E2A04246BE5}</Project>
<Name>Workspaces</Name>
</ProjectReference>
Expand All @@ -59,7 +59,26 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Composition.AttributedModel, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Convention, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Hosting, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Runtime, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Composition.TypedParts, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
' Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

Imports System.Composition
Imports System.Threading
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.CodeFixes
Expand All @@ -12,7 +13,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Design
' <summary>
' CA1001: Types that own disposable fields should be disposable
' </summary>
<ExportCodeFixProvider(CA1001DiagnosticAnalyzer.RuleId, LanguageNames.VisualBasic)>
<ExportCodeFixProvider(CA1001DiagnosticAnalyzer.RuleId, LanguageNames.VisualBasic), [Shared]>
Public Class CA1001BasicCodeFixProvider
Inherits CA1001CodeFixProviderBase

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
' Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

Imports System.Composition
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.FxCopAnalyzers.Design
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Expand All @@ -8,7 +9,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Design
' <summary>
' CA1008: Enums should have zero value
' </summary>
<ExportCodeFixProvider("CA1008", LanguageNames.VisualBasic)>
<ExportCodeFixProvider("CA1008", LanguageNames.VisualBasic), [Shared]>
Public Class CA1008BasicCodeFixProvider
Inherits CA1008CodeFixProviderBase

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
' Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

Imports System.Collections.Immutable
Imports System.Composition
Imports System.Threading
Imports Microsoft.CodeAnalysis.CodeActions
Imports Microsoft.CodeAnalysis.CodeFixes
Expand All @@ -12,7 +13,7 @@ Imports Microsoft.CodeAnalysis.VisualBasic.Syntax

Namespace Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Design

<ExportCodeFixProvider(StaticTypeRulesDiagnosticAnalyzer.RuleNameForExportAttribute, LanguageNames.VisualBasic)>
<ExportCodeFixProvider(StaticTypeRulesDiagnosticAnalyzer.RuleNameForExportAttribute, LanguageNames.VisualBasic), [Shared]>
Public Class CA1052BasicCodeFixProvider
Inherits CodeFixProvider

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
' Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

Imports System.Composition
Imports System.Threading
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.FxCopAnalyzers.Design
Expand All @@ -10,7 +11,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Design
''' <summary>
''' CA2217: Do not mark enums with FlagsAttribute
''' </summary>
<ExportCodeFixProvider(EnumWithFlagsDiagnosticAnalyzer.RuleNameForExportAttribute, LanguageNames.VisualBasic)>
<ExportCodeFixProvider(EnumWithFlagsDiagnosticAnalyzer.RuleNameForExportAttribute, LanguageNames.VisualBasic), [Shared]>
Public Class EnumWithFlagsBasicCodeFixProvider
Inherits EnumWithFlagsCodeFixProviderBase

Expand All @@ -29,7 +30,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Design
End If
End If

Throw Contract.Unreachable
Throw ExceptionUtilities.Unreachable
End Function
End Class
End Namespace
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
' Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

Imports System.Composition
Imports System.Threading
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.CodeFixes
Expand All @@ -11,7 +12,7 @@ Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax

Namespace Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Globalization
<ExportCodeFixProvider(CA1309DiagnosticAnalyzer.RuleId, LanguageNames.VisualBasic)>
<ExportCodeFixProvider(CA1309DiagnosticAnalyzer.RuleId, LanguageNames.VisualBasic), [Shared]>
Public Class CA1309BasicCodeFixProvider
Inherits CA1309CodeFixProviderBase

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
' Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

Imports System.Composition
Imports System.Threading
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.CodeFixes
Expand All @@ -13,7 +14,7 @@ Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax

Namespace Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Globalization
<ExportCodeFixProvider(PInvokeDiagnosticAnalyzer.CA2101, LanguageNames.VisualBasic)>
<ExportCodeFixProvider(PInvokeDiagnosticAnalyzer.CA2101, LanguageNames.VisualBasic), [Shared]>
Public Class CA2101BasicCodeFixProvider
Inherits CA2101CodeFixProviderBase

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
' Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

Imports System.Composition
Imports System.Threading
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.CodeGeneration
Expand All @@ -8,7 +9,7 @@ Imports Microsoft.CodeAnalysis.FxCopAnalyzers.Performance
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax

Namespace Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Performance
<ExportCodeFixProvider(CA1813DiagnosticAnalyzer.RuleId, LanguageNames.VisualBasic)>
<ExportCodeFixProvider(CA1813DiagnosticAnalyzer.RuleId, LanguageNames.VisualBasic), [Shared]>
Public Class CA1813BasicCodeFixProvider
Inherits CA1813CodeFixProviderBase

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ Imports Microsoft.CodeAnalysis.Formatting
Imports Microsoft.CodeAnalysis.FxCopAnalyzers.Usage
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis.Shared.Extensions
Imports System.Composition

Namespace Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Usage
' <summary>
' CA2213: Disposable fields should be disposed
' </summary>
<ExportCodeFixProvider(CA2213DiagnosticAnalyzer.RuleId, LanguageNames.VisualBasic)>
<ExportCodeFixProvider(CA2213DiagnosticAnalyzer.RuleId, LanguageNames.VisualBasic), [Shared]>
Public Class CA2213BasicCodeFixProvider
Inherits CA2213CodeFixProviderBase

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
' Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

Imports System.Composition
Imports System.Threading
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.CodeFixes
Expand All @@ -11,7 +12,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Usage
' <summary>
' CA2231: Overload Operator equals on overriding ValueType.Equals
' </summary>
<ExportCodeFixProvider(CA2231DiagnosticAnalyzer.RuleId, LanguageNames.VisualBasic)>
<ExportCodeFixProvider(CA2231DiagnosticAnalyzer.RuleId, LanguageNames.VisualBasic), [Shared]>
Public Class CA2231BasicCodeFixProvider
Inherits CA2231CodeFixProviderBase

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
' Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

Imports System.Composition
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.FxCopAnalyzers.Usage

Namespace Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Usage
<ExportCodeFixProvider("CA2229 CodeFix provider", LanguageNames.VisualBasic)>
<ExportCodeFixProvider("CA2229 CodeFix provider", LanguageNames.VisualBasic), [Shared]>
Public Class CA2235BasicCodeFixProvider
Inherits CA2235CodeFixProviderBase

Expand Down
1 change: 1 addition & 0 deletions Src/Diagnostics/FxCop/VisualBasic/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.Immutable" version="1.1.20-beta" targetFramework="net45" />
<package id="Microsoft.Composition" version="1.0.27" targetFramework="net45" />
<package id="Microsoft.Net.ToolsetCompilers" version="0.7.4092303-beta" targetFramework="net45" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,34 @@
<Project>{DCC1F13B-F51C-445B-BDAE-92135BD58364}</Project>
<Name>RoslynDiagnosticAnalyzers</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Workspaces\Core\Workspaces.csproj">
<ProjectReference Include="..\..\..\Workspaces\Core\Portable\Workspaces.csproj">
<Project>{5F8D2414-064A-4B3A-9B42-8E2A04246BE5}</Project>
<Name>Workspaces</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Composition.AttributedModel, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Convention, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Hosting, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Runtime, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Composition.TypedParts, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup></ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Collections.Immutable;
using System.Composition;
using System.Diagnostics;
using System.Linq;
using System.Threading;
Expand All @@ -13,7 +14,7 @@
namespace Microsoft.CodeAnalysis.Performance
{
/// <summary>Provides a code fix for the EmptyArrayDiagnosticAnalyzer.</summary>
[ExportCodeFixProvider("CSharpEmptyArrayCodeFixProvider", LanguageNames.CSharp)]
[ExportCodeFixProvider("CSharpEmptyArrayCodeFixProvider", LanguageNames.CSharp), Shared]
public sealed class CSharpEmptyArrayCodeFixProvider : CodeFixProviderBase
{
public override ImmutableArray<string> GetFixableDiagnosticIds() { return ImmutableArray.Create(RoslynDiagnosticIds.UseArrayEmptyRuleId); }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Composition;
using System.Threading;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeFixes;
Expand All @@ -11,7 +12,7 @@

namespace Roslyn.Diagnostics.Analyzers.CSharp.Reliability
{
[ExportCodeFixProvider(RoslynDiagnosticIds.DirectlyAwaitingTaskAnalyzerRuleId, LanguageNames.CSharp)]
[ExportCodeFixProvider(RoslynDiagnosticIds.DirectlyAwaitingTaskAnalyzerRuleId, LanguageNames.CSharp), Shared]
public sealed class CSharpDirectlyAwaitingTaskFix : DirectlyAwaitingTaskFix<ExpressionSyntax>
{
protected override ExpressionSyntax FixExpression(ExpressionSyntax expression, CancellationToken cancellationToken)
Expand Down
1 change: 1 addition & 0 deletions Src/Diagnostics/Roslyn/CSharp/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.Immutable" version="1.1.20-beta" targetFramework="net45" />
<package id="Microsoft.Composition" version="1.0.27" targetFramework="net45" />
<package id="Microsoft.Net.ToolsetCompilers" version="0.7.4092303-beta" targetFramework="net45" />
<package id="StyleCop.MSBuild" version="4.7.48.2" targetFramework="net45" developmentDependency="true" />
</packages>
41 changes: 41 additions & 0 deletions Src/Diagnostics/Roslyn/Core/Reliability/AttributeHelpers.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;

namespace Roslyn.Diagnostics.Analyzers.Reliability
{
internal static class AttributeHelpers
{
internal static IEnumerable<AttributeData> GetApplicableAttributes(INamedTypeSymbol type)
{
var attributes = new List<AttributeData>();

while (type != null)
{
attributes.AddRange(type.GetAttributes());

type = type.BaseType;
}

return attributes;
}

internal static bool DerivesFrom(INamedTypeSymbol symbol, INamedTypeSymbol candidateBaseType)
{
while (symbol != null)
{
if (symbol.Equals(candidateBaseType))
{
return true;
}

symbol = symbol.BaseType;
}

return false;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;

namespace Roslyn.Diagnostics.Analyzers.Reliability
{
[DiagnosticAnalyzer]
public class MissingSharedAttributeAnalyzer : DiagnosticAnalyzer
{
public static DiagnosticDescriptor Rule = new DiagnosticDescriptor(
RoslynDiagnosticIds.MissingSharedAttributeRuleId,
RoslynDiagnosticsResources.MissingSharedAttributeDescription,
RoslynDiagnosticsResources.MissingSharedAttributeMessage,
"Reliability",
DiagnosticSeverity.Error,
isEnabledByDefault: true,
customTags: WellKnownDiagnosticTags.Telemetry);

public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
{
get
{
return ImmutableArray.Create(Rule);
}
}

public override void Initialize(AnalysisContext context)
{
context.RegisterCompilationStartAction(compilationContext =>
{
var exportAttribute = compilationContext.Compilation.GetTypeByMetadataName("System.Composition.ExportAttribute");
if (exportAttribute == null)
{
// We don't need to check assemblies unless they're referencing both MEFv2, so we're done
return;
}
compilationContext.RegisterSymbolAction(c => AnalyzeSymbol(c, exportAttribute), SymbolKind.NamedType);
});
}

private void AnalyzeSymbol(SymbolAnalysisContext symbolContext, INamedTypeSymbol exportAttribute)
{
var namedType = (INamedTypeSymbol)symbolContext.Symbol;
var namedTypeAttributes = AttributeHelpers.GetApplicableAttributes(namedType);

var exportAttributeApplication = namedTypeAttributes.FirstOrDefault(ad => AttributeHelpers.DerivesFrom(ad.AttributeClass, exportAttribute));

if (exportAttributeApplication != null)
{
if (!namedTypeAttributes.Any(ad => ad.AttributeClass.Name == "SharedAttribute" &&
ad.AttributeClass.ContainingNamespace.Equals(exportAttribute.ContainingNamespace)))
{
symbolContext.ReportDiagnostic(Diagnostic.Create(Rule, exportAttributeApplication.ApplicationSyntaxReference.GetSyntax().GetLocation()));
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;

namespace Roslyn.Diagnostics.Analyzers.Reliability
{
[DiagnosticAnalyzer]
public class MixedVersionsOfMefAttributesAnalyzer : DiagnosticAnalyzer
{
private static readonly string[] MefNamespaces = new[] { "System.ComponentModel.Composition", "System.Composition" };

public static DiagnosticDescriptor Rule = new DiagnosticDescriptor(
RoslynDiagnosticIds.MixedVersionsOfMefAttributesRuleId,
RoslynDiagnosticsResources.MixedVersionsOfMefAttributesDescription,
RoslynDiagnosticsResources.MixedVersionsOfMefAttributesMessage,
"Reliability",
DiagnosticSeverity.Error,
isEnabledByDefault: true,
customTags: WellKnownDiagnosticTags.Telemetry);

public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
{
get
{
return ImmutableArray.Create(Rule);
}
}

public override void Initialize(AnalysisContext context)
{
context.RegisterCompilationStartAction(compilationContext =>
{
var exportAttributes = new List<INamedTypeSymbol>();
foreach (var mefNamespace in MefNamespaces)
{
var exportAttribute = compilationContext.Compilation.GetTypeByMetadataName(mefNamespace + ".ExportAttribute");
if (exportAttribute == null)
{
// We don't need to check assemblies unless they're referencing both versions of MEF, so we're done
return;
}
exportAttributes.Add(exportAttribute);
}
compilationContext.RegisterSymbolAction(c => AnalyzeSymbol(c, exportAttributes), SymbolKind.NamedType);
});
}

private void AnalyzeSymbol(SymbolAnalysisContext symbolContext, IEnumerable<INamedTypeSymbol> exportAttributes)
{
var namedType = (INamedTypeSymbol)symbolContext.Symbol;
var namedTypeAttributes = AttributeHelpers.GetApplicableAttributes(namedType);

// Figure out which export attributes are being used here
var appliedExportAttributes = exportAttributes.Where(e => namedTypeAttributes.Any(ad => AttributeHelpers.DerivesFrom(ad.AttributeClass, e))).ToList();

// If we have no exports we're done
if (appliedExportAttributes.Count == 0)
{
return;
}

var badNamespaces = exportAttributes.Except(appliedExportAttributes).Select(s => s.ContainingNamespace).ToList();

// Now look at all attributes and see if any are metadata attributes
foreach (var namedTypeAttribute in namedTypeAttributes)
{
if (AttributeHelpers.GetApplicableAttributes(namedTypeAttribute.AttributeClass).Any(ad => badNamespaces.Contains(ad.AttributeClass.ContainingNamespace) &&
ad.AttributeClass.Name == "MetadataAttributeAttribute"))
{
ReportDiagnostic(symbolContext, namedType, namedTypeAttribute);
}
}

// Also look through all members and their attributes, and see if any are using from bad places
foreach (var member in namedType.GetMembers())
{
foreach (var attribute in member.GetAttributes())
{
if (badNamespaces.Contains(attribute.AttributeClass.ContainingNamespace))
{
ReportDiagnostic(symbolContext, namedType, attribute);
}
}

// if it's a constructor, we should also check parameters since they may have [ImportMany]
var methodSymbol = member as IMethodSymbol;

if (methodSymbol != null && methodSymbol.MethodKind == MethodKind.Constructor)
{
foreach (var parameter in methodSymbol.Parameters)
{
foreach (var attribute in parameter.GetAttributes())
{
if (badNamespaces.Contains(attribute.AttributeClass.ContainingNamespace))
{
ReportDiagnostic(symbolContext, namedType, attribute);
}
}
}
}
}
}

private static void ReportDiagnostic(SymbolAnalysisContext symbolContext, INamedTypeSymbol exportedType, AttributeData problematicAttribute)
{
var metadataSyntax = problematicAttribute.ApplicationSyntaxReference;
var displayStringOfAttribute = problematicAttribute.AttributeClass.ToMinimalDisplayString(symbolContext.Compilation.GetSemanticModel(metadataSyntax.SyntaxTree),
metadataSyntax.Span.Start,
GetSymbolDisplayFormat(exportedType, minimal: true));

var displayStringOfExport = exportedType.ToDisplayString(GetSymbolDisplayFormat(exportedType, minimal: false));

symbolContext.ReportDiagnostic(Diagnostic.Create(Rule, metadataSyntax.GetSyntax().GetLocation(), displayStringOfAttribute, displayStringOfExport));
}

private static SymbolDisplayFormat GetSymbolDisplayFormat(ISymbol symbol, bool minimal)
{
if (symbol.Language == LanguageNames.CSharp)
{
return minimal ? SymbolDisplayFormat.CSharpShortErrorMessageFormat : SymbolDisplayFormat.CSharpErrorMessageFormat;
}
else
{
return minimal ? SymbolDisplayFormat.VisualBasicShortErrorMessageFormat : SymbolDisplayFormat.VisualBasicErrorMessageFormat;
}
}
}
}
28 changes: 24 additions & 4 deletions Src/Diagnostics/Roslyn/Core/RoslynDiagnosticAnalyzers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<Project>{1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}</Project>
<Name>CodeAnalysis</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Workspaces\Core\Workspaces.csproj">
<ProjectReference Include="..\..\..\Workspaces\Core\Portable\Workspaces.csproj">
<Project>{5F8D2414-064A-4B3A-9B42-8E2A04246BE5}</Project>
<Name>Workspaces</Name>
</ProjectReference>
Expand All @@ -36,10 +36,27 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "></PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Composition.AttributedModel, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Convention, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Hosting, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Runtime, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Composition.TypedParts, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="Roslyn.Diagnostics.Analyzers.CSharp" />
Expand All @@ -57,9 +74,12 @@
<Compile Include="Performance\EquatableAnalyzer.cs" />
<Compile Include="Performance\SpecializedEnumerableCreationAnalyzer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Reliability\AttributeHelpers.cs" />
<Compile Include="Reliability\DirectlyAwaitingTaskAnalyzer.cs" />
<Compile Include="Reliability\DirectlyAwaitingTaskAnalyzerRule.cs" />
<Compile Include="Reliability\DirectlyAwaitingTaskFix.cs" />
<Compile Include="Reliability\MissingSharedAttributeAnalyzer.cs" />
<Compile Include="Reliability\MixedVersionsOfMefAttributesAnalyzer.cs" />
<Compile Include="RoslynDiagnosticIds.cs" />
<Compile Include="RoslynDiagnosticsResources.Designer.cs">
<AutoGen>True</AutoGen>
Expand Down
8 changes: 5 additions & 3 deletions Src/Diagnostics/Roslyn/Core/RoslynDiagnosticIds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ internal static class RoslynDiagnosticIds
{
public const string UseEmptyEnumerableRuleId = "RS0001";
public const string UseSingletonEnumerableRuleId = "RS0002";
public const string DirectlyAwaitingTaskAnalyzerRuleId = "RS003";
public const string UseSiteDiagnosticsCheckerRuleId = "RS004";
public const string DontUseCodeActionCreateRuleId = "RS005";
public const string DirectlyAwaitingTaskAnalyzerRuleId = "RS0003";
public const string UseSiteDiagnosticsCheckerRuleId = "RS0004";
public const string DontUseCodeActionCreateRuleId = "RS0005";
public const string MixedVersionsOfMefAttributesRuleId = "RS0006";
public const string UseArrayEmptyRuleId = "RS0007";
public const string ImplementIEquatable = "RS0008";
public const string OverrideObjectEquals = "RS0009";
public const string MissingSharedAttributeRuleId = "RS0010";
}
}
36 changes: 36 additions & 0 deletions Src/Diagnostics/Roslyn/Core/RoslynDiagnosticsResources.Designer.cs
12 changes: 12 additions & 0 deletions Src/Diagnostics/Roslyn/Core/RoslynDiagnosticsResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,18 @@
<data name="DontUseCodeActionCreateMessage" xml:space="preserve">
<value>Consider creating unique code action type per different fix. it will help us to see how each code action is used. otherwise, we will only see bunch of generic code actions being used.</value>
</data>
<data name="MissingSharedAttributeDescription" xml:space="preserve">
<value>Parts exported with MEFv2 must be marked as Shared.</value>
</data>
<data name="MissingSharedAttributeMessage" xml:space="preserve">
<value>Part exported with MEFv2 must be marked with the Shared attribute.</value>
</data>
<data name="MixedVersionsOfMefAttributesDescription" xml:space="preserve">
<value>Do not mix attributes from different versions of MEF</value>
</data>
<data name="MixedVersionsOfMefAttributesMessage" xml:space="preserve">
<value>Attribute '{0}' comes from a different version of MEF than the export attribute on '{1}'</value>
</data>
<data name="UseArrayEmptyDescription" xml:space="preserve">
<value>Avoid zero-length array allocations.</value>
</data>
Expand Down
1 change: 1 addition & 0 deletions Src/Diagnostics/Roslyn/Core/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.Immutable" version="1.1.20-beta" targetFramework="net45" />
<package id="Microsoft.Composition" version="1.0.27" targetFramework="net45" />
<package id="Microsoft.Net.ToolsetCompilers" version="0.7.4092303-beta" targetFramework="net45" />
<package id="StyleCop.MSBuild" version="4.7.48.2" targetFramework="net45" developmentDependency="true" />
</packages>
15 changes: 15 additions & 0 deletions Src/Diagnostics/Roslyn/Setup/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("FxCopRulesSetup")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("FxCopRulesSetup")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
91 changes: 91 additions & 0 deletions Src/Diagnostics/Roslyn/Setup/RoslynDiagnosticsSetup.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\..\packages\Microsoft.Net.ToolsetCompilers.0.7.4092303-beta\build\Microsoft.Net.ToolsetCompilers.props" Condition="Exists('..\..\..\..\packages\Microsoft.Net.ToolsetCompilers.0.7.4092303-beta\build\Microsoft.Net.ToolsetCompilers.props')" />
<ImportGroup Label="Settings">
<Import Project="..\..\..\Tools\Microsoft.CodeAnalysis.Toolset.Open\Targets\VSL.Settings.targets" />
</ImportGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<OutDir>..\..\..\..\Binaries\$(Configuration)\</OutDir>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
<ProjectTypeGuids>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{DEC6D219-A523-422C-AA36-D17662722C0B}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Roslyn.Diagnostics.Setup</RootNamespace>
<AssemblyName>Roslyn.Diagnostics.Setup</AssemblyName>
<GeneratePkgDefFile>false</GeneratePkgDefFile>
<VSSDKTargetPlatformRegRootSuffix>RoslynDev</VSSDKTargetPlatformRegRootSuffix>
<IncludeAssemblyInVSIXContainer>false</IncludeAssemblyInVSIXContainer>
<IncludeDebugSymbolsInVSIXContainer>false</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<ImportVSSDKTargets>true</ImportVSSDKTargets>
<MinimumVisualStudioVersion>$(VisualStudioVersion)</MinimumVisualStudioVersion>
<SolutionDir Condition="'$(SolutionDir)' == '' OR '$(SolutionDir)' == '*Undefined*'">..\..\..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "></PropertyGroup>
<PropertyGroup>
<StartAction>Program</StartAction>
<StartProgram>$(DevEnvDir)devenv.exe</StartProgram>
<StartArguments>/rootsuffix RoslynDev /log</StartArguments>
</PropertyGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="source.extension.vsixmanifest">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.5">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.5 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Core\RoslynDiagnosticAnalyzers.csproj">
<Project>{dcc1f13b-f51c-445b-bdae-92135bd58364}</Project>
<Name>RoslynDiagnosticAnalyzers</Name>
</ProjectReference>
<ProjectReference Include="..\CSharp\CSharpRoslynDiagnosticAnalyzers.csproj">
<Project>{b82f1c54-2d3e-497b-8c31-4ab16d6508fa}</Project>
<Name>CSharpRoslynDiagnosticAnalyzers</Name>
</ProjectReference>
<ProjectReference Include="..\VisualBasicCodeAnalysis\BasicCodeAnalysisRoslynDiagnosticAnalyzers\BasicCodeAnalysisRoslynDiagnosticAnalyzers.vbproj">
<Project>{f4408506-462d-45b1-b801-fe760b92610f}</Project>
<Name>BasicCodeAnalysisRoslynDiagnosticAnalyzers</Name>
</ProjectReference>
<ProjectReference Include="..\VisualBasic\BasicRoslynDiagnosticAnalyzers.vbproj">
<Project>{640b92e8-ed8a-44ac-85c6-50b53837db91}</Project>
<Name>BasicRoslynDiagnosticAnalyzers</Name>
</ProjectReference>
</ItemGroup>
<ImportGroup Label="Targets">
<Import Project="..\..\..\Tools\Microsoft.CodeAnalysis.Toolset.Open\Targets\VSL.Imports.targets" />
<Import Project="..\..\..\..\packages\StyleCop.MSBuild.4.7.48.2\build\StyleCop.MSBuild.Targets" Condition="Exists('..\..\..\..\packages\StyleCop.MSBuild.4.7.48.2\build\StyleCop.MSBuild.Targets')" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Net.ToolsetCompilers.0.7.4092303-beta\build\Microsoft.Net.ToolsetCompilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Net.ToolsetCompilers.0.7.4092303-beta\build\Microsoft.Net.ToolsetCompilers.props'))" />
</Target>
</Project>
5 changes: 5 additions & 0 deletions Src/Diagnostics/Roslyn/Setup/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Net.ToolsetCompilers" version="0.7.4092303-beta" targetFramework="net45" />
<package id="StyleCop.MSBuild" version="4.7.48.2" targetFramework="net45" developmentDependency="true" />
</packages>
20 changes: 20 additions & 0 deletions Src/Diagnostics/Roslyn/Setup/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="b3d2dbbd-311e-47ee-b4ff-679c4505b3de" Version="|%CurrentProject%;GetBuildVersion|" Language="en-US" Publisher="Microsoft" />
<DisplayName>Roslyn Diagnostics</DisplayName>
<Description xml:space="preserve">Diagnostics for the Roslyn codebase.</Description>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[12.0,]" />
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
</Dependencies>
<Assets>
<Asset Type="Microsoft.VisualStudio.Analyzer" Path="|RoslynDiagnosticAnalyzers|" />
<Asset Type="Microsoft.VisualStudio.Analyzer" Path="|BasicRoslynDiagnosticAnalyzers|" />
<Asset Type="Microsoft.VisualStudio.Analyzer" Path="|CSharpRoslynDiagnosticAnalyzers|" />
</Assets>
</PackageManifest>
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@
<Project>{76C6F005-C89D-4348-BB4A-391898DBEB52}</Project>
<Name>TestUtilities</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Workspaces\CSharp\CSharpWorkspace.csproj">
<ProjectReference Include="..\..\..\Workspaces\CSharp\Portable\CSharpWorkspace.csproj">
<Project>{21B239D0-D144-430F-A394-C066D58EE267}</Project>
<Name>CSharpWorkspace</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Workspaces\VisualBasic\BasicWorkspace.vbproj">
<ProjectReference Include="..\..\..\Workspaces\VisualBasic\Portable\BasicWorkspace.vbproj">
<Project>{57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C}</Project>
<Name>BasicWorkspace</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Workspaces\Core\Workspaces.csproj">
<ProjectReference Include="..\..\..\Workspaces\Core\Portable\Workspaces.csproj">
<Project>{5F8D2414-064A-4B3A-9B42-8E2A04246BE5}</Project>
<Name>Workspaces</Name>
</ProjectReference>
Expand Down Expand Up @@ -88,7 +88,6 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "></PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.XML" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<Project>{DCC1F13B-F51C-445B-BDAE-92135BD58364}</Project>
<Name>RoslynDiagnosticAnalyzers</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Workspaces\Core\Workspaces.csproj">
<ProjectReference Include="..\..\..\Workspaces\Core\Portable\Workspaces.csproj">
<Project>{5F8D2414-064A-4B3A-9B42-8E2A04246BE5}</Project>
<Name>Workspaces</Name>
</ProjectReference>
Expand Down Expand Up @@ -62,12 +62,28 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Composition.AttributedModel, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Convention, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Hosting, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Runtime, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Composition.TypedParts, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
' Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

Imports System.Collections.Immutable
Imports System.Composition
Imports System.Threading
Imports System.Threading.Tasks
Imports Microsoft.CodeAnalysis.CodeFixes
Expand All @@ -11,7 +12,7 @@ Imports Roslyn.Diagnostics.Analyzers
Namespace Microsoft.CodeAnalysis.Performance

''' <summary>Provides a code fix for the EmptyArrayDiagnosticAnalyzer.</summary>
<ExportCodeFixProvider("BasicEmptyArrayCodeFixProvider", LanguageNames.VisualBasic)>
<ExportCodeFixProvider("BasicEmptyArrayCodeFixProvider", LanguageNames.VisualBasic), [Shared]>
Public NotInheritable Class BasicEmptyArrayCodeFixProvider
Inherits CodeFixProviderBase

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
' Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

Imports System.Composition
Imports System.Threading
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.CodeFixes
Expand All @@ -9,7 +10,7 @@ Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Roslyn.Diagnostics.Analyzers

Namespace Roslyn.Diagnostics.CodeFixes.VisualBasic
<ExportCodeFixProvider(RoslynDiagnosticIds.DirectlyAwaitingTaskAnalyzerRuleId, LanguageNames.VisualBasic)>
<ExportCodeFixProvider(RoslynDiagnosticIds.DirectlyAwaitingTaskAnalyzerRuleId, LanguageNames.VisualBasic), [Shared]>
Public Class BasicDirectlyAwaitingTaskFix
Inherits DirectlyAwaitingTaskFix(Of ExpressionSyntax)

Expand Down
1 change: 1 addition & 0 deletions Src/Diagnostics/Roslyn/VisualBasic/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.Immutable" version="1.1.20-beta" targetFramework="net45" />
<package id="Microsoft.Composition" version="1.0.27" targetFramework="net45" />
<package id="Microsoft.Net.ToolsetCompilers" version="0.7.4092303-beta" targetFramework="net45" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<Project>{DCC1F13B-F51C-445B-BDAE-92135BD58364}</Project>
<Name>RoslynDiagnosticAnalyzers</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Workspaces\Core\Workspaces.csproj">
<ProjectReference Include="..\..\..\..\Workspaces\Core\Portable\Workspaces.csproj">
<Project>{5F8D2414-064A-4B3A-9B42-8E2A04246BE5}</Project>
<Name>Workspaces</Name>
</ProjectReference>
Expand Down Expand Up @@ -62,7 +62,6 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
Expand Down
10 changes: 7 additions & 3 deletions Src/Diagnostics/Test/Utilities/DiagnosticsTestUtilities.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,19 @@
<Project>{76C6F005-C89D-4348-BB4A-391898DBEB52}</Project>
<Name>TestUtilities</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Workspaces\CSharp\CSharpWorkspace.csproj">
<ProjectReference Include="..\..\..\Workspaces\Core\Desktop\Workspaces.Desktop.csproj">
<Project>{2e87fa96-50bb-4607-8676-46521599f998}</Project>
<Name>Workspaces.Desktop</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Workspaces\CSharp\Portable\CSharpWorkspace.csproj">
<Project>{21B239D0-D144-430F-A394-C066D58EE267}</Project>
<Name>CSharpWorkspace</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Workspaces\VisualBasic\BasicWorkspace.vbproj">
<ProjectReference Include="..\..\..\Workspaces\VisualBasic\Portable\BasicWorkspace.vbproj">
<Project>{57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C}</Project>
<Name>BasicWorkspace</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Workspaces\Core\Workspaces.csproj">
<ProjectReference Include="..\..\..\Workspaces\Core\Portable\Workspaces.csproj">
<Project>{5F8D2414-064A-4B3A-9B42-8E2A04246BE5}</Project>
<Name>Workspaces</Name>
</ProjectReference>
Expand Down
315 changes: 195 additions & 120 deletions Src/Roslyn.sln

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
<HintPath>$(VSLOutDir)\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces.Desktop">
<HintPath>$(VSLOutDir)\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces">
<HintPath>$(VSLOutDir)\Microsoft.CodeAnalysis.CSharp.Workspaces.dll</HintPath>
<Private>false</Private>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.Diagnostics;
using System.Linq;
using System.Threading;
Expand All @@ -19,7 +20,7 @@ namespace AsyncPackage
/// <summary>
/// Codefix that changes the type of a variable to be Func of Task instead of a void-returning delegate type.
/// </summary>
[ExportCodeFixProvider(AsyncLambdaAnalyzer.AsyncLambdaId1, LanguageNames.CSharp)]
[ExportCodeFixProvider(AsyncLambdaAnalyzer.AsyncLambdaId1, LanguageNames.CSharp), Shared]
public class AsyncLambdaVariableCodeFix : CodeFixProvider
{
public sealed override ImmutableArray<string> GetFixableDiagnosticIds()
Expand Down
20 changes: 20 additions & 0 deletions Src/Samples/CSharp/AsyncPackage/AsyncPackage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,26 @@
<Private>false</Private>
</Reference>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Composition.AttributedModel, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Convention, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Hosting, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Runtime, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Composition.TypedParts, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
Expand Down
3 changes: 2 additions & 1 deletion Src/Samples/CSharp/AsyncPackage/AsyncVoidCodeFix.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -16,7 +17,7 @@ namespace AsyncPackage
/// <summary>
/// This codefix replaces the void return type with Task in any method declaration the AsyncVoidAnalyzer catches
/// </summary>
[ExportCodeFixProvider(AsyncVoidAnalyzer.AsyncVoidId, LanguageNames.CSharp)]
[ExportCodeFixProvider(AsyncVoidAnalyzer.AsyncVoidId, LanguageNames.CSharp), Shared]
public class AsyncVoidCodeFix : CodeFixProvider
{
public sealed override ImmutableArray<string> GetFixableDiagnosticIds()
Expand Down
3 changes: 2 additions & 1 deletion Src/Samples/CSharp/AsyncPackage/BlockingAsyncCodeFix.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -18,7 +19,7 @@ namespace AsyncPackage
/// <summary>
/// Codefix changes the synchronous operations to it's asynchronous equivalent.
/// </summary>
[ExportCodeFixProvider(BlockingAsyncAnalyzer.BlockingAsyncId, LanguageNames.CSharp)]
[ExportCodeFixProvider(BlockingAsyncAnalyzer.BlockingAsyncId, LanguageNames.CSharp), Shared]
public class BlockingAsyncCodeFix : CodeFixProvider
{
public sealed override ImmutableArray<string> GetFixableDiagnosticIds()
Expand Down
3 changes: 2 additions & 1 deletion Src/Samples/CSharp/AsyncPackage/CancellationCodeFix.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -16,7 +17,7 @@ namespace AsyncPackage
/// <summary>
/// Codefix that changes the type of a variable to be Func of Task instead of a void-returning delegate type.
/// </summary>
[ExportCodeFixProvider(CancellationAnalyzer.CancellationId, LanguageNames.CSharp)]
[ExportCodeFixProvider(CancellationAnalyzer.CancellationId, LanguageNames.CSharp), Shared]
public class CancellationCodeFix : CodeFixProvider
{
public sealed override ImmutableArray<string> GetFixableDiagnosticIds()
Expand Down
3 changes: 0 additions & 3 deletions Src/Samples/CSharp/AsyncPackage/Diagnostic.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
<title>AsyncPackage</title>
<authors>AsyncPackage</authors>
<owners>AsyncPackage</owners>
<licenseUrl>http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE</licenseUrl>
<projectUrl>http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE</projectUrl>
<iconUrl>http://ICON_URL_HERE_OR_DELETE_THIS_LINE</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>AsyncPackage</description>
<releaseNotes>Summary of changes made in this release of the package.</releaseNotes>
Expand Down
3 changes: 2 additions & 1 deletion Src/Samples/CSharp/AsyncPackage/RenameAsyncCodeFix.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -16,7 +17,7 @@ namespace AsyncPackage
/// <summary>
/// This codefix adds "Async" to the end of the Method Identifier and does a basic spellcheck in case the user had already tried to type Async
/// </summary>
[ExportCodeFixProvider(RenameAsyncAnalyzer.RenameAsyncId, LanguageNames.CSharp)]
[ExportCodeFixProvider(RenameAsyncAnalyzer.RenameAsyncId, LanguageNames.CSharp), Shared]
public class RenameAsyncCodeFix : CodeFixProvider
{
public sealed override ImmutableArray<string> GetFixableDiagnosticIds()
Expand Down
5 changes: 5 additions & 0 deletions Src/Samples/CSharp/AsyncPackage/Test/AsyncPackage.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@
<HintPath>(VSLOutDir)\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces.Desktop">
<SpecificVersion>False</SpecificVersion>
<HintPath>(VSLOutDir)\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Collections.Immutable">
<SpecificVersion>False</SpecificVersion>
Expand Down
1 change: 1 addition & 0 deletions Src/Samples/CSharp/AsyncPackage/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
<package id="Microsoft.CodeAnalysis.VisualBasic" version="0.7.4052301-beta" targetFramework="net45" />
<package id="Microsoft.CodeAnalysis.VisualBasic.Workspaces" version="0.7.4052301-beta" targetFramework="net45" />
<package id="Microsoft.CodeAnalysis.Workspaces.Common" version="0.7.4052301-beta" targetFramework="net45" />
<package id="Microsoft.Composition" version="1.0.27" targetFramework="net45" />
<package id="Microsoft.Net.ToolsetCompilers" version="0.7.4092303-beta" targetFramework="net45" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
<HintPath>$(VSLOutDir)\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces.Desktop">
<HintPath>$(VSLOutDir)\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces">
<HintPath>$(VSLOutDir)\Microsoft.CodeAnalysis.CSharp.Workspaces.dll</HintPath>
<Private>false</Private>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

using System;
using System.Collections.Generic;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -34,7 +35,7 @@

namespace ConvertToAutoPropertyCS
{
[ExportCodeRefactoringProvider("ConvertToAutoPropertyCS", LanguageNames.CSharp)]
[ExportCodeRefactoringProvider("ConvertToAutoPropertyCS", LanguageNames.CSharp), Shared]
internal class ConvertToAutoPropertyCodeRefactoringProvider : CodeRefactoringProvider
{
public sealed override async Task<IEnumerable<CodeAction>> GetRefactoringsAsync(CodeRefactoringContext context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,26 @@
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Composition.AttributedModel, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Convention, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Hosting, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Runtime, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Composition.TypedParts, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.Immutable" version="1.1.20-beta" targetFramework="net45" />
<package id="Microsoft.Composition" version="1.0.27" targetFramework="net45" />
<package id="Microsoft.Net.ToolsetCompilers" version="0.7.4092303-beta" targetFramework="net45" />
<package id="StyleCop.MSBuild" version="4.7.48.2" targetFramework="net45" developmentDependency="true" />
</packages>
4 changes: 4 additions & 0 deletions Src/Samples/CSharp/FormatSolution/FormatSolutionCS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
<HintPath>$(VSLOutDir)\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces.Desktop">
<HintPath>$(VSLOutDir)\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces">
<HintPath>$(VSLOutDir)\Microsoft.CodeAnalysis.CSharp.Workspaces.dll</HintPath>
<Private>false</Private>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

using System;
using System.Collections.Generic;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -35,7 +36,7 @@

namespace ImplementNotifyPropertyChangedCS
{
[ExportCodeRefactoringProvider("ImplementNotifyPropertyChangedCS", LanguageNames.CSharp)]
[ExportCodeRefactoringProvider("ImplementNotifyPropertyChangedCS", LanguageNames.CSharp), Shared]
internal partial class ImplementNotifyPropertyChangedCodeRefactoringProvider : CodeRefactoringProvider
{
public sealed override async Task<IEnumerable<CodeAction>> GetRefactoringsAsync(CodeRefactoringContext context)
Expand All @@ -59,9 +60,11 @@ public sealed override async Task<IEnumerable<CodeAction>> GetRefactoringsAsync(

var properties = ExpansionChecker.GetExpandableProperties(textSpan, root, model);

#pragma warning disable RS0005
return properties.Any()
? new[] { CodeAction.Create("Apply INotifyPropertyChanged pattern", (c) => ImplementNotifyPropertyChangedAsync(document, root, model, properties, c)) }
: null;
#pragma warning restore RS0005
}

private async Task<Document> ImplementNotifyPropertyChangedAsync(Document document, CompilationUnitSyntax root, SemanticModel model, IEnumerable<ExpandablePropertyInfo> properties, CancellationToken cancellationToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,26 @@
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Composition.AttributedModel, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Convention, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Hosting, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Runtime, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Composition.TypedParts, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.Immutable" version="1.1.20-beta" targetFramework="net45" />
<package id="Microsoft.Composition" version="1.0.27" targetFramework="net45" />
<package id="Microsoft.Net.ToolsetCompilers" version="0.7.4092303-beta" targetFramework="net45" />
<package id="StyleCop.MSBuild" version="4.7.48.2" targetFramework="net45" developmentDependency="true" />
</packages>
3 changes: 2 additions & 1 deletion Src/Samples/CSharp/MakeConst/Impl/CodeFixProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -35,7 +36,7 @@

namespace MakeConstCS
{
[ExportCodeFixProvider("MakeConstCS", LanguageNames.CSharp)]
[ExportCodeFixProvider("MakeConstCS", LanguageNames.CSharp), Shared]
internal class MakeConstCodeFixProvider : CodeFixProvider
{
public sealed override ImmutableArray<string> GetFixableDiagnosticIds()
Expand Down
20 changes: 20 additions & 0 deletions Src/Samples/CSharp/MakeConst/Impl/MakeConstCS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,26 @@
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Composition.AttributedModel, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Convention, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Hosting, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Runtime, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Composition.TypedParts, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Xaml" />
Expand Down
1 change: 1 addition & 0 deletions Src/Samples/CSharp/MakeConst/Impl/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.Immutable" version="1.1.20-beta" targetFramework="net45" />
<package id="Microsoft.Composition" version="1.0.27" targetFramework="net45" />
<package id="Microsoft.Net.ToolsetCompilers" version="0.7.4092303-beta" targetFramework="net45" />
<package id="StyleCop.MSBuild" version="4.7.48.2" targetFramework="net45" developmentDependency="true" />
</packages>
4 changes: 4 additions & 0 deletions Src/Samples/Shared/UnitTestFramework/UnitTestFramework.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
<HintPath>$(VSLOutDir)\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces.Desktop">
<HintPath>$(VSLOutDir)\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>
<ItemGroup Label="File References">
<Reference Include="System.Collections.Immutable">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
<HintPath>$(VSLOutDir)\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces.Desktop">
<HintPath>$(VSLOutDir)\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces">
<HintPath>$(VSLOutDir)\Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll</HintPath>
<Private>false</Private>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
<HintPath>$(VSLOutDir)\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces.Desktop">
<HintPath>$(VSLOutDir)\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces">
<HintPath>$(VSLOutDir)\Microsoft.CodeAnalysis.CSharp.Workspaces.dll</HintPath>
<Private>false</Private>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
'
' *********************************************************

Imports System.ComponentModel.Composition
Imports System.Composition
Imports System.Threading
Imports System.Threading.Tasks
Imports Microsoft.CodeAnalysis
Expand All @@ -32,7 +32,7 @@ Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax

<ExportCodeRefactoringProvider("ConvertToAutoPropertyVB", LanguageNames.VisualBasic)>
<ExportCodeRefactoringProvider("ConvertToAutoPropertyVB", LanguageNames.VisualBasic), [Shared]>
Class ConvertToAutoPropertyCodeRefactoringProvider
Inherits CodeRefactoringProvider

Expand Down Expand Up @@ -135,7 +135,7 @@ Class ConvertToAutoPropertyCodeRefactoringProvider
Dim oldRoot = DirectCast(Await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(False), SyntaxNode)
Dim semanticModel = Await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(False)

Dim referenceRewriter = New ReferenceRewriter(propertyName, backingField, semanticModel)
Dim referenceRewriter = New referenceRewriter(propertyName, backingField, semanticModel)
Dim newRoot = referenceRewriter.Visit(oldRoot)

Return document.WithSyntaxRoot(newRoot)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,26 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Composition.AttributedModel, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Convention, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Hosting, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Runtime, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Composition.TypedParts, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.Immutable" version="1.1.20-beta" targetFramework="net45" />
<package id="Microsoft.Composition" version="1.0.27" targetFramework="net45" />
<package id="Microsoft.Net.ToolsetCompilers" version="0.7.4092303-beta" targetFramework="net45" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
<HintPath>$(VSLOutDir)\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces.Desktop">
<HintPath>$(VSLOutDir)\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces">
<HintPath>$(VSLOutDir)\Microsoft.CodeAnalysis.CSharp.Workspaces.dll</HintPath>
<Private>false</Private>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
'
' *********************************************************

Imports System.Composition
Imports System.Threading
Imports System.Threading.Tasks
Imports Microsoft.CodeAnalysis
Expand All @@ -30,7 +31,7 @@ Imports Microsoft.CodeAnalysis.Simplification
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax

<ExportCodeRefactoringProvider("ImplementNotifyPropertyChangedVB", LanguageNames.VisualBasic)>
<ExportCodeRefactoringProvider("ImplementNotifyPropertyChangedVB", LanguageNames.VisualBasic), [Shared]>
Friend Class ImplementNotifyPropertyChangedCodeRefactoringProvider
Inherits CodeRefactoringProvider

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,26 @@
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Composition.AttributedModel, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Convention, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Hosting, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Runtime, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Composition.TypedParts, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.Immutable" version="1.1.20-beta" targetFramework="net45" />
<package id="Microsoft.Composition" version="1.0.27" targetFramework="net45" />
<package id="Microsoft.Net.ToolsetCompilers" version="0.7.4092303-beta" targetFramework="net45" />
</packages>
3 changes: 2 additions & 1 deletion Src/Samples/VisualBasic/MakeConst/Impl/CodeFixProvider.vb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
' *********************************************************

Imports System.Collections.Immutable
Imports System.Composition
Imports System.Threading
Imports System.Threading.Tasks
Imports Microsoft.CodeAnalysis
Expand All @@ -31,7 +32,7 @@ Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax

<ExportCodeFixProvider("MakeConstVB", LanguageNames.VisualBasic)>
<ExportCodeFixProvider("MakeConstVB", LanguageNames.VisualBasic), [Shared]>
Class MakeConstCodeFixProvider
Inherits CodeFixProvider

Expand Down
20 changes: 20 additions & 0 deletions Src/Samples/VisualBasic/MakeConst/Impl/MakeConstVB.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,26 @@
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Composition.AttributedModel, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Convention, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Hosting, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll</HintPath>
</Reference>
<Reference Include="System.Composition.Runtime, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Composition.TypedParts, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml" />
Expand Down
1 change: 1 addition & 0 deletions Src/Samples/VisualBasic/MakeConst/Impl/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.Immutable" version="1.1.20-beta" targetFramework="net45" />
<package id="Microsoft.Composition" version="1.0.27" targetFramework="net45" />
<package id="Microsoft.Net.ToolsetCompilers" version="0.7.4092303-beta" targetFramework="net45" />
</packages>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Threading;
using Roslyn.Compilers;
using Roslyn.Compilers.Common;
using Roslyn.Compilers.CSharp;
using Roslyn.Services.Shared.Extensions;
using Roslyn.Utilities;

namespace Roslyn.Services.CSharp.Classification.Classifiers
{
internal class TypeParameterConstraintClauseSyntaxClassifier : AbstractSyntaxClassifier
{
public override IEnumerable<ClassifiedSpan> ClassifyNode(
IDocument document,
CommonSyntaxNode syntax,
CancellationToken cancellationToken)
{
if (syntax is TypeParameterConstraintClauseSyntax)
{
return ClassifyTypeParameterConstraintClause(document, (TypeParameterConstraintClauseSyntax)syntax, cancellationToken);
}

return null;
}

public override IEnumerable<System.Type> SyntaxNodeTypes
{
get
{
yield return typeof(TypeParameterConstraintClauseSyntax);
}
}

private IEnumerable<ClassifiedSpan> ClassifyTypeParameterConstraintClause(
IDocument document,
TypeParameterConstraintClauseSyntax constraintClause,
CancellationToken cancellationToken)
{
var semanticModel = document.GetSemanticModel(cancellationToken);
var identifier = constraintClause.Identifier;
var symbol = semanticModel.GetSymbolInfo(identifier, cancellationToken).GetAllSymbols().OfType<ITypeSymbol>().FirstOrDefault();

if (symbol != null)
{
var classification = GetClassificationForType(symbol);
if (classification != null)
{
return SpecializedCollections.SingletonEnumerable(new ClassifiedSpan(identifier.Span, classification));
}
}

return null;
}
}
}